From 522a1f1c358ddbc920cb40a98e49a0cb50b87f3b Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 11 Nov 2012 11:14:40 -0500 Subject: [PATCH] testing new remember with fallback --- plugins/factoid.go | 5 +++++ plugins/remember.go | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/factoid.go b/plugins/factoid.go index 6bf0e76..b8b0329 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -158,6 +158,11 @@ func (p *FactoidPlugin) trigger(message bot.Message) bool { p.sayFact(message, *fact) return true } + r := strings.NewReplacer(",", "", "\"", "", ",", "", ".", "", ":", "") + if ok, fact := p.findTrigger(r.Replace(message.Body)); ok { + p.sayFact(message, *fact) + return true + } } return false diff --git a/plugins/remember.go b/plugins/remember.go index 98311c6..fda3066 100644 --- a/plugins/remember.go +++ b/plugins/remember.go @@ -74,7 +74,6 @@ func (p *RememberPlugin) Message(message bot.Message) bool { trigger := fmt.Sprintf("%s quotes", entry.User.Name) - var funcres bson.M err := p.Bot.Db.Run(bson.M{"eval": "return counter(\"factoid\");"}, &funcres) if err != nil { @@ -83,7 +82,7 @@ func (p *RememberPlugin) Message(message bot.Message) bool { id := int(funcres["retval"].(float64)) fact := Factoid{ - Idx: id, + Idx: id, Trigger: trigger, Operator: "reply", FullText: msg,