Skip to content

Commit 9d00142

Browse files
committed
Rename category to fallback due to shadowing names.
1 parent fc156f9 commit 9d00142

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,20 @@ async def create_thread_channel(bot, recipient, category, overwrites, *, name=No
393393
errors_raised.append((e.text, (category, name)))
394394

395395
if "Maximum number of channels in category reached" in e.text:
396+
fallback = None
396397
fallback_id = bot.config["fallback_category_id"]
397398
if fallback_id:
398399
fallback = discord.utils.get(category.guild.categories, id=int(fallback_id))
399-
if fallback and len(fallback.channels) < 49:
400-
category = fallback
400+
if fallback and len(fallback.channels) >= 49:
401+
fallback = None
401402

402-
if not category:
403-
category = await category.clone(name="Fallback Modmail")
403+
if not fallback:
404+
fallback = await category.clone(name="Fallback Modmail")
404405
bot.config.set("fallback_category_id", str(category.id))
405406
await bot.config.update()
406407

407408
return await create_thread_channel(
408-
bot, recipient, category, overwrites, errors_raised=errors_raised
409+
bot, recipient, fallback, overwrites, errors_raised=errors_raised
409410
)
410411

411412
if "Contains words not allowed" in e.text:

0 commit comments

Comments
 (0)