Documentation ¶
Overview ¶
Package listener defines chat listeners for the bot.
Index ¶
Examples ¶
Constants ¶
View Source
const Prefix = "!"
Prefix is used by the bot to denote a command.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discord ¶
Discord listener. The set of Actions are used to handle the messages.
func (*Discord) Connect ¶
Connect to the Discord server using the given token. The Actions set on the Discord type will be used to handle the message.
func (*Discord) Handle ¶ added in v0.1.2
Handle an incoming Message responding via the Sender.
Example ¶
d := listener.Discord{Actions: []actions.Handler{actions.Echo{}}} s := &MockSender{} m := listener.Message{ Channel: "chan", Content: listener.Prefix + "Some amusing message", Sender: listener.User{ ID: "sender", Bot: false, }, } d.Handle(m, s) fmt.Println(s.Message)
Output: [chan] sender: Some amusing message
type DiscordSender ¶ added in v0.1.2
type DiscordSender struct {
// contains filtered or unexported fields
}
DiscordSender sends messages to Discord.
Click to show internal directories.
Click to hide internal directories.