mirror of https://github.com/velour/catbase.git
Added a say command to talker
This commit is contained in:
parent
7f4c9cf311
commit
84e7001165
|
@ -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"
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue