Skip to content

Commit 4bef5a7

Browse files
check if category full
1 parent aa8902e commit 4bef5a7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cogs/archive.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async def archive_channel( # type: ignore[misc]
239239

240240
if not re.fullmatch(r"\A\d{17,20}\Z", str_channel_id):
241241
await self.command_send_error(
242-
ctx=ctx, message=f"{str_category_id!r} is not a valid category ID."
242+
ctx=ctx, message=f"{str_channel_id!r} is not a valid channel ID."
243243
)
244244
return
245245

@@ -283,6 +283,14 @@ async def archive_channel( # type: ignore[misc]
283283
)
284284
return
285285

286+
if len(category.channels) >= 50:
287+
await self.command_send_error(
288+
ctx=ctx,
289+
message=f"Category with ID {str(category_id)!r} is full. "
290+
"Please select a different category.",
291+
)
292+
return
293+
286294
await channel.edit(category=category, sync_permissions=True)
287295

288296
await ctx.respond(":white_check_mark: Channel successfully archived", ephemeral=True)

0 commit comments

Comments
 (0)