Merge pull request #43 from A0000Xz/dev

新一代回报信息
dev-from070-to080
UnCLAS-Prommer 2025-06-29 00:45:01 +08:00 committed by GitHub
commit ef7b267e7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 28 additions and 1 deletions

View File

@ -15,6 +15,7 @@ from .config import global_config
from .response_pool import get_response
from .logger import logger
from .utils import get_image_format, convert_image_to_gif
from .recv_handler.message_sending import message_send_instance
class SendHandler:
@ -83,6 +84,9 @@ class SendHandler:
else:
logger.warning(f"消息发送失败napcat返回{str(response)}")
qq_message_id = response.get("data", {}).get("message_id")
await self.message_sent_back(raw_message_base, qq_message_id)
async def send_command(self, raw_message_base: MessageBase) -> None:
"""
处理命令类
@ -388,6 +392,29 @@ class SendHandler:
logger.error(f"发送消息失败: {e}")
return {"status": "error", "message": str(e)}
return response
async def message_sent_back(self, message_base: MessageBase, qq_message_id: str):
# 修改 additional_config添加 echo 字段
if message_base.message_info.additional_config is None:
message_base.message_info.additional_config = {}
message_base.message_info.additional_config["echo"] = True
# 获取原始的 mmc_message_id
mmc_message_id = message_base.message_info.message_id
# 修改 message_segment 为 notify 类型
message_base.message_segment = Seg(
type="notify",
data={
"sub_type": "echo",
"echo": mmc_message_id,
"actual_id": qq_message_id
}
)
await message_send_instance.message_send(message_base)
logger.debug("已回送消息ID")
return
send_handler = SendHandler()
send_handler = SendHandler()