From fecd22ee0d4aed0cca25b05f2f0a7da9e21f1a1f Mon Sep 17 00:00:00 2001 From: ATechnoHazard Date: Tue, 26 Jun 2018 13:47:15 +0530 Subject: [PATCH] warns: Notify non-admin users instead of doing nothing when removing warns Signed-off-by: ATechnoHazard --- tg_bot/modules/warns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tg_bot/modules/warns.py b/tg_bot/modules/warns.py index 0f95be425..6bc68c924 100644 --- a/tg_bot/modules/warns.py +++ b/tg_bot/modules/warns.py @@ -93,7 +93,6 @@ def warn(user: User, chat: Chat, reason: str, message: Message, warner: User = N @run_async -@user_admin_no_reply @bot_admin @loggable def button(bot: Bot, update: Update) -> str: @@ -103,6 +102,9 @@ def button(bot: Bot, update: Update) -> str: if match: user_id = match.group(1) chat = update.effective_chat # type: Optional[Chat] + if not is_user_admin(chat, int(user.id)): + query.answer(text="You are not authorized to remove this warn! Only administrators may remove warns.", show_alert=True) + return "" res = sql.remove_warn(user_id, chat.id) if res: update.effective_message.edit_text(