fix(emojiinfo): catch errors if the emoji is invalid

This commit is contained in:
Seaswimmer 2024-05-08 14:45:46 -04:00
parent 8ebb383a84
commit 537b2edafa
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -59,7 +59,10 @@ class EmojiInfo(commands.Cog):
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) try:
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
except Exception:
await ctx.send("Please provide a valid emoji!", ephemeral=ephemeral)
else: else:
emoji_url = emoji.url emoji_url = emoji.url