modification des envoie de massage par bot discord

This commit is contained in:
cedrick2711
2026-07-18 13:35:53 -04:00
parent 4ed42d5ec8
commit 614d76581d
6 changed files with 122 additions and 15 deletions
+13 -5
View File
@@ -341,7 +341,14 @@ class TeamTryoutsBot(commands.Bot):
player = request.player
coach = request.coach
if not player or not player.discord_user_id:
if not player:
logger.warning(f"Player not found for request {request.id}")
return
if not coach:
logger.warning(f"Coach not found for request {request.id}")
return
if not player.discord_user_id:
logger.warning(f"Player has no Discord user ID for request {request.id}")
return
@@ -353,7 +360,7 @@ class TeamTryoutsBot(commands.Bot):
if approved:
message = (
"🎉 **One on One Session Confirmed!**\n\n"
f"Your coach **{request.coach.full_name}** has approved your request:\n"
f"Your coach **{coach.full_name}** has approved your request:\n"
f"**Date:** {request.date.strftime('%A, %B %d, %Y')}\n"
f"**Time:** {request.start_time.strftime('%I:%M %p')} - {request.end_time.strftime('%I:%M %p')}\n"
f"**Discussion Points:** {request.points or 'No specific points provided'}\n\n"
@@ -363,21 +370,22 @@ class TeamTryoutsBot(commands.Bot):
if refusal_note:
message = (
"😞 **One on One Session Rejected**\n\n"
f"Your coach **{request.coach.full_name}** has declined:\n"
f"Your coach **{coach.full_name}** has declined:\n"
f"**Reason:** {refusal_note}\n\n"
"Please try selecting a different time slot."
)
else:
message = (
"😞 **One on One Session Unavailable**\n\n"
f"Your coach **{request.coach.full_name}** is not available.\n\n"
f"Your coach **{coach.full_name}** is not available.\n\n"
"Please try selecting a different time slot."
)
await player_user.send(message)
logger.info(f"Sent One on One notification to player {player.full_name} (request {request.id})")
except Exception as e:
logger.error(f"Error notifying player: {e}")
logger.error(f"Error notifying player about One on One: {e}")
async def send_daily_reminders(self):
"""Send daily reminders at 18:00 EDT for events in 24-48 hours."""