File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -300,22 +300,29 @@ async def archive(self, ctx):
300
300
deleteing the channel.)
301
301
'''
302
302
user_id = None
303
+
303
304
if not ctx .channel .topic :
304
305
user_id = await self .find_user_id_from_channel (ctx .channel )
305
306
elif 'User ID:' not in str (ctx .channel .topic ) and not user_id :
306
307
return await ctx .send ('This is not a modmail thread.' )
307
308
308
309
user_id = user_id or int (ctx .channel .topic .split (': ' )[1 ])
310
+
311
+ archives = discord .utils .get (ctx .guild .categories , name = 'Mod Mail Archives' )
312
+
313
+ if ctx .channel .category is archives :
314
+ return await ctx .send ('This channel is already archived.' )
315
+
309
316
user = self .get_user (user_id )
310
317
em = discord .Embed (title = 'Thread Closed' )
311
318
em .description = f'{ ctx .author .mention } has closed this modmail session.'
312
319
em .color = discord .Color .red ()
320
+
313
321
try :
314
322
await user .send (embed = em )
315
323
except :
316
324
pass
317
325
318
- archives = discord .utils .get (ctx .guild .categories , name = 'Mod Mail Archives' )
319
326
await ctx .channel .edit (category = archives )
320
327
done = discord .Embed (title = 'Thread Archived' )
321
328
done .description = f'{ ctx .author .mention } has archived this modmail session.'
You can’t perform that action at this time.
0 commit comments