cmd

package
v0.0.0-...-7355567 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.5.0"

Variables

View Source
var (
	DownloadUsers = &cobra.Command{
		Use:   "download-users",
		Short: fmt.Sprintf("Download users from Slack"),
		Long:  fmt.Sprintf("Get users from Slack and save as `%s` (filters out users marked as bots and deleted users).", filename),
		Run:   func(cmd *cobra.Command, args []string) { downloadUserFromSlack() },
	}
)
View Source
var GetNow = time.Now
View Source
var SendRemindersCmd = &cobra.Command{
	Use:   "send-reminders",
	Short: "Send remidners via configured handlers",
	Long:  "Send remidners via configured handlers",
	Run: func(cmd *cobra.Command, args []string) {
		cfg := config.GetConfig()
		SendReminders(
			cfg,
			slack.NewClient(cfg.Slack.BotToken, cfg.Slack.UserToken),
		)
	},
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show app version",
	Long:  "Show app version",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println(fmt.Sprintf("celebrations v%s", Version))
	},
}

Functions

func DayAndMonthMatch

func DayAndMonthMatch(t time.Time) bool

func Execute

func Execute()

func GetTodaysEventsForPerson

func GetTodaysEventsForPerson(
	p config.Person,
	c *config.Config,
) <-chan Event

func SendReminders

func SendReminders(c *config.Config, sc slack.SlackCommunicator)

func SlackAnniversaryChannelHandler

func SlackAnniversaryChannelHandler(e PersonalEvent, c *config.Config, s slack.ChannelMessenger)

func SlackBirthdayPersonalReminderHandler

func SlackBirthdayPersonalReminderHandler(e PersonalEvent, c *config.Config, s slack.PersonalReminderSetter)

func SlackBirthdayReminderChannelHandler

func SlackBirthdayReminderChannelHandler(e PersonalEvent, c *config.Config, s slack.ChannelMessenger)

func SlackBirthdayReminderDirectMessageHandler

func SlackBirthdayReminderDirectMessageHandler(e PersonalEvent, c *config.Config, s slack.DirectMessenger)

func SlackMonthlyReportHandler

func SlackMonthlyReportHandler(e MonthlyReportEvent, c *config.Config, s slack.ChannelMessenger)

Types

type Event

type Event interface {
	GetType() EventType
}

type EventType

type EventType uint16
const (
	Anniversary EventType = iota
	Birthday
	UpcomingBirthday
	MonthlyReportDay
)

type MonthlyReportEvent

type MonthlyReportEvent struct {
	Type          EventType
	Birthdays     []config.Person
	Anniversaries []config.Person
}

func GetMonthlyReportEvent

func GetMonthlyReportEvent(p []config.Person) MonthlyReportEvent

func (MonthlyReportEvent) GetType

func (e MonthlyReportEvent) GetType() EventType

type PersonalEvent

type PersonalEvent struct {
	Type   EventType
	Person config.Person
}

func (PersonalEvent) GetType

func (e PersonalEvent) GetType() EventType

type SlackUser

type SlackUser struct {
	Name              string `yaml:"name"`
	SlackMemberID     string `yaml:"slack_member_id"`
	BirthDate         string `yaml:"birth_date"`
	JoinDate          string `yaml:"join_date"`
	LeadSlackMemberID string `yaml:"lead_slack_member_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL