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