fix(reminder): 修复多条提醒消息重复@用户的问题
当提醒消息被分割成多段发送时,旧的逻辑会导致每一段消息都@目标用户。 本次修改调整了消息构造逻辑,确保只有第一段消息会包含@提醒,避免在群聊中造成不必要的刷屏。
This commit is contained in:
@@ -51,12 +51,12 @@ class ReminderTask(AsyncTask):
|
||||
)
|
||||
|
||||
if success and reply_set:
|
||||
for _, text in reply_set:
|
||||
for i, (_, text) in enumerate(reply_set):
|
||||
if self.is_group:
|
||||
message_payload = [
|
||||
{"type": "at", "data": {"qq": self.target_user_id}},
|
||||
{"type": "text", "data": {"text": f" {text}"}}
|
||||
]
|
||||
message_payload = []
|
||||
if i == 0:
|
||||
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(
|
||||
action="send_group_msg",
|
||||
params={"group_id": self.group_id, "message": message_payload},
|
||||
|
||||
Reference in New Issue
Block a user