加入功能,自动撤回,将异常信息发送后,5秒撤回
This commit is contained in:
@@ -8,6 +8,7 @@ from typing import Dict, Any, List, Optional, Tuple
|
||||
from plugin_common.message_plugin_interface import MessagePluginInterface
|
||||
from plugin_common.plugin_interface import PluginStatus
|
||||
from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
||||
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
|
||||
from utils.decorator.points_decorator import plugin_points_cost
|
||||
from wechat_ipad import WechatAPIClient
|
||||
@@ -98,7 +99,7 @@ class XiurenImagePlugin(MessagePluginInterface):
|
||||
roomid = message.get("roomid", "")
|
||||
gbm: GroupBotManager = message.get("gbm")
|
||||
bot: WechatAPIClient = message.get("bot")
|
||||
|
||||
revoke: MessageAutoRevoke = message.get("revoke")
|
||||
# 检查权限
|
||||
if roomid and gbm.get_group_permission(roomid, Feature.PIC) == PermissionStatus.DISABLED:
|
||||
return False, "没有权限"
|
||||
@@ -107,8 +108,10 @@ class XiurenImagePlugin(MessagePluginInterface):
|
||||
# 获取随机图片
|
||||
pic_path = self._get_random_pic()
|
||||
if not pic_path:
|
||||
await bot.send_text_message((roomid if roomid else sender), f"❌未找到图片资源",
|
||||
sender)
|
||||
client_msg_id, create_time, new_msg_id = await bot.send_text_message((roomid if roomid else sender),
|
||||
f"❌未找到图片资源",
|
||||
sender)
|
||||
revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 30)
|
||||
return False, "未找到图片资源"
|
||||
|
||||
# 发送图片
|
||||
|
||||
Reference in New Issue
Block a user