mirror of https://github.com/velour/catbase.git
Fixing remember plugin
This commit is contained in:
parent
42e17ae755
commit
a086f2bc6e
|
@ -5,6 +5,7 @@ import (
|
||||||
"github.com/chrissexton/alepale/bot"
|
"github.com/chrissexton/alepale/bot"
|
||||||
"labix.org/v2/mgo"
|
"labix.org/v2/mgo"
|
||||||
"labix.org/v2/mgo/bson"
|
"labix.org/v2/mgo/bson"
|
||||||
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -86,6 +87,7 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
|
||||||
id := int(funcres["retval"].(float64))
|
id := int(funcres["retval"].(float64))
|
||||||
|
|
||||||
fact := Factoid{
|
fact := Factoid{
|
||||||
|
Id: bson.NewObjectId(),
|
||||||
Idx: id,
|
Idx: id,
|
||||||
Trigger: trigger,
|
Trigger: trigger,
|
||||||
Operator: "reply",
|
Operator: "reply",
|
||||||
|
@ -96,7 +98,9 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
|
||||||
LastAccessed: time.Now(),
|
LastAccessed: time.Now(),
|
||||||
AccessCount: 0,
|
AccessCount: 0,
|
||||||
}
|
}
|
||||||
p.Coll.Insert(fact)
|
if err = p.Coll.Insert(fact); err != nil {
|
||||||
|
log.Println("ERROR!!!!:", err)
|
||||||
|
}
|
||||||
|
|
||||||
// sorry, not creative with names so we're reusing msg
|
// sorry, not creative with names so we're reusing msg
|
||||||
msg = fmt.Sprintf("Okay, %s, remembering '%s'.",
|
msg = fmt.Sprintf("Okay, %s, remembering '%s'.",
|
||||||
|
|
Loading…
Reference in New Issue