Documentation ¶
Index ¶
- Variables
- func Initialize(handler robot.Handler, l *log.Logger) robot.Connector
- type BotMessage
- type TestConnector
- func (tc *TestConnector) GetBotMessage() (*TestMessage, error)
- func (tc *TestConnector) GetProtocolUserAttribute(u, attr string) (value string, ret robot.RetVal)
- func (tc *TestConnector) JoinChannel(c string) (ret robot.RetVal)
- func (tc *TestConnector) MessageHeard(u, c string)
- func (tc *TestConnector) Run(stop <-chan struct{})
- func (tc *TestConnector) SendBotMessage(msg *TestMessage)
- func (tc *TestConnector) SendProtocolChannelThreadMessage(ch, thr, mesg string, f robot.MessageFormat) (ret robot.RetVal)
- func (tc *TestConnector) SendProtocolUserChannelThreadMessage(uid, uname, ch, thr, mesg string, f robot.MessageFormat) (ret robot.RetVal)
- func (tc *TestConnector) SendProtocolUserMessage(u string, mesg string, f robot.MessageFormat) (ret robot.RetVal)
- func (tc *TestConnector) SetUserMap(map[string]string)
- type TestMessage
Constants ¶
This section is empty.
Variables ¶
var ExportTest = struct { Test *testing.T sync.Mutex }{}
ExportTest lets bot_integration_test safely supply the *testing.T
Functions ¶
Types ¶
type BotMessage ¶
type BotMessage struct {
User, Channel, Message string
Format robot.MessageFormat
}
BotMessage is for receiving messages from the robot
type TestConnector ¶
type TestConnector struct { robot.Handler // bot API for connectors sync.RWMutex // shared mutex for locking connector data structures // contains filtered or unexported fields }
TestConnector holds all the relevant data about a connection
func (*TestConnector) GetBotMessage ¶
func (tc *TestConnector) GetBotMessage() (*TestMessage, error)
GetBotMessage for tests to get replies
func (*TestConnector) GetProtocolUserAttribute ¶
func (tc *TestConnector) GetProtocolUserAttribute(u, attr string) (value string, ret robot.RetVal)
GetProtocolUserAttribute returns a string attribute or nil if slack doesn't have that information
func (*TestConnector) JoinChannel ¶
func (tc *TestConnector) JoinChannel(c string) (ret robot.RetVal)
JoinChannel joins a channel given it's human-readable name, e.g. "general" Only useful for connectors that require it, a noop otherwise
func (*TestConnector) MessageHeard ¶
func (tc *TestConnector) MessageHeard(u, c string)
MessageHeard indicates to the user a message was heard; for test/terminal it's a noop.
func (*TestConnector) Run ¶
func (tc *TestConnector) Run(stop <-chan struct{})
Run starts the main loop for the test connector
func (*TestConnector) SendBotMessage ¶
func (tc *TestConnector) SendBotMessage(msg *TestMessage)
SendBotMessage for tests to send messages to the 'bot
func (*TestConnector) SendProtocolChannelThreadMessage ¶ added in v2.6.0
func (tc *TestConnector) SendProtocolChannelThreadMessage(ch, thr, mesg string, f robot.MessageFormat) (ret robot.RetVal)
SendProtocolChannelMessage sends a message to a channel
func (*TestConnector) SendProtocolUserChannelThreadMessage ¶ added in v2.6.0
func (tc *TestConnector) SendProtocolUserChannelThreadMessage(uid, uname, ch, thr, mesg string, f robot.MessageFormat) (ret robot.RetVal)
SendProtocolUserChannelMessage sends a message to a user in a channel
func (*TestConnector) SendProtocolUserMessage ¶
func (tc *TestConnector) SendProtocolUserMessage(u string, mesg string, f robot.MessageFormat) (ret robot.RetVal)
SendProtocolUserMessage sends a direct message to a user
func (*TestConnector) SetUserMap ¶
func (tc *TestConnector) SetUserMap(map[string]string)
SetUserMap lets Gopherbot provide a mapping of usernames to user IDs
type TestMessage ¶
type TestMessage struct {
User, Channel, Message string
}
TestMessage is for sending messages to the robot