22
22
SOFTWARE.
23
23
'''
24
24
25
- __version__ = '1.3.5 '
25
+ __version__ = '1.3.6 '
26
26
27
27
import discord
28
28
from discord .ext import commands
@@ -590,7 +590,7 @@ async def process_reply(self, message, user_id=None):
590
590
user_id = user_id or int (re .findall (r'\d+' , message .channel .topic )[0 ])
591
591
user = self .get_user (user_id )
592
592
if not user :
593
- return await message .channel .send ('This user does not have any mutual servers with the bot and is thus unreachable.' )
593
+ return await message .channel .send ('This user does not share any servers with the bot and is thus unreachable.' )
594
594
await asyncio .gather (
595
595
self .send_mail (message , message .channel , from_mod = True ),
596
596
self .send_mail (message , user , from_mod = True )
@@ -637,7 +637,7 @@ async def process_modmail(self, message):
637
637
await self .send_mail (message , channel , from_mod = False )
638
638
639
639
640
- async def create_thread (self , user , * , creator = None ):
640
+ async def create_thread (self , user , * , creator = None , reopen = False ):
641
641
642
642
guild = self .guild
643
643
topic = f'User ID: { user .id } '
@@ -653,10 +653,13 @@ async def create_thread(self, user, *, creator=None):
653
653
654
654
if creator :
655
655
em = discord .Embed (title = 'Modmail thread started' )
656
- em .description = f'{ creator .mention } has started a modmail thread with you.'
656
+ second = 'has started a modmail thread with you.' if not reopen else 'has reopened this modmail thread.'
657
+ em .description = f'{ creator .mention } ' + second
658
+
657
659
em .color = discord .Color .green ()
658
660
659
- info_description = f'{ creator .mention } has created a thread with { user .mention } '
661
+ info_description = f'{ creator .mention } has { "created" if not reopen else "reopened" } a thread with { user .mention } '
662
+
660
663
661
664
mention = (self .config .get ('MENTION' ) or '@here' ) if not creator else None
662
665
@@ -703,13 +706,24 @@ async def reply(self, ctx, *, msg=''):
703
706
704
707
@commands .command ()
705
708
@commands .has_permissions (manage_channels = True )
706
- async def contact (self , ctx , * , user : discord .Member ):
709
+ async def contact (self , ctx , * , user : discord .Member = None ):
707
710
'''Create a thread with a specified member.'''
711
+ reopen = False
712
+ if not user and ctx .channel .category and ctx .channel .category .name == 'Mod Mail Archives' :
713
+ user_id = None
714
+ if not ctx .channel .topic :
715
+ user_id = await self .find_user_id_from_channel (ctx .channel )
716
+ user_id = user_id or int (ctx .channel .topic .split (': ' )[1 ])
717
+ user = self .get_user (user_id )
718
+ reopen = True
719
+ if not user :
720
+ return await ctx .send ('This user does not share any servers with the bot and is thus unreachable.' )
721
+
708
722
categ = discord .utils .get (ctx .guild .categories , id = ctx .channel .category_id )
709
- channel = await self .create_thread (user , creator = ctx .author )
723
+ channel = await self .create_thread (user , creator = ctx .author , reopen = reopen )
710
724
711
- em = discord .Embed (title = 'Created Thread ' )
712
- em .description = f'Thread started in { channel .mention } for { user .mention } '
725
+ em = discord .Embed (title = 'Thread reopened' if reopen else ' Created thread ' )
726
+ em .description = f'Thread { "reopned" if reopen else " started" } in { channel .mention } for { user .mention } '
713
727
em .color = discord .Color .green ()
714
728
715
729
await ctx .send (embed = em )
0 commit comments