Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPlugin ¶
func NewPlugin(cron Context) plugins.BotMessagePlugin
Types ¶
type ActionType ¶
type ActionType string
const ( AddAction ActionType = "add" RandomAddAction ActionType = "random" DelAction ActionType = "del" DeleteAction ActionType = "delete" StopAction ActionType = "stop" ListAction ActionType = "list" RefreshAction ActionType = "refresh" HelpAction ActionType = "help" )
type Command ¶
type Command struct {
Trigger string // cron
Action ActionType
CronSpec string
Args []string
CronID string
}
type Context ¶
type Context interface {
AddCommand(channel string, c Command) string
DelCommand(channel string, c Command) string
ListCommand(channel string, c Command) string
HelpCommand(channel string, c Command) string
Refresh(messageSender plugins.MessageSender, channel string)
AllRefresh(messageSender plugins.MessageSender)
Close()
}
func NewContext ¶
func NewContext(repository Repository) (Context, error)
NewContext create cron context
type Repository ¶
type Repository interface {
Load() (map[string]TaskMap, error)
Save(cronTaskMap map[string]TaskMap) error
Close() error
}
func NewInMemoryRepository ¶
func NewInMemoryRepository() Repository
NewInMemoryRepository create in memory repository
func NewRedisRepository ¶
func NewRedisRepository(addr, password string, db int64, redisKeyFmt string) Repository
NewRedisRepository create redis repository
Click to show internal directories.
Click to hide internal directories.