Documentation ¶
Index ¶
- Variables
- func RegisterHandler(handler Handler) error
- type Bot
- func (b *Bot) Close()
- func (b *Bot) Config() Config
- func (b *Bot) Connect() error
- func (b *Bot) Db() *badger.DB
- func (b *Bot) ErrorHandler()
- func (b *Bot) Handler()
- func (b *Bot) InitHandlers()
- func (b *Bot) Join(channel string)
- func (b *Bot) Nick(nick string)
- func (b *Bot) Ping(message string)
- func (b *Bot) Pinger()
- func (b *Bot) Pong(message string)
- func (b *Bot) Reconnect()
- func (b *Bot) Run()
- func (b *Bot) Send(recv, msg string)
- func (b *Bot) User(user, name string)
- type Config
- type Handler
- type HandlerFunc
- type InitFunc
- type Manager
- type MessageHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBotExists occurs when the manager already // has a bot with the same name. ErrBotExists = errors.New("manager: Bot with that name already exists") // ErrBotNotFound occurs when no bot is found with // the same name. ErrBotNotFound = errors.New("manager: Could not find a bot with that name") // ErrHandlerExists occurs when you try to add a handler // that already exists ErrHandlerExists = errors.New("manager: Handler already exists") )
Functions ¶
func RegisterHandler ¶
RegisterHandler will register the given handler for use with bots
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is the structure for an IRC bot
func (*Bot) InitHandlers ¶
func (b *Bot) InitHandlers()
InitHandlers will run Init on all registered handlers
type Config ¶
type Config struct { BotName string `mapstructure:"name"` Hostname string `mapstructure:"host"` Port int Secure struct { Enable bool Verify bool } Identification struct { Nick string User string Name string } Channels []string Timings struct { Timeout int } Limits struct { Messages int `mapstructure:"rate"` Timeout int `mapstructure:"retries"` } Plugins []string Database string Settings map[interface{}]interface{} }
Config is the configuration structure for Bot
type Handler ¶
type Handler struct { Name string Description string Run HandlerFunc Event string Init InitFunc }
Handler is an OnEvent handler
type HandlerFunc ¶
HandlerFunc is function signature for OnEvent handlers.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a bot manager for multiple bots
func (*Manager) Add ¶
Add adds a bot to the manager and starts it if the manager is currently running.
func (*Manager) Remove ¶
Remove removes the bot from the manager. It will also stop the bot if its currently running.
type MessageHandler ¶
MessageHandler is the function type for message handlers
Click to show internal directories.
Click to hide internal directories.