From 8e4e236d2b8ad55292c998ec3aad88dfc9976d87 Mon Sep 17 00:00:00 2001 From: io mintz Date: Thu, 3 Jun 2021 07:58:43 +0000 Subject: [PATCH] em/big: support any emote, not just emotes in the server --- cogs/emote.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cogs/emote.py b/cogs/emote.py index 16a8e1d..abbb43b 100644 --- a/cogs/emote.py +++ b/cogs/emote.py @@ -531,16 +531,23 @@ class Emotes(commands.Cog): emote: the emote to embiggen. """ - emote = await self.parse_emote(context, emote) + emote = await self.parse_emote(context, emote, local=False) await context.send(f'{emote.name}: {emote.url}') - async def parse_emote(self, context, name_or_emote): + async def parse_emote(self, context, name_or_emote, *, local=True): match = utils.emote.RE_CUSTOM_EMOTE.match(name_or_emote) if match: - id = int(match.group('id')) - emote = discord.utils.get(context.guild.emojis, id=id) - if emote: - return emote + id = int(match['id']) + if local: + emote = discord.utils.get(context.guild.emojis, id=id) + if emote: + return emote + else: + return discord.PartialEmoji( + animated=bool(match['animated']), + name=match['name'], + id=int(match['id']), + ) name = name_or_emote return await self.disambiguate(context, name)