This commit is contained in:
2026-01-02 18:48:35 +08:00
parent 580b8af1dc
commit 617823da11
2 changed files with 8 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ reconnect_interval = 5
[bot] [bot]
command = ["/"] command = ["/"]
ignore_self_message = true #是否忽略自身消息
[redis] [redis]
host = "114.66.58.203" host = "114.66.58.203"

View File

@@ -146,6 +146,13 @@ class CommandManager:
bot: Bot 实例。 bot: Bot 实例。
event: 已解析的事件对象。 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 post_type = event.post_type
if post_type == 'message': if post_type == 'message':