diff --git a/cogs/players.py b/cogs/players.py index 14e8570..a0aafd8 100644 --- a/cogs/players.py +++ b/cogs/players.py @@ -1068,7 +1068,7 @@ class Players(commands.Cog): await view.wait() if view.value: - await gauntlets.end_run(this_run, this_event, draft_team) + await gauntlets.end_run(this_run, this_event, draft_team, force_end=True) await interaction.edit_original_response( content=f'Your {event_name} run has been reset. Run `/gauntlets start {event_name}` to redraft!', view=None diff --git a/cogs/players_new/gauntlet.py b/cogs/players_new/gauntlet.py index 03b76de..1889c83 100644 --- a/cogs/players_new/gauntlet.py +++ b/cogs/players_new/gauntlet.py @@ -222,7 +222,7 @@ class Gauntlet(commands.Cog): await view.wait() if view.value: - await gauntlets.end_run(this_run, this_event, draft_team) # type: ignore + await gauntlets.end_run(this_run, this_event, draft_team, force_end=True) # type: ignore await interaction.edit_original_response( content=f'Your {event_name} run has been reset. Run `/gauntlets start` to redraft!', view=None diff --git a/gauntlets.py b/gauntlets.py index 2c0696e..0421d4f 100644 --- a/gauntlets.py +++ b/gauntlets.py @@ -1838,7 +1838,7 @@ async def get_embed(this_run=None, this_event=None, this_team=None): return embed -async def end_run(this_run, this_event, this_team: Team, force_end: bool = False): +async def end_run(this_run, this_event, this_team: Team, bot=None, main_team=None, force_end: bool = False): l_message = f'Tough loss. That brings your {this_event["name"]} record to ' \ f'**{this_run["wins"]}-{this_run["losses"]}**. ' if this_run['losses'] == 2 or force_end: @@ -1850,6 +1850,16 @@ async def end_run(this_run, this_event, this_team: Team, force_end: bool = False ) c_query = await db_post(f'cards/wipe-team/{this_team.id}') + # Send news-ticker message for natural run completion (2 losses), not for manual resets + if bot and main_team and this_run['losses'] == 2 and not force_end: + team_name = main_team.lname if isinstance(main_team, Team) else main_team.get('lname', 'Unknown Team') + await send_to_channel( + bot, + 'pd-news-ticker', + content=f'The **{team_name}** have completed their **{this_event["name"]} Gauntlet** run ' + f'with a final record of {this_run["wins"]}-{this_run["losses"]}.' + ) + return l_message @@ -2004,7 +2014,7 @@ async def post_result(run_id: int, is_win: bool, this_team: Team, bot, channel, params=[('losses', this_run['losses'] + 1)] ) - l_message = await end_run(this_run, this_event, this_team) + l_message = await end_run(this_run, this_event, this_team, bot, main_team) await channel.send( content=l_message, embed=await get_embed(this_run)