Skip to content

Commit

Permalink
soap: deny creation if channel already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Gruetzig committed Aug 26, 2024
1 parent d59c86e commit f960c80
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cogs/assistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ async def createsoap(self, ctx: GuildContext, helpee: discord.Member):
return await ctx.send("The soaps category is not set.")
# Channel names can't be longer than 100 characters
channel_name = f"3ds-{helpee.name}-soap-🧼"[:100]
if channel_name in self.soaps_category.text_channels:
return await ctx.send("Soap channel already exists for user.")
channel = await self.soaps_category.create_text_channel(name=channel_name)
await asyncio.sleep(3) # Fix for discord race condition(?)
await channel.set_permissions(helpee, read_messages=True)
Expand Down

0 comments on commit f960c80

Please sign in to comment.