Made factoid triggers lowercase always

This commit is contained in:
Chris Sexton 2012-08-26 15:21:21 -04:00
parent 53495871e4
commit 4b523be57f
1 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func (p *FactoidPlugin) learnFact(message bot.Message, trigger, operator, fact s
func (p *FactoidPlugin) findTrigger(message string) (bool, string) { func (p *FactoidPlugin) findTrigger(message string) (bool, string) {
var results []factoid var results []factoid
iter := p.Coll.Find(bson.M{"trigger": message}).Iter() iter := p.Coll.Find(bson.M{"trigger": strings.ToLower(message)}).Iter()
err := iter.All(&results) err := iter.All(&results)
if err != nil { if err != nil {
panic(err) panic(err)
@ -101,6 +101,7 @@ func (p *FactoidPlugin) Message(message bot.Message) bool {
} }
trigger := strings.TrimSpace(parts[0]) trigger := strings.TrimSpace(parts[0])
trigger = strings.ToLower(trigger)
fact := strings.TrimSpace(parts[1]) fact := strings.TrimSpace(parts[1])
action := strings.TrimSpace(action) action := strings.TrimSpace(action)