Skip to content

Commit

Permalink
🩹 Fix concurrent lobby creation
Browse files Browse the repository at this point in the history
Fixes an issue where users are able to create multiple lobbies by loading multiple instances of the starting message.

Closes #89
  • Loading branch information
sam1357 committed Aug 19, 2024
1 parent 0bbab2b commit dbd55e6
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/cogs/Lobbies.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,21 @@ def __init__(self, LobbyPrompt) -> None:
async def on_submit(self, interaction: discord.Interaction):
await interaction.response.defer(thinking=False)
self.LobbyPrompt.clear_items()
await self.LobbyPrompt.updateView(
interaction.client.create_embed(
"MOCBOT LOBBIES",
f"Creating lobby **{self.lobby_name.value}**",
None,
lobby_details = LobbyPrompt.get_lobby_details(interaction.user)

if lobby_details != {}:
await self.LobbyPrompt.delete_prompt()
return await interaction.send_message(
embed=interaction.client.create_embed(
"MOCBOT LOBBIES",
"You cannot create another lobby as you are already in a lobby.",
None,
),
ephemeral=True,
)

await self.LobbyPrompt.updateView(
interaction.client.create_embed("MOCBOT LOBBIES", f"Creating lobby **{self.lobby_name.value}**", None)
)
await self.LobbyPrompt.create_lobby(self.lobby_name.value, interaction.user)
await asyncio.sleep(1)
Expand Down

0 comments on commit dbd55e6

Please sign in to comment.