From f960c8095f04a6e0a4a2d427610696f3351df607 Mon Sep 17 00:00:00 2001 From: Gruetzig Date: Mon, 26 Aug 2024 13:56:23 +0200 Subject: [PATCH] soap: deny creation if channel already exists --- cogs/assistance.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cogs/assistance.py b/cogs/assistance.py index 27b0144b..166c3057 100644 --- a/cogs/assistance.py +++ b/cogs/assistance.py @@ -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)