fixing remember for factoid id and operator

This commit is contained in:
Chris Sexton 2012-08-27 11:53:31 -04:00
parent 89072fafb4
commit 92ddfa3b6f
1 changed files with 10 additions and 1 deletions

View File

@ -74,9 +74,18 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
trigger := fmt.Sprintf("%s quotes", entry.User.Name) 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 {
panic(err)
}
id := int(funcres["retval"].(float64))
fact := Factoid{ fact := Factoid{
Id: id,
Trigger: trigger, Trigger: trigger,
Operator: "<reply>", Operator: "reply",
FullText: msg, FullText: msg,
Action: msg, Action: msg,
CreatedBy: user.Name, CreatedBy: user.Name,