From 8ebb383a84ed40d21d4273913e302690180041f9 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 8 May 2024 14:38:39 -0400 Subject: [PATCH] fix(emojiinfo): fixed an issue with markdown --- emojiinfo/emojiinfo.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/emojiinfo/emojiinfo.py b/emojiinfo/emojiinfo.py index 5c0f652..08d7802 100644 --- a/emojiinfo/emojiinfo.py +++ b/emojiinfo/emojiinfo.py @@ -55,26 +55,34 @@ class EmojiInfo(commands.Cog): async def emoji(self, ctx: commands.Context, emoji: str, ephemeral: bool = False) -> None: """Retrieve information about an emoji.""" await ctx.defer(ephemeral=ephemeral) + emoji: discord.PartialEmoji = discord.PartialEmoji.from_str(value=emoji) + if emoji.is_unicode_emoji(): emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name) else: emoji_url = emoji.url + if emoji.id: emoji_id = f"{bold('ID:')} `{emoji.id}`\n" + markdown = f"`<{'a' if emoji.animated else ''}:{emoji.name}:{emoji.id}>`" else: emoji_id = "" + markdown = f"`{emoji}`" + string: str = ( - f"{bold('Name:')} {emoji}\n" + f"{bold('Name:')} {emoji.name}\n" f"{emoji_id}" f"{bold('Native:')} {emoji.is_unicode_emoji()}\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})" ) + 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.set_thumbnail(url=emoji_url) + await ctx.send(embed=embed, ephemeral=ephemeral) else: await ctx.send(content=string, ephemeral=ephemeral)