加入bot,自动注入内容,在项目启动完成之后,给每个插件注入bot

This commit is contained in:
liuwei
2025-05-20 15:10:26 +08:00
parent 322297a69c
commit da89eea4f1
6 changed files with 69 additions and 53 deletions

View File

@@ -1,5 +1,6 @@
from typing import Dict, Any, Tuple, Optional, List
from plugin_common.plugin_interface import PluginInterface
from wechat_ipad import WechatAPIClient
class MessagePluginInterface(PluginInterface):
@@ -15,6 +16,10 @@ class MessagePluginInterface(PluginInterface):
"""支持的命令列表"""
return []
# 需要完成jobs 的业务所以完成bot注入
def set_bot(self, bot: WechatAPIClient) -> None:
self.bot: WechatAPIClient = bot
def can_process(self, message: Dict[str, Any]) -> bool:
"""
检查插件是否可以处理该消息