From 63785e7102c50913e79c72dd8a94bf5db956536b Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Wed, 29 Aug 2012 17:17:30 -0400 Subject: [PATCH] Enforced admin right on editing non-personal facts --- config.json | 2 +- plugins/factoid.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index efc8051..9b76b94 100644 --- a/config.json +++ b/config.json @@ -11,7 +11,7 @@ "QuoteChance": 0.10, "QuoteTime": 30, "LogLength": 50, - "Admins": ["flyngpngn"], + "Admins": ["flyngpngn1"], "comment": "Follows is the old bot", diff --git a/plugins/factoid.go b/plugins/factoid.go index 17f3e69..af1029a 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -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))