加入功能,自动撤回,将异常信息发送后,5秒撤回
This commit is contained in:
9
robot.py
9
robot.py
@@ -16,6 +16,7 @@ from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
from plugin_common.plugin_manager import PluginManager
|
||||
from plugin_common.plugin_registry import PluginRegistry
|
||||
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
||||
from utils.robot_cmd.robot_command import GroupBotManager, Feature, PermissionStatus
|
||||
|
||||
from db.connection import DBConnectionManager
|
||||
@@ -46,7 +47,7 @@ class Robot(Job):
|
||||
self.nickname = None
|
||||
self.alias = None
|
||||
self.phone = None
|
||||
|
||||
self.message_auto_revoke: MessageAutoRevoke = None
|
||||
self.LOG.info(f"DB+REDIS 连接池开始初始化")
|
||||
# 使用单例模式获取实例
|
||||
self.db_manager = DBConnectionManager.get_instance(
|
||||
@@ -140,6 +141,7 @@ class Robot(Job):
|
||||
self.LOG.info("启动wechat_ipad bot")
|
||||
# 调用登录接口
|
||||
self.ipad_bot = wechat_ipad.WechatAPIClient(server_ip, server_port)
|
||||
self.message_auto_revoke = MessageAutoRevoke(self.ipad_bot)
|
||||
wxid = self.ipad_config.get("wxid", "")
|
||||
device_name = self.ipad_config.get("device_name", "")
|
||||
device_id = self.ipad_config.get("device_id", "")
|
||||
@@ -369,7 +371,7 @@ class Robot(Job):
|
||||
# 处理群聊命令或私聊命令
|
||||
if from_user == self.wxid: # 自己发送的消息
|
||||
if is_group:
|
||||
rsp = self.gbm.handle_command(group_id, content)
|
||||
rsp = self.gbm.handle_command(group_id, content.clean_content)
|
||||
if rsp is not None:
|
||||
await self.send_text(rsp, group_id)
|
||||
else:
|
||||
@@ -518,7 +520,8 @@ class Robot(Job):
|
||||
"all_contacts": self.allContacts,
|
||||
"full_wx_msg": msg,
|
||||
"gbm": self.gbm,
|
||||
"bot": self.ipad_bot
|
||||
"bot": self.ipad_bot,
|
||||
"revoke": self.message_auto_revoke
|
||||
}
|
||||
|
||||
# 检查插件是否可以处理该消息
|
||||
|
||||
Reference in New Issue
Block a user