Documentation
¶
Overview ¶
Package bot implements an IRC bot with plugins.
Index ¶
- func Channels(channels []string) func(*BotImpl)
- func Host(host string) func(*BotImpl)
- func Ident(ident string) func(*BotImpl)
- func Nick(nick string) func(*BotImpl)
- func Password(password string) func(*BotImpl)
- func Proxy(proxy string) func(*BotImpl)
- func RealName(realName string) func(*BotImpl)
- func SSL(ssl bool) func(*BotImpl)
- type Bot
- type BotImpl
- func (b *BotImpl) Action(t, msg string)
- func (b *BotImpl) Channels() []string
- func (b *BotImpl) Commands() *Commands
- func (b *BotImpl) Conn() *client.Conn
- func (b *BotImpl) Connected() bool
- func (b *BotImpl) HandleFunc(n string, h client.HandlerFunc) client.Remover
- func (b *BotImpl) Invite(nick, channel string)
- func (b *BotImpl) Join(c string)
- func (b *BotImpl) Me() *state.Nick
- func (b *BotImpl) Mode(t string, m ...string)
- func (b *BotImpl) Nick(nick string)
- func (b *BotImpl) Notice(t, msg string)
- func (b *BotImpl) Part(c string, m ...string)
- func (b *BotImpl) Privmsg(t, msg string)
- func (b *BotImpl) Quit(msg string)
- func (b *BotImpl) Run()
- type Command
- type Commands
- type Event
- type Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bot ¶
type Bot interface {
Run() // Run bot, reconnect if disconnect.
Quit(msg string) // Quit bot from IRC with a msg.
Commands() *Commands // For plugins to Add/Del commands.
Action(t, msg string) // Shortcut to Conn().Action()
Connected() bool // Shortcut to Conn().Connected()
HandleFunc(n string, h client.HandlerFunc) client.Remover // Shortcut to Conn().HandleFunc()
Invite(nick, channel string) // Shortcut to Conn().Nick()
Join(c string) // Shortcut to Conn().Join()
Me() *state.Nick // Shortcut to Conn().Me()
Mode(t string, m ...string) // Shortcut to Conn().Mode()
Nick(nick string) // Shortcut to Conn().Nick()
Notice(t, msg string) // Shortcut to Conn().Notice()
Part(c string, m ...string) // Shortcut to Conn().Part()
Privmsg(t, msg string) // Shortcut to Conn().Privmsg()
Conn() *client.Conn // Conn returns the underlying goirc client connection.
Channels() []string // Channels returns list of channels which bot has joined.
}
Bot represents an IRC bot, with IRC client object, settings, commands.
func NewBotOptions ¶
NewBotWithProxyPassword creates a new Bot implementation with options.
type BotImpl ¶
type BotImpl struct {
// contains filtered or unexported fields
}
BotImpl implements Bot.
func (*BotImpl) HandleFunc ¶
type Command ¶
type Command struct {
Help string // Help string for help command.
Handler Handler // Handler to call.
Pub bool // Command can be accessed publicly on a channel.
NoExclamation bool // Disallow calling command as "!command".
Priv bool // Command can be accessed privately in query.
Hidden bool // Hide command from list of all available commands.
}
Command represents a command that plugins can add.
type Commands ¶
Commands holds commands by their name.
func (*Commands) Del ¶
Del allows plugins to remove commands added with Add (no error if not present).
func (*Commands) Handle ¶
Handle parses a line, matches with commands and dispatches to handler. A command can be triggered
- in public on a channel with: /msg #chan !cmd [args] or directly at a bot: /msg #chan bot: cmd [args] works also with a comma: /msg #chan bot, cmd [args]
- in private in a query: /msg bot cmd [args]
Click to show internal directories.
Click to hide internal directories.