fix(emojiinfo): fixed an issue with markdown
This commit is contained in:
parent
1ed1eb2681
commit
8ebb383a84
1 changed files with 10 additions and 2 deletions
|
@ -55,26 +55,34 @@ class EmojiInfo(commands.Cog):
|
||||||
async def emoji(self, ctx: commands.Context, emoji: str, ephemeral: bool = False) -> None:
|
async def emoji(self, ctx: commands.Context, emoji: str, ephemeral: bool = False) -> None:
|
||||||
"""Retrieve information about an emoji."""
|
"""Retrieve information about an emoji."""
|
||||||
await ctx.defer(ephemeral=ephemeral)
|
await ctx.defer(ephemeral=ephemeral)
|
||||||
|
|
||||||
emoji: discord.PartialEmoji = discord.PartialEmoji.from_str(value=emoji)
|
emoji: discord.PartialEmoji = discord.PartialEmoji.from_str(value=emoji)
|
||||||
|
|
||||||
if emoji.is_unicode_emoji():
|
if emoji.is_unicode_emoji():
|
||||||
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
|
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
|
||||||
else:
|
else:
|
||||||
emoji_url = emoji.url
|
emoji_url = emoji.url
|
||||||
|
|
||||||
if emoji.id:
|
if emoji.id:
|
||||||
emoji_id = f"{bold('ID:')} `{emoji.id}`\n"
|
emoji_id = f"{bold('ID:')} `{emoji.id}`\n"
|
||||||
|
markdown = f"`<{'a' if emoji.animated else ''}:{emoji.name}:{emoji.id}>`"
|
||||||
else:
|
else:
|
||||||
emoji_id = ""
|
emoji_id = ""
|
||||||
|
markdown = f"`{emoji}`"
|
||||||
|
|
||||||
string: str = (
|
string: str = (
|
||||||
f"{bold('Name:')} {emoji}\n"
|
f"{bold('Name:')} {emoji.name}\n"
|
||||||
f"{emoji_id}"
|
f"{emoji_id}"
|
||||||
f"{bold('Native:')} {emoji.is_unicode_emoji()}\n"
|
f"{bold('Native:')} {emoji.is_unicode_emoji()}\n"
|
||||||
f"{bold('Animated:')} {emoji.animated}\n"
|
f"{bold('Animated:')} {emoji.animated}\n"
|
||||||
f"{bold('Markdown:')} `:{emoji.name}:`\n"
|
f"{bold('Markdown:')} {markdown}\n"
|
||||||
f"{bold('URL:')} [Click Here]({emoji_url})"
|
f"{bold('URL:')} [Click Here]({emoji_url})"
|
||||||
)
|
)
|
||||||
|
|
||||||
if await ctx.embed_requested():
|
if await ctx.embed_requested():
|
||||||
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await ctx.embed_color)
|
embed = embed = discord.Embed(title="Emoji Information", description=string, color = await self.fetch_primary_color(emoji_url) or await ctx.embed_color)
|
||||||
embed.set_thumbnail(url=emoji_url)
|
embed.set_thumbnail(url=emoji_url)
|
||||||
|
|
||||||
await ctx.send(embed=embed, ephemeral=ephemeral)
|
await ctx.send(embed=embed, ephemeral=ephemeral)
|
||||||
else:
|
else:
|
||||||
await ctx.send(content=string, ephemeral=ephemeral)
|
await ctx.send(content=string, ephemeral=ephemeral)
|
||||||
|
|
Loading…
Reference in a new issue