Documentation ¶
Index ¶
- type BotCommand
- type Request
- func (r *Request) BooleanParam(key string, defaultValue bool) bool
- func (r *Request) FloatParam(key string, defaultValue float64) float64
- func (r *Request) IntegerParam(key string, defaultValue int) int
- func (r *Request) Param(key string) string
- func (r *Request) StringParam(key string, defaultValue string) string
- type Response
- type ResponseWriter
- type Slacker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotCommand ¶
type BotCommand struct {
// contains filtered or unexported fields
}
BotCommand structure contains the bot's command, description and handler
func NewBotCommand ¶
func NewBotCommand(usage string, description string, handler func(request *Request, response ResponseWriter)) *BotCommand
NewBotCommand creates a new bot command object
func (*BotCommand) Execute ¶
func (c *BotCommand) Execute(request *Request, response ResponseWriter)
Execute executes the handler logic
func (*BotCommand) Match ¶
func (c *BotCommand) Match(text string) (*proper.Properties, bool)
Match determines whether the bot should respond based on the text received
func (*BotCommand) Tokenize ¶
func (c *BotCommand) Tokenize() []*commander.Token
Tokenize returns the command format's tokens
type Request ¶
type Request struct { Context context.Context Event *slack.MessageEvent // contains filtered or unexported fields }
Request contains the Event received and parameters
func NewRequest ¶
func NewRequest(ctx context.Context, event *slack.MessageEvent, properties *proper.Properties) *Request
NewRequest creates a new Request structure
func (*Request) BooleanParam ¶
BooleanParam attempts to look up a boolean value by key. If not found, return the default boolean value
func (*Request) FloatParam ¶
FloatParam attempts to look up a float value by key. If not found, return the default float value
func (*Request) IntegerParam ¶
IntegerParam attempts to look up a integer value by key. If not found, return the default integer value
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response contains the channel and Real Time Messaging library
func NewResponse ¶
NewResponse creates a new response structure
func (*Response) ReportError ¶
ReportError sends back a formatted error message to the channel where we received the event from
type ResponseWriter ¶
A ResponseWriter interface is used to respond to an event
type Slacker ¶
Slacker contains the Slack API, botCommands, and handlers
func (*Slacker) Command ¶
func (s *Slacker) Command(usage string, description string, handler func(request *Request, response ResponseWriter))
Command define a new command and append it to the list of existing commands
func (*Slacker) Default ¶
func (s *Slacker) Default(defaultHandler func(request *Request, response ResponseWriter))
Default handle when none of the commands are matched