CLAUDE: Add news-ticker message when gauntlet runs end with 2 losses
Users reported that end-of-run messages to #pd-news-ticker were no longer appearing when gauntlet teams lost their second game. The news-ticker announcement was only happening for 10-win completions, not 2-loss endings. Changes: - Updated end_run() to accept bot and main_team parameters - Added send_to_channel() call when losses == 2 (natural run end) - Skips news-ticker for manual resets (force_end=True) - Updated post_result() to pass bot and main_team to end_run() - Updated manual reset calls to explicitly pass force_end=True Now when a gauntlet team loses their second game, #pd-news-ticker will show: "The **[Team]** have completed their **[Event]** Gauntlet run with a final record of [wins]-[losses]." The draft completion message to news-ticker was already working correctly at cogs/players_new/gauntlet.py:178-183. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c2bbf94925
commit
1e75f1baba
@ -1068,7 +1068,7 @@ class Players(commands.Cog):
|
|||||||
await view.wait()
|
await view.wait()
|
||||||
|
|
||||||
if view.value:
|
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(
|
await interaction.edit_original_response(
|
||||||
content=f'Your {event_name} run has been reset. Run `/gauntlets start {event_name}` to redraft!',
|
content=f'Your {event_name} run has been reset. Run `/gauntlets start {event_name}` to redraft!',
|
||||||
view=None
|
view=None
|
||||||
|
|||||||
@ -222,7 +222,7 @@ class Gauntlet(commands.Cog):
|
|||||||
await view.wait()
|
await view.wait()
|
||||||
|
|
||||||
if view.value:
|
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(
|
await interaction.edit_original_response(
|
||||||
content=f'Your {event_name} run has been reset. Run `/gauntlets start` to redraft!',
|
content=f'Your {event_name} run has been reset. Run `/gauntlets start` to redraft!',
|
||||||
view=None
|
view=None
|
||||||
|
|||||||
14
gauntlets.py
14
gauntlets.py
@ -1838,7 +1838,7 @@ async def get_embed(this_run=None, this_event=None, this_team=None):
|
|||||||
return embed
|
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 ' \
|
l_message = f'Tough loss. That brings your {this_event["name"]} record to ' \
|
||||||
f'**{this_run["wins"]}-{this_run["losses"]}**. '
|
f'**{this_run["wins"]}-{this_run["losses"]}**. '
|
||||||
if this_run['losses'] == 2 or force_end:
|
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}')
|
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
|
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)]
|
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(
|
await channel.send(
|
||||||
content=l_message,
|
content=l_message,
|
||||||
embed=await get_embed(this_run)
|
embed=await get_embed(this_run)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user