Added a say command to talker

This commit is contained in:
Chris Sexton 2013-03-04 10:43:23 -05:00
parent 7f4c9cf311
commit 84e7001165
2 changed files with 9 additions and 6 deletions

View File

@ -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"

View File

@ -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)