@@ -97,7 +97,7 @@ async def setup(self, *, creator=None, category=None):
9797 overwrites = overwrites ,
9898 reason = "Creating a thread channel." ,
9999 )
100- except discord .HTTPException as e : # Failed to create due to 50 channel limit .
100+ except discord .HTTPException as e : # Failed to create due to missing perms .
101101 logger .critical ("An error occurred while creating a thread." , exc_info = True )
102102 self .manager .cache .pop (self .id )
103103
@@ -860,18 +860,17 @@ async def create(
860860
861861 # Schedule thread setup for later
862862 cat = self .bot .main_category
863- if len (cat .channels ) == 50 :
863+ if category is None and len (cat .channels ) == 50 :
864864 fallback_id = self .bot .config ["fallback_category_id" ]
865- fallback = discord .utils .get (cat .guild .categories , id = int (fallback_id ))
866- if fallback and len (fallback .channels ) != 50 :
867- self .bot .loop .create_task (thread .setup (creator = creator , category = fallback ))
868- return thread
869-
870- fallback = await cat .clone (name = "Fallback Modmail" )
871- self .bot .config .set ("fallback_category_id" , fallback .id )
872- await self .bot .config .update ()
873- self .bot .loop .create_task (thread .setup (creator = creator , category = fallback ))
874- return thread
865+ if fallback_id :
866+ fallback = discord .utils .get (cat .guild .categories , id = int (fallback_id ))
867+ if fallback and len (fallback .channels ) != 50 :
868+ category = fallback
869+
870+ if not category :
871+ category = await cat .clone (name = "Fallback Modmail" )
872+ self .bot .config .set ("fallback_category_id" , category .id )
873+ await self .bot .config .update ()
875874
876875 self .bot .loop .create_task (thread .setup (creator = creator , category = category ))
877876 return thread
0 commit comments