Skip to content

Commit

Permalink
@Gruetzig hates duplicate soaps (2)
Browse files Browse the repository at this point in the history
@Gruetzig is annoyed by soap duplicates
  • Loading branch information
eip618 committed Aug 26, 2024
1 parent d59c86e commit 9b9c58b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cogs/assistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ 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]
for channel in self.soaps_category.text_channels:
if channel.name == channel_name:
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 9b9c58b

Please sign in to comment.