From 9e1d3de25cbfd3e5e8dbb135ceca8dd1fe3cbbfc Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Fri, 30 Aug 2013 22:09:45 -0400 Subject: [PATCH] Changing to match many people --- bot/handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot/handlers.go b/bot/handlers.go index a6f0787..dc52638 100644 --- a/bot/handlers.go +++ b/bot/handlers.go @@ -63,7 +63,7 @@ func (b *Bot) isCmd(message string) (bool, string) { // } else if match, _ := regexp.MatchString(rex, lowerMessage); match { } else if strings.HasPrefix(lowerMessage, botnick) && len(lowerMessage) > len(botnick) && - (lowerMessage[len(botnick)] == ',' || lowerMessage[len(botnick)] == ':') { + (lowerMessage[len(botnick)] == ',' || lowerMessage[len(botnick)] == ':') { iscmd = true message = message[len(botnick):] @@ -153,10 +153,10 @@ func (b *Bot) Filter(message Message, input string) string { input = strings.Replace(input, "$nick", nick, -1) } - if strings.Contains(input, "$someone") { + for strings.Contains(input, "$someone") { nicks := b.Who(message.Channel) someone := nicks[rand.Intn(len(nicks))].Name - input = strings.Replace(input, "$someone", someone, -1) + input = strings.Replace(input, "$someone", someone, 1) } for strings.Contains(input, "$digit") {