Documentation ¶
Index ¶
- func AWSLambdaHandler(ctx context.Context, e events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
- func AWSLambdaStart()
- func AddCommand(c *Command)
- func ClearCommand()
- func Help(c *Command, desc bool) string
- func ListenAndServe(pattern, addr string, handler http.Handler)
- func OnCall(w http.ResponseWriter, r *http.Request)
- func ParseOption(c *Command, options []string) (interface{}, error)
- func PostEphemeral(e Event, message string)
- func PostMessage(e Event, message string)
- func ReplyMessage(e Event, message string)
- func SetDefaultHelpDescription(description bool)
- func SetMessageHandler(handler MessageHandler)
- func Setup(argBotUserID, argVerificationToken, argAccessToken string)
- func SetupCommand(custom []*Command)
- type Command
- type Event
- type HelpCommandOption
- type HelpCommandOptionDesc
- type HelpCommandOptionSimple
- type MessageHandler
- type Payload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AWSLambdaHandler ¶
func AWSLambdaHandler(ctx context.Context, e events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
AWSLambdaHandler is handler when a slack event is received via aws lambda.
func ListenAndServe ¶
ListenAndServe is start the http server. use net/http
func OnCall ¶
func OnCall(w http.ResponseWriter, r *http.Request)
OnCall is receive slack events handler.
func ParseOption ¶
ParseOption of the command.
func SetDefaultHelpDescription ¶
func SetDefaultHelpDescription(description bool)
SetDefaultHelpDescription display.
func SetMessageHandler ¶
func SetMessageHandler(handler MessageHandler)
SetMessageHandler for slackbot
func SetupCommand ¶
func SetupCommand(custom []*Command)
SetupCommand for slackbot. help and ping command are added automativally.
Types ¶
type Command ¶
type Command struct { Name string HelpMessage string Execute func(e Event, opt interface{}) Option interface{} }
Command for Slack ChatOps.
type Event ¶
type Event map[string]interface{}
Event of slack.
func (Event) ThreadTimestamp ¶
ThreadTimestamp of Event. If not thread, get event timestamp.
type HelpCommandOption ¶
type HelpCommandOption interface {
IsDescription() string
}
HelpCommandOption interface.
type HelpCommandOptionDesc ¶
type HelpCommandOptionDesc struct {
Description string `default:"true" choice:"false,true"`
}
HelpCommandOptionDesc is Help Command Option with default description enabled.
func (HelpCommandOptionDesc) IsDescription ¶
func (o HelpCommandOptionDesc) IsDescription() string
IsDescription check.
type HelpCommandOptionSimple ¶
type HelpCommandOptionSimple struct {
Description string `default:"false" choice:"false,true"`
}
HelpCommandOptionSimple is Help Command Option with default description enabled.
func (HelpCommandOptionSimple) IsDescription ¶
func (o HelpCommandOptionSimple) IsDescription() string
IsDescription check.
type MessageHandler ¶
type MessageHandler interface { OnMessage(e Event, texts []string) OnMentionMessage(e Event, texts []string) }
MessageHandler for Slack