feat: Update match result messaging to include streak notifications in the content
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ching L 2025-07-24 11:49:55 +08:00
parent e381dce261
commit 21c7b95653

View File

@ -48,16 +48,17 @@ async def send_message(channel):
data = await dota.serialize_match_for_discord(match_)
logger.info(f"sending match {match_['match_id']}, {data}")
try:
# 发送比赛结果
await channel.send(content=data['content'], embeds=[discord.Embed.from_dict(embed) for embed in data['embeds']])
# 如果有连胜连败消息,一并发送
# 将连胜连败消息放在内容开头
content = data['content']
if streak_notifications:
for notification in streak_notifications:
await channel.send(content=notification)
streak_msg = '\n'.join(streak_notifications) + '\n\n'
content = streak_msg + content
# 发送后清空通知列表,避免重复发送
streak_notifications = []
# 发送比赛结果连胜信息已包含在content开头
await channel.send(content=content, embeds=[discord.Embed.from_dict(embed) for embed in data['embeds']])
except Exception as e:
logger.error(f"send match error {e}")