chhangement du comportement du discord bot sur modif des matchs
CI - Security, Lint & Tests / validate (push) Failing after 59s

This commit is contained in:
cedrick2711
2026-09-08 12:46:44 -04:00
parent 4a2e2f053f
commit b9791d1547
4 changed files with 145 additions and 55 deletions
+32 -11
View File
@@ -686,6 +686,7 @@ class TeamTryoutsBot(commands.Bot):
event_date: str,
event_time: str,
reference_id: int,
change_kind: str = 'scheduled',
) -> int:
"""Send a schedule addition notification to a player.
@@ -696,6 +697,7 @@ class TeamTryoutsBot(commands.Bot):
event_date: Date string.
event_time: Time string.
reference_id: ID of the MatchParticipant or TryoutRegistration record.
change_kind: 'scheduled' (new match / added player) or 'modified' (date/time changed).
"""
# Look up the DB user to get their Discord user ID
from app.extensions import db
@@ -712,16 +714,29 @@ class TeamTryoutsBot(commands.Bot):
event_name = "Match" if event_type == 'match' else "Tryout"
message = (
f"📅 **{event_name} Scheduled**\n\n"
f"You have been added to the following {event_type}:\n"
f"**{event_title}**\n"
f"**Date:** {event_date}\n"
f"**Time:** {event_time}\n\n"
"Please confirm your attendance:\n"
f"{CHECK_EMOJI} - Confirm attendance\n"
f"{CROSS_EMOJI} - Decline"
)
if change_kind == 'modified':
message = (
f"📅 **{event_name} Modified**\n\n"
f"The {event_type} date and/or time has been modified for "
f"**{event_title}**.\n"
f"The new date and/or time is:\n"
f"**Date:** {event_date}\n"
f"**Time:** {event_time}\n\n"
"Please confirm your attendance:\n"
f"{CHECK_EMOJI} - Confirm attendance\n"
f"{CROSS_EMOJI} - Decline"
)
else:
message = (
f"📅 **{event_name} Scheduled**\n\n"
f"You have been added to the following {event_type}:\n"
f"**{event_title}**\n"
f"**Date:** {event_date}\n"
f"**Time:** {event_time}\n\n"
"Please confirm your attendance:\n"
f"{CHECK_EMOJI} - Confirm attendance\n"
f"{CROSS_EMOJI} - Decline"
)
msg = await self._send_dm(
db_user.discord_user_id,
@@ -1444,8 +1459,13 @@ def send_schedule_notification(
event_date: str,
event_time: str,
reference_id: int,
change_kind: str = 'scheduled',
) -> bool:
"""Queue a schedule addition notification to be sent by the bot."""
"""Queue a schedule addition notification to be sent by the bot.
Args:
change_kind: 'scheduled' (new match / added player) or 'modified' (date/time changed).
"""
return _enqueue(
'schedule_addition',
{
@@ -1455,6 +1475,7 @@ def send_schedule_notification(
'event_date': event_date,
'event_time': event_time,
'reference_id': reference_id,
'change_kind': change_kind,
},
description=f'the {event_type} notification for user {user_id}',
)