@@ -439,11 +439,9 @@ async def convert_emoji(self, name):
439
439
440
440
if name not in UNICODE_EMOJI :
441
441
try :
442
- return await converter .convert (
443
- ctx , sent_emoji .strip (':' )
444
- )
442
+ name = await converter .convert (ctx , name .strip (':' ))
445
443
except commands .BadArgument :
446
- pass
444
+ logger . warning ( f' { name } is not a valid emoji.' )
447
445
return name
448
446
449
447
async def retrieve_emoji (self ):
@@ -456,7 +454,6 @@ async def retrieve_emoji(self):
456
454
sent_emoji = self .config .get ('sent_emoji' , '✅' )
457
455
blocked_emoji = self .config .get ('blocked_emoji' , '🚫' )
458
456
459
-
460
457
if sent_emoji not in UNICODE_EMOJI :
461
458
try :
462
459
sent_emoji = await converter .convert (
@@ -660,18 +657,19 @@ async def on_raw_reaction_add(self, payload):
660
657
661
658
channel = self .get_channel (payload .channel_id )
662
659
663
- if not channel : # dm channel not in internal cache
660
+ if not channel : # dm channel not in internal cache
664
661
_thread = await self .threads .find (recipient = user )
665
662
if not _thread :
666
663
return
667
664
channel = await _thread .recipient .create_dm ()
668
665
669
- message = await channel .get_message (payload .message_id ) # TODO: change to fetch_message (breaking change in d.py)
666
+ # TODO: change to fetch_message (breaking change in d.py)
667
+ message = await channel .get_message (payload .message_id )
670
668
reaction = payload .emoji
671
669
672
670
close_emoji = await self .convert_emoji (self .config .get ('close_emoji' , '🔒' ))
673
671
674
- if isinstance (channel , discord .DMChannel ) and str (reaction ) == str (close_emoji ): # closing thread
672
+ if isinstance (channel , discord .DMChannel ) and str (reaction ) == str (close_emoji ): # closing thread
675
673
thread = await self .threads .find (recipient = user )
676
674
ts = message .embeds [0 ].timestamp if message .embeds else None
677
675
if thread and ts == thread .channel .created_at :
@@ -689,7 +687,6 @@ async def on_raw_reaction_add(self, payload):
689
687
if msg .id == int (message_id ):
690
688
await msg .add_reaction (reaction )
691
689
692
-
693
690
async def on_guild_channel_delete (self , channel ):
694
691
if channel .guild != self .modmail_guild :
695
692
return
0 commit comments