Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChatBuffer ¶
func ChatBuffer(input chan *model.ChatMessage, done chan struct{}) chan *model.ChatMessage
ChatBuffer provides an unbounded buffer for ChatMessage objects
func MatchBuffer ¶
MatchBuffer provides an unbounded buffer for Match objects
Types ¶
type Command ¶
type Command struct { // Tag is the value sent to the destination when a command matches. Tag int // The command to match on. If the command is not a regexp (see below), the // command must be a single word and will only be matched if it occurs at // the beginning of the message. Command string // IsRegExp is true if Command should be compiled as a regex. IsRegexp bool // MatchAll is true if the command should match on all messages. If false, // the command will match only on messages directed to the bot user. MatchAll bool }
Command defines a single command, how it should be detected, and what value should be used to notify the client.
type Match ¶
type Match struct { // The tag supplied when the command was added. Tag int Message *model.ChatMessage // RegexpMatch contains the matching subgroups, if any, when a Regexp // command matches. RegexpMatch []string }
Match contains all the information needed for a client to process an incoming message.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is the command router itself.
func (*Router) AddDestination ¶
AddDestination adds a new destination and associated commands to the router.
Click to show internal directories.
Click to hide internal directories.