1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

em/big: support any emote, not just emotes in the server

This commit is contained in:
io mintz 2021-06-03 07:58:43 +00:00
parent 48f17191a2
commit 8e4e236d2b

View file

@ -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)