Documentation ¶
Overview ¶
Package mattermost implements a mattermost adapter for the joe bot library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BotAdapter ¶
type BotAdapter struct {
// contains filtered or unexported fields
}
BotAdapter implements a joe.Adapter that reads and writes messages to and from Mattermost.
func NewAdapter ¶
func NewAdapter(ctx context.Context, conf Config) (*BotAdapter, error)
NewAdapter creates a new *BotAdapter that connects to mattermost. Note that you will usually configure the mattermost adapter as joe.Module (i.e. using the Adapter function of this package).
func (*BotAdapter) Close ¶
func (a *BotAdapter) Close() error
Close disconnects the adapter from the mattermost API.
func (*BotAdapter) React ¶ added in v0.2.0
// newMessage creates basic message with an ID, a RoomID, and a Msg // Takes channel and text
func (a *BotAdapter) newMessage(channel *models.Channel, text string) *models.Message { return &models.Message{ ID: a.idgen.ID(), RoomID: channel.ID, Msg: text, User: a.user, } }
func (*BotAdapter) RegisterAt ¶
func (a *BotAdapter) RegisterAt(brain *joe.Brain)
RegisterAt implements the joe.Adapter interface by emitting the mattermost API events to the given brain.
func (*BotAdapter) Send ¶
func (a *BotAdapter) Send(text, channelName string) error
Send implements joe.Adapter by sending all received text messages to the given mattermost channel name.