Enforced admin right on editing non-personal facts

This commit is contained in:
Chris Sexton 2012-08-29 17:17:30 -04:00
parent fa83472c50
commit 63785e7102
2 changed files with 5 additions and 1 deletions

View File

@ -11,7 +11,7 @@
"QuoteChance": 0.10,
"QuoteTime": 30,
"LogLength": 50,
"Admins": ["flyngpngn"],
"Admins": ["flyngpngn1"],
"comment": "Follows is the old bot",

View File

@ -263,6 +263,10 @@ func (p *FactoidPlugin) changeFact(message bot.Message) bool {
} else {
result = make([]Factoid, 1)
iter.One(&result[0])
if result[0].CreatedBy != message.User.Name && !message.User.Admin {
p.Bot.SendMessage(message.Channel, "That's not your fact to edit.")
return true
}
}
// make the changes
msg := fmt.Sprintf("Changing %d facts.", len(result))