mirror of https://github.com/velour/catbase.git
Made factoid triggers lowercase always
This commit is contained in:
parent
53495871e4
commit
4b523be57f
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue