fix(emojiinfo): fixed formatting

This commit is contained in:
Seaswimmer 2024-05-08 14:34:28 -04:00
parent 80dcfea95e
commit a02a7ab3d7
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -7,7 +7,7 @@ from colorthief import ColorThief
from red_commons.logging import RedTraceLogger, getLogger from red_commons.logging import RedTraceLogger, getLogger
from redbot.core import commands from redbot.core import commands
from redbot.core.bot import Red from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import humanize_list from redbot.core.utils.chat_formatting import bold, humanize_list
class EmojiInfo(commands.Cog): class EmojiInfo(commands.Cog):
@ -60,13 +60,17 @@ class EmojiInfo(commands.Cog):
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:
emoji_id = f"{bold("ID:")} `{emoji.id}`\n"
else:
emoji_id = ""
string: str = ( string: str = (
f"Name: {emoji}\n" f"{bold("Name:")} {emoji}\n"
f"ID: {emoji.id}\n" if emoji.id else "" f"{emoji_id}"
f"Native: {emoji.is_unicode_emoji()}\n" f"{bold("Native:")} {emoji.is_unicode_emoji()}\n"
f"Animated: {emoji.animated}\n" f"{bold("Animated:")} {emoji.animated}\n"
f"Markdown: `:{emoji.name}:`\n" f"{bold("Markdown:")} `:{emoji.name}:`\n"
f"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)