Fixing remember plugin

This commit is contained in:
Chris Sexton 2013-06-01 15:00:57 -04:00
parent 42e17ae755
commit a086f2bc6e
1 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/chrissexton/alepale/bot"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"log"
"math/rand"
"strings"
"time"
@ -86,6 +87,7 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
id := int(funcres["retval"].(float64))
fact := Factoid{
Id: bson.NewObjectId(),
Idx: id,
Trigger: trigger,
Operator: "reply",
@ -96,7 +98,9 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
LastAccessed: time.Now(),
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
msg = fmt.Sprintf("Okay, %s, remembering '%s'.",