From d76c6146fd7e2116b871df6cf5edfd26870bd351 Mon Sep 17 00:00:00 2001 From: Cesare Placanica <1519356+keobox@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:54:02 +0200 Subject: [PATCH] Change /unmute command so that the exception on permissions is dropped --- src/python_italy_bot/handlers/moderation.py | 6 ++++-- src/python_italy_bot/services/captcha.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/python_italy_bot/handlers/moderation.py b/src/python_italy_bot/handlers/moderation.py index a859acaab..877c77181 100644 --- a/src/python_italy_bot/handlers/moderation.py +++ b/src/python_italy_bot/handlers/moderation.py @@ -362,14 +362,16 @@ async def _handle_unmute(update: Update, context: ContextTypes.DEFAULT_TYPE) -> can_send_polls=True, can_send_other_messages=True, can_add_web_page_previews=True, - can_change_info=False, + can_change_info=True, can_invite_users=True, - can_pin_messages=False, + can_pin_messages=True, ) try: await context.bot.restrict_chat_member(chat.id, user_id, full_perms) await moderation_service.remove_mute(user_id, chat.id) + captcha_service: CaptchaService = context.bot_data["captcha_service"] + await captcha_service.verify_user_globally(user_id) await message.reply_text(strings.UNMUTE_SUCCESS) except Exception as e: logger.warning("Unmute failed: %s", e) diff --git a/src/python_italy_bot/services/captcha.py b/src/python_italy_bot/services/captcha.py index d05dbb9c4..5a3dba769 100644 --- a/src/python_italy_bot/services/captcha.py +++ b/src/python_italy_bot/services/captcha.py @@ -132,9 +132,9 @@ def get_full_permissions(self) -> ChatPermissions: can_send_polls=True, can_send_other_messages=True, can_add_web_page_previews=True, - can_change_info=False, + can_change_info=True, can_invite_users=True, - can_pin_messages=False, + can_pin_messages=True, ) def is_secret_command(self, text: str) -> bool: