5252from core .thread import ThreadManager
5353from core .time import human_timedelta
5454
55-
5655init ()
5756
5857logger = logging .getLogger ('Modmail' )
@@ -486,7 +485,8 @@ async def process_modmail(self, message):
486485 except isodate .ISO8601Error :
487486 logger .warning ('The account age limit needs to be a '
488487 'ISO-8601 duration formatted duration string '
489- f'greater than 0 days, not "%s".' , str (account_age ))
488+ f'greater than 0 days, not "%s".' ,
489+ str (account_age ))
490490 del self .config .cache ['account_age' ]
491491 await self .config .update ()
492492 account_age = isodate .duration .Duration ()
@@ -541,7 +541,7 @@ async def process_modmail(self, message):
541541 await self .config .update ()
542542 else :
543543 reaction = sent_emoji
544-
544+
545545 if reaction != 'disable' :
546546 try :
547547 await message .add_reaction (reaction )
@@ -610,7 +610,9 @@ async def update_perms(self, name, value, add=True):
610610 else :
611611 if value in permissions [name ]:
612612 permissions [name ].remove (value )
613- logger .info (info (f'Updating permissions for { name } , { value } (add={ add } ).' ))
613+ logger .info (
614+ info (f'Updating permissions for { name } , { value } (add={ add } ).' )
615+ )
614616 await self .config .update ()
615617
616618 async def on_message (self , message ):
@@ -649,7 +651,7 @@ async def on_message(self, message):
649651
650652 async def on_typing (self , channel , user , _ ):
651653 if user .bot :
652- return
654+ return
653655 if isinstance (channel , discord .DMChannel ):
654656 if not self .config .get ('user_typing' ):
655657 return
@@ -662,7 +664,7 @@ async def on_typing(self, channel, user, _):
662664 thread = await self .threads .find (channel = channel )
663665 if thread and thread .recipient :
664666 await thread .recipient .trigger_typing ()
665-
667+
666668 async def on_raw_reaction_add (self , payload ):
667669
668670 user = self .get_user (payload .user_id )
@@ -682,12 +684,14 @@ async def on_raw_reaction_add(self, payload):
682684 message = await channel .get_message (payload .message_id )
683685 reaction = payload .emoji
684686
685- close_emoji = await self .convert_emoji (self .config .get ('close_emoji' , '🔒' ))
687+ close_emoji = await self .convert_emoji (
688+ self .config .get ('close_emoji' , '🔒' )
689+ )
686690
687691 if isinstance (channel , discord .DMChannel ) and str (reaction ) == str (close_emoji ): # closing thread
688692 thread = await self .threads .find (recipient = user )
689693 ts = message .embeds [0 ].timestamp if message .embeds else None
690- if thread and ts == thread .channel .created_at :
694+ if thread and ts == thread .channel .created_at :
691695 # the reacted message is the corresponding thread creation embed
692696 if not self .config .get ('disable_recipient_thread_close' ):
693697 await thread .close (closer = user )
@@ -733,23 +737,23 @@ async def on_guild_channel_delete(self, channel):
733737 return
734738
735739 await thread .close (closer = mod , silent = True , delete_channel = False )
736-
740+
737741 async def on_member_remove (self , member ):
738742 thread = await self .threads .find (recipient = member )
739743 if thread :
740744 em = discord .Embed (
741745 description = 'The recipient has left the server.' ,
742746 color = discord .Color .red ()
743- )
747+ )
744748 await thread .channel .send (embed = em )
745-
749+
746750 async def on_member_join (self , member ):
747751 thread = await self .threads .find (recipient = member )
748752 if thread :
749753 em = discord .Embed (
750754 description = 'The recipient has joined the server.' ,
751755 color = self .mod_color
752- )
756+ )
753757 await thread .channel .send (embed = em )
754758
755759 async def on_message_delete (self , message ):
@@ -909,7 +913,7 @@ async def autoupdate_loop(self):
909913 embed .set_author (name = user ['username' ] + ' - Updating Bot' ,
910914 icon_url = user ['avatar_url' ],
911915 url = user ['url' ])
912- embed .set_footer (text = f" Updating Modmail v{ self .version } "
916+ embed .set_footer (text = f' Updating Modmail v{ self .version } '
913917 f"-> v{ metadata ['latest_version' ]} " )
914918
915919 changelog = await Changelog .from_url (self )
@@ -935,6 +939,7 @@ async def autoupdate_loop(self):
935939if __name__ == '__main__' :
936940 if os .name != 'nt' :
937941 import uvloop
942+
938943 uvloop .install ()
939944 bot = ModmailBot ()
940945 bot .run ()
0 commit comments