From 617823da11d92e8f855555c4d7f31990b69680f6 Mon Sep 17 00:00:00 2001 From: K2cr2O1 <2221577113@qq.com> Date: Fri, 2 Jan 2026 18:48:35 +0800 Subject: [PATCH] hotfix --- config.toml | 1 + core/command_manager.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/config.toml b/config.toml index 1c9df7e..4846aeb 100644 --- a/config.toml +++ b/config.toml @@ -5,6 +5,7 @@ reconnect_interval = 5 [bot] command = ["/"] +ignore_self_message = true #是否忽略自身消息 [redis] host = "114.66.58.203" diff --git a/core/command_manager.py b/core/command_manager.py index 5f29ff2..f95053a 100644 --- a/core/command_manager.py +++ b/core/command_manager.py @@ -146,6 +146,13 @@ class CommandManager: bot: Bot 实例。 event: 已解析的事件对象。 """ + # --- 全局过滤机器人自身消息 --- + # 仅对消息事件生效 + if event.post_type == 'message' and global_config.bot.get('ignore_self_message', False): + + if hasattr(event, 'user_id') and hasattr(event, 'self_id') and event.user_id == event.self_id: + return + post_type = event.post_type if post_type == 'message':