From 3ae7157b7399a465f340edc4b957a860e74f938a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 9 Sep 2023 23:38:31 +0800 Subject: [PATCH] :bug: Fix `ChatPermissions` changes --- plugins/group/captcha.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/plugins/group/captcha.py b/plugins/group/captcha.py index beec1e9a..c6c7ac58 100644 --- a/plugins/group/captcha.py +++ b/plugins/group/captcha.py @@ -37,17 +37,6 @@ try: except ImportError: import json as jsonlib -FullChatPermissions = ChatPermissions( - can_send_messages=True, - can_send_media_messages=True, - can_send_polls=True, - can_send_other_messages=True, - can_add_web_page_previews=True, - can_change_info=True, - can_invite_users=True, - can_pin_messages=True, -) - class GroupCaptcha(Plugin): """群验证模块""" @@ -119,7 +108,9 @@ class GroupCaptcha(Plugin): async def restore_member(context: "ContextTypes.DEFAULT_TYPE", chat_id: int, user_id: int): logger.debug("重置用户权限 user_id[%s] 在 chat_id[%s]", chat_id, user_id) try: - await context.bot.restrict_chat_member(chat_id=chat_id, user_id=user_id, permissions=FullChatPermissions) + await context.bot.restrict_chat_member( + chat_id=chat_id, user_id=user_id, permissions=ChatPermissions.all_permissions() + ) except BadRequest as exc: logger.error("GroupCaptcha插件在 chat_id[%s] user_id[%s] 执行restore失败", chat_id, user_id, exc_info=exc)