Skip to content

Commit 0d02e79

Browse files
committed
Fixed a typo with convert_emoji
1 parent f900a46 commit 0d02e79

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

bot.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,9 @@ async def convert_emoji(self, name):
439439

440440
if name not in UNICODE_EMOJI:
441441
try:
442-
return await converter.convert(
443-
ctx, sent_emoji.strip(':')
444-
)
442+
name = await converter.convert(ctx, name.strip(':'))
445443
except commands.BadArgument:
446-
pass
444+
logger.warning(f'{name} is not a valid emoji.')
447445
return name
448446

449447
async def retrieve_emoji(self):
@@ -456,7 +454,6 @@ async def retrieve_emoji(self):
456454
sent_emoji = self.config.get('sent_emoji', '✅')
457455
blocked_emoji = self.config.get('blocked_emoji', '🚫')
458456

459-
460457
if sent_emoji not in UNICODE_EMOJI:
461458
try:
462459
sent_emoji = await converter.convert(
@@ -660,18 +657,19 @@ async def on_raw_reaction_add(self, payload):
660657

661658
channel = self.get_channel(payload.channel_id)
662659

663-
if not channel: # dm channel not in internal cache
660+
if not channel: # dm channel not in internal cache
664661
_thread = await self.threads.find(recipient=user)
665662
if not _thread:
666663
return
667664
channel = await _thread.recipient.create_dm()
668665

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)
670668
reaction = payload.emoji
671669

672670
close_emoji = await self.convert_emoji(self.config.get('close_emoji', '🔒'))
673671

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
675673
thread = await self.threads.find(recipient=user)
676674
ts = message.embeds[0].timestamp if message.embeds else None
677675
if thread and ts == thread.channel.created_at:
@@ -689,7 +687,6 @@ async def on_raw_reaction_add(self, payload):
689687
if msg.id == int(message_id):
690688
await msg.add_reaction(reaction)
691689

692-
693690
async def on_guild_channel_delete(self, channel):
694691
if channel.guild != self.modmail_guild:
695692
return

core/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def main_color(self) -> typing.Union[Color, int]:
140140
async def process_modmail(self, message: Message) -> None:
141141
raise NotImplementedError
142142

143+
@abc.abstractmethod
144+
async def convert_emoji(self, name: str) -> str:
145+
raise NotImplementedError
146+
143147
@staticmethod
144148
@abc.abstractmethod
145149
def overwrites(ctx: commands.Context) -> dict:

0 commit comments

Comments
 (0)