添加聊天类型限制功能,支持根据聊天类型过滤命令和动作,新增私聊和群聊专用命令及动作,优化相关日志记录。

This commit is contained in:
minecraft1024a
2025-08-16 13:21:13 +08:00
committed by Windpicker-owo
parent 802a1deb1c
commit 38fed9b4cc
9 changed files with 172 additions and 9 deletions

View File

@@ -114,6 +114,12 @@ class ChatBot:
command_instance.set_matched_groups(matched_groups)
try:
# 检查聊天类型限制
if not command_instance.is_chat_type_allowed():
is_group = hasattr(message, 'is_group_message') and message.is_group_message
logger.info(f"命令 {command_class.__name__} 不支持当前聊天类型: {'群聊' if is_group else '私聊'}")
return False, None, True # 跳过此命令,继续处理其他消息
# 执行命令
success, response, intercept_message = await command_instance.execute()