Documentation ¶
Index ¶
- Constants
- func Register(name string, ready func(bot *Bot))
- type Bot
- func (bot *Bot) Match(callback func(*model.Post, *Bot), matchStrs ...string)
- func (bot *Bot) MatchRegex(callback func(*model.Post, *Bot), matchRegex ...string)
- func (bot *Bot) NewPost() *model.Post
- func (bot *Bot) SendMessage(post *model.Post) error
- func (bot *Bot) SetDefaultChannel() error
- func (bot *Bot) SetTeam(teamName string) error
- func (bot *Bot) SlashCommand(cmdConfig SlashCommandConfig, handler SlashCommandHandler)
- func (bot *Bot) Start() error
- type Config
- type HttpRouter
- func (router *HttpRouter) Get(path string, handler RouteHandler)
- func (router *HttpRouter) GetRegex(path *regexp.Regexp, handler RouteHandler)
- func (router *HttpRouter) Post(path string, handler RouteHandler)
- func (router *HttpRouter) PostRegex(path *regexp.Regexp, handler RouteHandler)
- func (router HttpRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Plugin
- type RegisterRequest
- type Route
- type RouteHandler
- type SlashCommandConfig
- type SlashCommandHandler
- type SlashCommandRequest
- type SlashCommandResponse
Constants ¶
View Source
const ( DEFAULT_SERVER_PORT uint = 8000 DEFAULT_SERVER_IP = "127.0.0.1" DEFAULT_CHANNEL_NAME = "town-square" )
View Source
const RESPONSE_TYPE_EPHEMERAL = "ephemeral"
Message will appear temporarily and only display to the user who activated the command
View Source
const RESPONSE_TYPE_IN_CHANNEL = "in_channel"
Message will show up in the channel as a normal message
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bot ¶
type Bot struct { Router HttpRouter // contains filtered or unexported fields }
func NewBot ¶
Create a new Bot Object
connection string is a url string containing the username, password, server address and path to connect to the mattermost server
Returns a pointer to a Bot object and an error
func (*Bot) MatchRegex ¶
func (*Bot) SetDefaultChannel ¶
func (*Bot) SlashCommand ¶
func (bot *Bot) SlashCommand(cmdConfig SlashCommandConfig, handler SlashCommandHandler)
type HttpRouter ¶
type HttpRouter struct {
// contains filtered or unexported fields
}
func (*HttpRouter) Get ¶
func (router *HttpRouter) Get(path string, handler RouteHandler)
func (*HttpRouter) GetRegex ¶
func (router *HttpRouter) GetRegex(path *regexp.Regexp, handler RouteHandler)
func (*HttpRouter) Post ¶
func (router *HttpRouter) Post(path string, handler RouteHandler)
func (*HttpRouter) PostRegex ¶
func (router *HttpRouter) PostRegex(path *regexp.Regexp, handler RouteHandler)
func (HttpRouter) ServeHTTP ¶
func (router HttpRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RegisterRequest ¶
type RouteHandler ¶
type RouteHandler func(*Bot, http.ResponseWriter, *http.Request)
type SlashCommandConfig ¶
type SlashCommandHandler ¶
type SlashCommandHandler func(*Bot, SlashCommandRequest) *SlashCommandResponse
type SlashCommandRequest ¶
type SlashCommandRequest struct { ChannelId string ChannelName string Command string TeamDomain string TeamId string Text string Token string UserId string UserName string }
func ParseSlashCommandRequest ¶
func ParseSlashCommandRequest(r *http.Request) *SlashCommandRequest
type SlashCommandResponse ¶
type SlashCommandResponse struct { // The text to display in the message Text string `json:"text"` // The username to show as, if left blank will be set to the user who sent the message UserName string `json:"username"` // Determines how the Message will be displayed. See RESPONSE_TYPE_IN_CHANNEL and RESPONSE_TYPE_EPHEMERAL ResponseType string `json:"response_type"` // Url to icon if you wish to override the default icon for the slash command IconUrl string `json:"icon_url"` // Webpage to redirect the user who sent the slash command to GotoLocation string `json:"goto_location"` }
func NewSlashCommandResponse ¶
func NewSlashCommandResponse(req SlashCommandRequest) *SlashCommandResponse
Click to show internal directories.
Click to hide internal directories.