Documentation
¶
Overview ¶
Package mmbot provides a bot framework for Mattermost.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { UserName string // Bot account name BindAddress string // Bind address to listen on Port int // Port to listen on DisableServer bool // Disable HTTP server }
Config for the robot.
type HandlerAction ¶
HandlerAction is a function that process a message.
type Job ¶
type Job struct { // NOTE: It is different from cron, there is also seconds field. Schedule string // Job function. Action JobFunc }
Job is a scheduled task.
type PatternHandler ¶
type PatternHandler struct { MessageType message.Type Pattern *regexp.Regexp Action HandlerAction }
PatternHandler is a pattern matching handler.
type Robot ¶
type Robot struct { Config *Config Client adapter.Adapter Handlers []Handler Routes []Route Jobs []Job Logger *log.Logger // contains filtered or unexported fields }
Robot is a main controller of the bot.
type Route ¶
type Route struct { // HTTP method (e.g. "GET", "POST"). // All methods are allowed if empty. Methods []string // Route pattern (e.g. "/articles/{category}/{id:[0-9]+}") // Pattern can have variables that are defined by "{name}" or "{name:regexp}" format. // Variables can be retrieved calling Robot.RouteVars(). Pattern string // Route action. Action RouteHandlerFunc }
Route is a HTTP route.
func NewStatsRoute ¶
NewStatsRoute returns the route for statistics of the process.
type RouteHandlerFunc ¶
type RouteHandlerFunc func(*Robot, http.ResponseWriter, *http.Request)
RouteHandlerFunc is route action function.
Directories
¶
Path | Synopsis |
---|---|
Package adapter defines Adapter interface for mmbot.
|
Package adapter defines Adapter interface for mmbot. |
Package app provides a base of the bot application.
|
Package app provides a base of the bot application. |
Package message defines in/out message types.
|
Package message defines in/out message types. |
Package mmhook implements an adapter that uses Mattermost Webhooks.
|
Package mmhook implements an adapter that uses Mattermost Webhooks. |
Package shell implements an adapter that uses readline interactive shell for development.
|
Package shell implements an adapter that uses readline interactive shell for development. |
Click to show internal directories.
Click to hide internal directories.