From 537b2edafa5cb96a3d131e922e3c4ee19b71c00d Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Wed, 8 May 2024 14:45:46 -0400 Subject: [PATCH] fix(emojiinfo): catch errors if the emoji is invalid --- emojiinfo/emojiinfo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emojiinfo/emojiinfo.py b/emojiinfo/emojiinfo.py index 08d7802..f6cdaae 100644 --- a/emojiinfo/emojiinfo.py +++ b/emojiinfo/emojiinfo.py @@ -59,7 +59,10 @@ class EmojiInfo(commands.Cog): emoji: discord.PartialEmoji = discord.PartialEmoji.from_str(value=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: emoji_url = emoji.url