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:
parent
48f17191a2
commit
8e4e236d2b
1 changed files with 13 additions and 6 deletions
|
@ -531,16 +531,23 @@ class Emotes(commands.Cog):
|
||||||
|
|
||||||
emote: the emote to embiggen.
|
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}')
|
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)
|
match = utils.emote.RE_CUSTOM_EMOTE.match(name_or_emote)
|
||||||
if match:
|
if match:
|
||||||
id = int(match.group('id'))
|
id = int(match['id'])
|
||||||
emote = discord.utils.get(context.guild.emojis, id=id)
|
if local:
|
||||||
if emote:
|
emote = discord.utils.get(context.guild.emojis, id=id)
|
||||||
return emote
|
if emote:
|
||||||
|
return emote
|
||||||
|
else:
|
||||||
|
return discord.PartialEmoji(
|
||||||
|
animated=bool(match['animated']),
|
||||||
|
name=match['name'],
|
||||||
|
id=int(match['id']),
|
||||||
|
)
|
||||||
name = name_or_emote
|
name = name_or_emote
|
||||||
return await self.disambiguate(context, name)
|
return await self.disambiguate(context, name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue