From b7d3c68b92810c97ac74ae87462d890bf85a39f1 Mon Sep 17 00:00:00 2001 From: UnCLAS-Prommer Date: Tue, 3 Jun 2025 09:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnotice=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=84=8F=E5=A4=96=E7=9A=84=E7=BE=A4notice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recv_handler.py | 5 +++++ src/send_handler.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/recv_handler.py b/src/recv_handler.py index 5dcc074..2c02c54 100644 --- a/src/recv_handler.py +++ b/src/recv_handler.py @@ -480,6 +480,11 @@ class RecvHandler: group_id = raw_message.get("group_id") user_id = raw_message.get("user_id") + + if not self.check_allow_to_chat(user_id, group_id): + logger.warning("notice消息被丢弃") + return None + handled_message: Seg = None match notice_type: diff --git a/src/send_handler.py b/src/send_handler.py index 88b33cf..87ca64d 100644 --- a/src/send_handler.py +++ b/src/send_handler.py @@ -269,7 +269,7 @@ class SendHandler: "enable": enable, }, ) - + def handle_kick_command(self, args: Dict[str, Any], group_info: GroupInfo) -> Tuple[str, Dict[str, Any]]: """处理群成员踢出命令 @@ -294,7 +294,7 @@ class SendHandler: "reject_add_request": False, # 不拒绝加群请求 }, ) - + async def send_message_to_napcat(self, action: str, params: dict) -> dict: request_uuid = str(uuid.uuid4()) payload = json.dumps({"action": action, "params": params, "echo": request_uuid})