mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix(notification): 飞书/QQ/爪爪机器人跳过命令注册,修复 AttributeError
通知基类默认命令注册钩子调用 client.register_commands,但飞书 lark_oapi、 QQBot、WechatClawBot 客户端均无命令注册/删除 API(飞书机器人无斜杠命令概念), 启动时 FeishuModule.register_commands 抛 AttributeError。 三个模块覆写 _commands_enabled 返回 False 跳过注册,与企业微信走菜单 API 的钩子模式一致;Telegram/Slack/Discord 客户端具备该 API,不受影响。
This commit is contained in:
@@ -38,6 +38,13 @@ class FeishuModule(_MessageChannelModuleBase[Feishu]):
|
|||||||
def get_priority() -> int:
|
def get_priority() -> int:
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
|
def _commands_enabled(self, config: Optional[dict]) -> bool:
|
||||||
|
"""
|
||||||
|
飞书机器人无斜杠命令概念,lark_oapi Client 也不提供命令注册/删除 API,
|
||||||
|
跳过命令注册,避免基类默认钩子调用不存在的 client.register_commands。
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
"""停止模块"""
|
"""停止模块"""
|
||||||
for client in self.get_instances().values():
|
for client in self.get_instances().values():
|
||||||
|
|||||||
@@ -81,6 +81,13 @@ class QQBotModule(_MessageChannelModuleBase[QQBot]):
|
|||||||
def get_priority() -> int:
|
def get_priority() -> int:
|
||||||
return 10
|
return 10
|
||||||
|
|
||||||
|
def _commands_enabled(self, config: Optional[dict]) -> bool:
|
||||||
|
"""
|
||||||
|
QQ 机器人客户端未提供命令注册/删除 API,跳过命令注册,
|
||||||
|
避免基类默认钩子调用不存在的 client.register_commands。
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
"""停止模块"""
|
"""停止模块"""
|
||||||
for client in self.get_instances().values():
|
for client in self.get_instances().values():
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ class WechatClawBotModule(_MessageChannelModuleBase[WechatClawBot]):
|
|||||||
"""获取模块优先级。"""
|
"""获取模块优先级。"""
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
|
def _commands_enabled(self, config: Optional[dict]) -> bool:
|
||||||
|
"""
|
||||||
|
微信爪爪机器人客户端未提供命令注册/删除 API,跳过命令注册,
|
||||||
|
避免基类默认钩子调用不存在的 client.register_commands。
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
"""停止模块"""
|
"""停止模块"""
|
||||||
for client in self.get_instances().values():
|
for client in self.get_instances().values():
|
||||||
|
|||||||
Reference in New Issue
Block a user