From 6424f76e70f0cfe73b5b1a1405af6daea6e7638e Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 16 Aug 2026 16:56:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(notification):=20=E9=A3=9E=E4=B9=A6/QQ/?= =?UTF-8?q?=E7=88=AA=E7=88=AA=E6=9C=BA=E5=99=A8=E4=BA=BA=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E6=B3=A8=E5=86=8C=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20AttributeError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 通知基类默认命令注册钩子调用 client.register_commands,但飞书 lark_oapi、 QQBot、WechatClawBot 客户端均无命令注册/删除 API(飞书机器人无斜杠命令概念), 启动时 FeishuModule.register_commands 抛 AttributeError。 三个模块覆写 _commands_enabled 返回 False 跳过注册,与企业微信走菜单 API 的钩子模式一致;Telegram/Slack/Discord 客户端具备该 API,不受影响。 --- app/modules/feishu/__init__.py | 7 +++++++ app/modules/qqbot/__init__.py | 7 +++++++ app/modules/wechatclawbot/__init__.py | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/app/modules/feishu/__init__.py b/app/modules/feishu/__init__.py index 21f54562f..54d0d85d8 100644 --- a/app/modules/feishu/__init__.py +++ b/app/modules/feishu/__init__.py @@ -38,6 +38,13 @@ class FeishuModule(_MessageChannelModuleBase[Feishu]): def get_priority() -> int: return 2 + def _commands_enabled(self, config: Optional[dict]) -> bool: + """ + 飞书机器人无斜杠命令概念,lark_oapi Client 也不提供命令注册/删除 API, + 跳过命令注册,避免基类默认钩子调用不存在的 client.register_commands。 + """ + return False + def stop(self) -> None: """停止模块""" for client in self.get_instances().values(): diff --git a/app/modules/qqbot/__init__.py b/app/modules/qqbot/__init__.py index 2c16a1392..3d402b877 100644 --- a/app/modules/qqbot/__init__.py +++ b/app/modules/qqbot/__init__.py @@ -81,6 +81,13 @@ class QQBotModule(_MessageChannelModuleBase[QQBot]): def get_priority() -> int: return 10 + def _commands_enabled(self, config: Optional[dict]) -> bool: + """ + QQ 机器人客户端未提供命令注册/删除 API,跳过命令注册, + 避免基类默认钩子调用不存在的 client.register_commands。 + """ + return False + def stop(self) -> None: """停止模块""" for client in self.get_instances().values(): diff --git a/app/modules/wechatclawbot/__init__.py b/app/modules/wechatclawbot/__init__.py index adca12d74..f349b0406 100644 --- a/app/modules/wechatclawbot/__init__.py +++ b/app/modules/wechatclawbot/__init__.py @@ -61,6 +61,13 @@ class WechatClawBotModule(_MessageChannelModuleBase[WechatClawBot]): """获取模块优先级。""" return 2 + def _commands_enabled(self, config: Optional[dict]) -> bool: + """ + 微信爪爪机器人客户端未提供命令注册/删除 API,跳过命令注册, + 避免基类默认钩子调用不存在的 client.register_commands。 + """ + return False + def stop(self) -> None: """停止模块""" for client in self.get_instances().values():