Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fix ready message for /create-match
Browse files Browse the repository at this point in the history
  • Loading branch information
thboss committed Sep 2, 2023
1 parent 39fee10 commit b51c9a1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 0 additions & 4 deletions bot/cogs/lobby.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,6 @@ async def _join(self, user: Member, lobby_model: LobbyModel):
await ready_view.start()
await ready_view.wait()
unreadied_users = set(queued_users) - ready_view.ready_users
try:
await ready_view.message.delete()
except:
pass

if unreadied_users:
awaitables = [u.move_to(guild_model.prematch_channel) for u in unreadied_users]
Expand Down
13 changes: 4 additions & 9 deletions bot/cogs/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ async def setup_teams_match(
):
""""""
embed = Embed()
map_pool = await self.select_mpool(author, guild_maps, series, interaction)
team1_users = await self.select_team_participants(team1_model, capacity, interaction)
team2_users = await self.select_team_participants(team2_model, capacity, interaction)
map_pool = await self.select_mpool(author, guild_maps, series, interaction)

embed.add_field(name=f"Team {team1_model.name}", value="\n".join(u.mention for u in team1_users))
embed.add_field(name=f"Team {team2_model.name}", value="\n".join(u.mention for u in team2_users))
Expand All @@ -87,13 +87,8 @@ async def setup_teams_match(
await asyncio.sleep(3)

match_users = team1_users + team2_users
ready_view = ReadyView(match_users, message)
message = await interaction.edit_original_response(
content=''.join(u.mention for u in match_users),
embed=ready_view._embed_ready(),
view=ready_view
)
await self.bot.notify(*match_users, channel=interaction.channel)
ready_view = ReadyView(match_users, interaction.channel)
await ready_view.start()
await ready_view.wait()
unreadied_users = set(match_users) - ready_view.ready_users

Expand Down Expand Up @@ -198,7 +193,7 @@ async def challenge(
interaction: Interaction,
team: Role,
capacity: app_commands.Choice[int],
series: app_commands.Choice[str],
series: List[app_commands.Choice[str]],
game_mode: app_commands.Choice[str]
):
""""""
Expand Down
10 changes: 10 additions & 0 deletions bot/views/readyView.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ async def ready(self, interaction: Interaction, button: Button):
self.ready_users.add(interaction.user)
await self.message.edit(embed=self._embed_ready())
if self.all_ready:
try:
await self.message.delete()
except:
pass
self.stop()

async def on_timeout(self):
try:
await self.message.delete()
except:
pass

async def interaction_check(self, interaction: Interaction):
await interaction.response.defer()
user = interaction.user
Expand Down

0 comments on commit b51c9a1

Please sign in to comment.