diff --git a/bot/handlers.go b/bot/handlers.go index b5389c1..c1f092b 100644 --- a/bot/handlers.go +++ b/bot/handlers.go @@ -3,13 +3,12 @@ package bot import ( "errors" "fmt" + "labix.org/v2/mgo/bson" "math/rand" + "regexp" "strconv" "strings" "time" - // "labix.org/v2/mgo" - "labix.org/v2/mgo/bson" - "regexp" ) import irc "github.com/fluffle/goirc/client" diff --git a/plugins/talker.go b/plugins/talker.go index f4b1b5f..8cb9648 100644 --- a/plugins/talker.go +++ b/plugins/talker.go @@ -49,12 +49,18 @@ func NewTalkerPlugin(bot *bot.Bot) *TalkerPlugin { func (p *TalkerPlugin) Message(message bot.Message) bool { channel := message.Channel body := message.Body + lowermessage := strings.ToLower(body) if channel != p.Bot.Config.MainChannel { return false } - if strings.HasPrefix(message.Body, "goatse") { + if strings.HasPrefix(lowermessage, "say") { + msg := strings.TrimSpace(body[3:]) + p.Bot.SendMessage(channel, msg) + } + + if strings.HasPrefix(lowermessage, "goatse") { nick := message.User.Name if parts := strings.Split(message.Body, " "); len(parts) > 1 { nick = parts[1] @@ -75,8 +81,6 @@ func (p *TalkerPlugin) Message(message bot.Message) bool { return true } - lowermessage := strings.ToLower(body) - if strings.Contains(lowermessage, "felps") || strings.Contains(lowermessage, "fredfelps") { outmsg := p.Bot.Filter(message, "GOD HATES $NICK") p.Bot.SendMessage(channel, outmsg)