fix(reminder): 修复多条提醒消息重复@用户的问题

当提醒消息被分割成多段发送时,旧的逻辑会导致每一段消息都@目标用户。

本次修改调整了消息构造逻辑,确保只有第一段消息会包含@提醒,避免在群聊中造成不必要的刷屏。
This commit is contained in:
tt-P607
2025-09-16 15:27:54 +08:00
committed by Windpicker-owo
parent 95c7c60c6b
commit c4b1be74f2

View File

@@ -51,12 +51,12 @@ class ReminderTask(AsyncTask):
) )
if success and reply_set: if success and reply_set:
for _, text in reply_set: for i, (_, text) in enumerate(reply_set):
if self.is_group: if self.is_group:
message_payload = [ message_payload = []
{"type": "at", "data": {"qq": self.target_user_id}}, if i == 0:
{"type": "text", "data": {"text": f" {text}"}} message_payload.append({"type": "at", "data": {"qq": self.target_user_id}})
] message_payload.append({"type": "text", "data": {"text": f" {text}"}})
await send_api.adapter_command_to_stream( await send_api.adapter_command_to_stream(
action="send_group_msg", action="send_group_msg",
params={"group_id": self.group_id, "message": message_payload}, params={"group_id": self.group_id, "message": message_payload},