event

package
v0.0.0-...-c8d160d Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(arr []string, cond func(string) bool) []string

func FmtDuration

func FmtDuration(d time.Duration) string

Format a time.Duration till karma reset for display to user

func IsBotMentioned

func IsBotMentioned(event *slack.MessageEvent, rtm *slack.RTM) bool

func IsBotMessage

func IsBotMessage(msg slack.RTMEvent) bool

func IsDirectMessage

func IsDirectMessage(event *slack.MessageEvent) bool

func Keys

func Keys(m map[string]int) []string

func LastPointReset

func LastPointReset() time.Time

Get last point reset time

func Map

func Map(vs []string, f func(string) string) []string

func NextPointReset

func NextPointReset() time.Time

Get next point reset time

func TimeTillPointReset

func TimeTillPointReset() time.Duration

Get time till the next emoji reset

Types

type EmojiHandler

type EmojiHandler struct {
	// contains filtered or unexported fields
}

func NewEmojiHandler

func NewEmojiHandler(emoji map[string]int, dailyCap int, db database.Driver) EmojiHandler

func (EmojiHandler) Execute

func (h EmojiHandler) Execute(e slack.RTMEvent, rtm *slack.RTM) bool

func (EmojiHandler) Matches

func (h EmojiHandler) Matches(e slack.RTMEvent, rtm *slack.RTM) bool

type EventHandler

type EventHandler interface {
	Matches(slack.RTMEvent, *slack.RTM) bool
	Execute(slack.RTMEvent, *slack.RTM) bool
}

type HelpHandler

type HelpHandler struct {
	// contains filtered or unexported fields
}

func NewHelpHandler

func NewHelpHandler(dailyCap int, emojiMap map[string]int) HelpHandler

func (HelpHandler) Execute

func (h HelpHandler) Execute(e slack.RTMEvent, rtm *slack.RTM) bool

func (HelpHandler) Matches

func (h HelpHandler) Matches(e slack.RTMEvent, rtm *slack.RTM) bool

type LeaderHandler

type LeaderHandler struct {
	// contains filtered or unexported fields
}

func NewLeaderHandler

func NewLeaderHandler(db database.Driver) LeaderHandler

func (LeaderHandler) Execute

func (h LeaderHandler) Execute(e slack.RTMEvent, rtm *slack.RTM) bool

func (LeaderHandler) Matches

func (h LeaderHandler) Matches(e slack.RTMEvent, rtm *slack.RTM) bool

type PingHandler

type PingHandler struct{}

func (PingHandler) Execute

func (p PingHandler) Execute(e slack.RTMEvent, rtm *slack.RTM) bool

func (PingHandler) Matches

func (p PingHandler) Matches(e slack.RTMEvent, rtm *slack.RTM) bool

type PointsHandler

type PointsHandler struct {
	// contains filtered or unexported fields
}

func NewPointsHandler

func NewPointsHandler(dailyCap int, db database.Driver) PointsHandler

func (PointsHandler) Execute

func (h PointsHandler) Execute(e slack.RTMEvent, rtm *slack.RTM) bool

func (PointsHandler) Matches

func (h PointsHandler) Matches(e slack.RTMEvent, rtm *slack.RTM) bool

Jump to

Keyboard shortcuts

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