From 75e2c53bd10142515ae774ba4704432709e10ef9 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 7 May 2013 20:56:09 -0400 Subject: [PATCH] Returning command check back to messy if/else. regexp was not good. --- bot/handlers.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bot/handlers.go b/bot/handlers.go index 4cc8d39..358c9e0 100644 --- a/bot/handlers.go +++ b/bot/handlers.go @@ -90,10 +90,13 @@ func (b *Bot) isCmd(message string) (bool, string) { if strings.HasPrefix(lowerMessage, cmdc) && len(cmdc) > 0 { iscmd = true message = message[len(cmdc):] - } else if match, _ := regexp.MatchString(rex, lowerMessage); match { - if len(message) < len(botnick) { - return false, message - } + // } 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)+1] == ' ' { + iscmd = true message = message[len(botnick):]