diff --git a/danding_bot/plugins/auto_recall/__init__.py b/danding_bot/plugins/auto_recall/__init__.py index 001e592..4769a68 100644 --- a/danding_bot/plugins/auto_recall/__init__.py +++ b/danding_bot/plugins/auto_recall/__init__.py @@ -38,6 +38,15 @@ async def handle_api_result( # 获取撤回延迟时间 recall_delay = plugin_config.recall_delay + # 检查是否为 danding_qqpush 发送的消息 + # danding_qqpush 消息会在 data 中包含 __qqpush_source 标记 + is_qqpush_message = data.get("__qqpush_source") == "danding_qqpush" + + if is_qqpush_message: + # 使用 danding_qqpush 专用的撤回时间 + recall_delay = plugin_config.qqpush_recall_delay + logger.info(f"danding_qqpush 消息将在 {recall_delay} 秒后撤回") + # 启动异步任务,延迟撤回消息 asyncio.create_task(recall_message_after_delay(bot, message_id, recall_delay)) diff --git a/danding_bot/plugins/auto_recall/config.py b/danding_bot/plugins/auto_recall/config.py index e57a695..66866cb 100644 --- a/danding_bot/plugins/auto_recall/config.py +++ b/danding_bot/plugins/auto_recall/config.py @@ -1,4 +1,5 @@ from pydantic import BaseModel, Field class Config(BaseModel): - recall_delay: int = Field(default=110, env="RECALL_DELAY") # 撤回延迟时间,默认 110 秒 \ No newline at end of file + recall_delay: int = Field(default=110, env="RECALL_DELAY") # 撤回延迟时间,默认 110 秒 + qqpush_recall_delay: int = Field(default=3600, env="QQPUSH_RECALL_DELAY") # danding_qqpush 消息撤回延迟时间,默认 3600 秒(1小时) \ No newline at end of file diff --git a/danding_bot/plugins/danding_qqpush/sender.py b/danding_bot/plugins/danding_qqpush/sender.py index f8c750a..6231ff1 100644 --- a/danding_bot/plugins/danding_qqpush/sender.py +++ b/danding_bot/plugins/danding_qqpush/sender.py @@ -73,11 +73,12 @@ class MessageSender: message.append(MessageSegment.at(qq)) message.append(MessageSegment.image(image_base64)) - # 发送群消息 + # 发送群消息,添加 __qqpush_source 标记供 auto_recall 识别 result = await bot.call_api( "send_group_msg", group_id=group_id, - message=message + message=message, + __qqpush_source="danding_qqpush" # 添加标记 ) return { @@ -121,11 +122,12 @@ class MessageSender: message.append(MessageSegment.at(qq)) message.append(MessageSegment.text(text)) - # 发送群消息 + # 发送群消息,添加 __qqpush_source 标记供 auto_recall 识别 result = await bot.call_api( "send_group_msg", group_id=group_id, - message=message + message=message, + __qqpush_source="danding_qqpush" # 添加标记 ) return { diff --git a/data/onmyoji_gacha/gacha.db b/data/onmyoji_gacha/gacha.db index 9146408..bb8cdc3 100644 Binary files a/data/onmyoji_gacha/gacha.db and b/data/onmyoji_gacha/gacha.db differ