From 2acf375997e92cd280dd18fe8d9d41e9d2051d0e Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 31 Aug 2013 23:33:15 -0400 Subject: [PATCH] Fixing small remember bug (trim snips) --- plugins/remember.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/remember.go b/plugins/remember.go index 1cf508a..4d91d54 100644 --- a/plugins/remember.go +++ b/plugins/remember.go @@ -60,6 +60,7 @@ func (p *RememberPlugin) Message(message bot.Message) bool { var trigger string for _, snip := range snips { + snip = strings.TrimSpace(snip) snipParts := strings.Split(snip, " ") nick := snipParts[0] snip := strings.Join(snipParts[1:], " ") @@ -67,6 +68,8 @@ func (p *RememberPlugin) Message(message bot.Message) bool { for i := len(p.Log[message.Channel]) - 1; i >= 0; i-- { entry := p.Log[message.Channel][i] + log.Println("Test entry:", entry.User.Name, entry.Body) + if strings.ToLower(entry.User.Name) == strings.ToLower(nick) && strings.Contains( strings.ToLower(entry.Body), @@ -117,6 +120,8 @@ func (p *RememberPlugin) Message(message bot.Message) bool { log.Println("ERROR!!!!:", err) } + log.Println("Remembering factoid:", msg) + // sorry, not creative with names so we're reusing msg msg = fmt.Sprintf("Okay, %s, remembering '%s'.", message.User.Name, msg)