diff --git a/bot/bot.go b/bot/bot.go index afa31e0..3c32073 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -114,6 +114,8 @@ func NewBot(config *config.Config, c *irc.Conn) *Bot { RunNewLogger(logIn, logOut) + config.Nick = c.Me.Name + return &Bot{ Config: config, Plugins: make(map[string]Handler), diff --git a/plugins/downtime.go b/plugins/downtime.go index f05b562..94fc045 100644 --- a/plugins/downtime.go +++ b/plugins/downtime.go @@ -1,3 +1,46 @@ package plugins -// "Welcome back, deleveled, you sucked at idling for %n, a new personal best!" +import "bitbucket.org/phlyingpenguin/godeepintir/bot" + +import ( + "labix.org/v2/mgo" +) + +// This is a downtime plugin to monitor how much our users suck + +type DowntimePlugin struct { + Bot *bot.Bot + Coll *mgo.Collection +} + +// NewDowntimePlugin creates a new DowntimePlugin with the Plugin interface +func NewDowntimePlugin(bot *bot.Bot) *DowntimePlugin { + return &DowntimePlugin{ + Bot: bot, + } +} + +// Message responds to the bot hook on recieving messages. +// This function returns true if the plugin responds in a meaningful way to the users message. +// Otherwise, the function returns false and the bot continues execution of other plugins. +func (p *DowntimePlugin) Message(message bot.Message) bool { + // This bot does not reply to anything + return false +} + +// LoadData imports any configuration data into the plugin. This is not strictly necessary other +// than the fact that the Plugin interface demands it exist. This may be deprecated at a later +// date. +func (p *DowntimePlugin) LoadData() { + p.Coll = p.Bot.Db.C("downtime") +} + +// Help responds to help requests. Every plugin must implement a help function. +func (p *DowntimePlugin) Help(channel string, parts []string) { + p.Bot.SendMessage(channel, "Sorry, Downtime does not do a goddamn thing.") +} + +// Empty event handler because this plugin does not do anything on event recv +func (p *DowntimePlugin) Event(kind string, message bot.Message) bool { + return false +} diff --git a/plugins/factoid.go b/plugins/factoid.go index 8488bc1..636a189 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -338,7 +338,7 @@ func (p *FactoidPlugin) Message(message bot.Message) bool { return p.trigger(message) } - if message.Body == "forget that" { + if strings.ToLower(message.Body) == "forget that" { return p.forgetLastFact(message) }