Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCommand ¶
func RegisterCommand(factory CommandFactory)
RegisterCommand registers a new command if not already done.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is the struct for the slack bot.
func New ¶
func New(authorizer *auth.Authorizer, cfg *config.SlackConfig, logger log.Logger) (*Bot, error)
New returns a new Bot or an error.
func (*Bot) ListenAndRespond ¶
func (b *Bot) ListenAndRespond(stop <-chan struct{})
ListenAndRespond will make the bot listen to events and respond o them.
type Command ¶
type Command interface {
// Init maybe used for initializing the command.
Init() error
// Describe returns a short description of the command.
Describe() string
// Keywords is a list of strings which trigger this command.
Keywords() []string
// IsDisabled can be used to (temporarily) disable a command.
IsDisabled() bool
// RequiredUserRole returns the UserRole required to run the command.
// Should at least return auth.UserRoles.Base .
RequiredUserRole() auth.UserRole
// Run executes the command and returns the response or an error.
Run(originalMsg *slack.Msg) (*slack.Msg, error)
}
Command is the interface for slack bot commands.
type CommandFactory ¶
type CommandFactory func() Command
Click to show internal directories.
Click to hide internal directories.