@@ -171,8 +171,9 @@ def help_embed(self, prefix):
171
171
f'`{ prefix } reply <message...>` - Sends a message to the current thread\' s recipient.\n ' \
172
172
f'`{ prefix } close` - Closes the current thread and deletes the channel.\n ' \
173
173
f'`{ prefix } archive` - Closes the current thread and moves the channel to archive category.\n ' \
174
- f'`{ prefix } block` - Blocks a user from using modmail\n ' \
175
- f'`{ prefix } unblock` - Unblocks a user from using modmail\n ' \
174
+ f'`{ prefix } block` - Blocks a user from using modmail.\n ' \
175
+ f'`{ prefix } blocked` - Shows a list of currently blocked users.\n ' \
176
+ f'`{ prefix } unblock` - Unblocks a user from using modmail.\n ' \
176
177
f'`{ prefix } snippets` - See a list of snippets that are currently configured.\n ' \
177
178
f'`{ prefix } customstatus` - Sets the Bot status to whatever you want.\n ' \
178
179
f'`{ prefix } disable` - Closes all threads and disables modmail for the server.\n '
@@ -317,7 +318,7 @@ async def archive(self, ctx):
317
318
em = discord .Embed (title = 'Thread Closed' )
318
319
em .description = f'{ ctx .author .mention } has closed this modmail session.'
319
320
em .color = discord .Color .red ()
320
-
321
+
321
322
try :
322
323
await user .send (embed = em )
323
324
except :
@@ -546,12 +547,17 @@ async def reply(self, ctx, *, msg=''):
546
547
await self .process_reply (ctx .message , user_id = user_id )
547
548
548
549
@commands .command ()
550
+ @commands .has_permissions (manage_channels = True )
549
551
async def contact (self , ctx , * , user : discord .Member ):
550
552
'''Create a thread with a specified member.'''
551
553
categ = discord .utils .get (ctx .guild .categories , id = ctx .channel .category_id )
552
- if categ is not None and categ .name == 'Mod Mail' :
553
- channel = await self .create_thread (user , creator = ctx .author )
554
- await ctx .send (f'Created thread { channel .mention } ' )
554
+ channel = await self .create_thread (user , creator = ctx .author )
555
+
556
+ em = discord .Embed (title = 'Created Thread' )
557
+ em .description = f'Thread started in { channel .mention } for { user .mention } '
558
+ em .color = discord .Color .green ()
559
+
560
+ await ctx .send (embed = em )
555
561
556
562
@commands .command (name = "customstatus" , aliases = ['status' , 'presence' ])
557
563
@commands .has_permissions (administrator = True )
@@ -560,8 +566,45 @@ async def _status(self, ctx, *, message):
560
566
if message == 'clear' :
561
567
return await self .change_presence (activity = None )
562
568
await self .change_presence (activity = discord .Game (message ))
563
- await ctx .send (f"Changed status to **{ message } **" )
569
+ em = discord .Embed (title = 'Status Changed' )
570
+ em .description = message
571
+ em .color = discord .Color .green ()
572
+ em .set_footer (text = 'Note: this change is temporary.' )
573
+ await ctx .send (embed = em )
574
+
575
+ @commands .command ()
576
+ @commands .has_permissions (manage_channels = True )
577
+ async def blocked (self , ctx ):
578
+ '''Returns a list of blocked users'''
579
+ categ = discord .utils .get (ctx .guild .categories , name = 'Mod Mail' )
580
+ top_chan = categ .channels [0 ] #bot-info
581
+ ids = re .findall (r'\d+' , top_chan .topic )
582
+
583
+ em = discord .Embed (title = 'Blocked Users' , color = discord .Color .green ())
584
+ em .description = ''
585
+
586
+ users = []
587
+ not_reachable = []
588
+
589
+ for id in ids :
590
+ user = self .get_user (int (id ))
591
+ if user :
592
+ users .append (user )
593
+ else :
594
+ not_reachable .append (id )
595
+
596
+ em .description = 'Here is a list of blocked users.'
597
+
598
+ if users :
599
+ em .add_field (name = 'Currently Known' , value = ' ' .join (u .mention for u in users ))
600
+ if not_reachable :
601
+ em .add_field (name = 'Unknown' , value = '\n ' .join (f'`{ i } `' for i in not_reachable ), inline = False )
602
+
603
+ if not users and not not_reachable :
604
+ em .description = 'Currently there are no blocked users'
564
605
606
+ await ctx .send (embed = em )
607
+
565
608
@commands .command ()
566
609
@commands .has_permissions (manage_channels = True )
567
610
async def block (self , ctx , id = None ):
@@ -577,11 +620,25 @@ async def block(self, ctx, id=None):
577
620
topic = str (top_chan .topic )
578
621
topic += '\n ' + id
579
622
623
+ user = self .get_user (int (id ))
624
+ mention = user .mention if user else f'`{ id } `'
625
+
626
+ em = discord .Embed ()
627
+ em .color = discord .Color .green ()
628
+
580
629
if id not in top_chan .topic :
581
630
await top_chan .edit (topic = topic )
582
- await ctx .send ('User successfully blocked!' )
631
+
632
+ em .title = 'Success'
633
+ em .description = f'{ mention } is now blocked'
634
+
635
+ await ctx .send (embed = em )
583
636
else :
584
- await ctx .send ('User is already blocked.' )
637
+ em .title = 'Error'
638
+ em .description = f'{ mention } is already blocked'
639
+ em .color = discord .Color .red ()
640
+
641
+ await ctx .send (embed = em )
585
642
586
643
@commands .command ()
587
644
@commands .has_permissions (manage_channels = True )
@@ -598,11 +655,25 @@ async def unblock(self, ctx, id=None):
598
655
topic = str (top_chan .topic )
599
656
topic = topic .replace ('\n ' + id , '' )
600
657
601
- if id in top_chan .topic :
658
+ user = self .get_user (int (id ))
659
+ mention = user .mention if user else f'`{ id } `'
660
+
661
+ em = discord .Embed ()
662
+ em .color = discord .Color .green ()
663
+
664
+ if id in top_chan .topic :
602
665
await top_chan .edit (topic = topic )
603
- await ctx .send ('User successfully unblocked!' )
666
+
667
+ em .title = 'Success'
668
+ em .description = f'{ mention } is no longer blocked'
669
+
670
+ await ctx .send (embed = em )
604
671
else :
605
- await ctx .send ('User is not already blocked.' )
672
+ em .title = 'Error'
673
+ em .description = f'{ mention } is not already blocked'
674
+ em .color = discord .Color .red ()
675
+
676
+ await ctx .send (embed = em )
606
677
607
678
@commands .command (hidden = True , name = 'eval' )
608
679
async def _eval (self , ctx , * , body : str ):
0 commit comments