From bbb0b8afe1fced54a289413503d6d47431f21ec4 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sun, 24 Dec 2017 04:36:23 +0400 Subject: [PATCH] Less restrictive policies for admins --- lib/chatter/restricters.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/chatter/restricters.go b/lib/chatter/restricters.go index ae7bec9..25bae26 100644 --- a/lib/chatter/restricters.go +++ b/lib/chatter/restricters.go @@ -15,8 +15,9 @@ func (ct *Chatter) userPrivilegesCheck(update *tgbotapi.Update, user *tgbotapi.U defaultChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.DefaultID, 10, 64) bastionChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64) academyChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.AcademyID, 10, 64) + hqChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.HeadquartersID, 10, 64) - if update.Message.Chat.ID == defaultChatID { + if update.Message.Chat.ID == defaultChatID || update.Message.Chat.ID == hqChatID { return true } @@ -35,6 +36,10 @@ func (ct *Chatter) userPrivilegesCheck(update *tgbotapi.Update, user *tgbotapi.U return false } + if c.Users.PlayerBetterThan(&playerRaw, "admin") { + return true + } + // So, user is not a PokememBro admin. For Bastion and Academy she needs to be league player switch update.Message.Chat.ID { case academyChatID: