Skip to content

Commit

Permalink
Prevent duplicate challenge channel names (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
user32121 authored Jan 11, 2024
1 parent ae08da7 commit f991894
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cogs/chal/chal.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ async def create(self, ctx: SlashContext, name: str) -> None:
if channel_name in AUTOGENERATED_CHANNELS.values():
await ctx.send('Cannot create a challenge with the same name as an autogenerated channel.')
return
for ctf_channel in category_folder.text_channels:
if(ctf_channel.name == channel_name):
await ctx.send('Cannot create a challenge with the same name as an existing channel.')
return
await ctx.guild.create_text_channel(
name=channel_name,
category=category_folder,
Expand Down

0 comments on commit f991894

Please sign in to comment.