forked from cswimr/SeaCogs
fix(emojiinfo): add the PartialEmoji.from_str call to the try and except blocks
This commit is contained in:
parent
d126f1e6d3
commit
e59503829f
1 changed files with 5 additions and 7 deletions
|
@ -57,7 +57,7 @@ class EmojiInfo(commands.Cog):
|
||||||
if emoji.is_unicode_emoji():
|
if emoji.is_unicode_emoji():
|
||||||
try:
|
try:
|
||||||
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
|
emoji_url = await self.fetch_twemoji(unicode_emoji=emoji.name)
|
||||||
except Exception as e:
|
except IndexError as e:
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
emoji_url = emoji.url
|
emoji_url = emoji.url
|
||||||
|
@ -95,11 +95,10 @@ class EmojiInfo(commands.Cog):
|
||||||
"""Retrieve information about an emoji."""
|
"""Retrieve information about an emoji."""
|
||||||
await interaction.response.defer(ephemeral=ephemeral)
|
await interaction.response.defer(ephemeral=ephemeral)
|
||||||
|
|
||||||
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
||||||
string, emoji_url, = await self.get_emoji_info(emoji)
|
string, emoji_url, = await self.get_emoji_info(emoji)
|
||||||
except Exception:
|
except (IndexError, UnboundLocalError):
|
||||||
return await interaction.followup.send("Please provide a valid emoji!")
|
return await interaction.followup.send("Please provide a valid emoji!")
|
||||||
|
|
||||||
if await self.bot.embed_requested(channel=interaction.channel):
|
if await self.bot.embed_requested(channel=interaction.channel):
|
||||||
|
@ -113,11 +112,10 @@ class EmojiInfo(commands.Cog):
|
||||||
@commands.command(name="emoji")
|
@commands.command(name="emoji")
|
||||||
async def emoji(self, ctx: commands.Context, *, emoji: str) -> None:
|
async def emoji(self, ctx: commands.Context, *, emoji: str) -> None:
|
||||||
"""Retrieve information about an emoji."""
|
"""Retrieve information about an emoji."""
|
||||||
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
emoji: PartialEmoji = PartialEmoji.from_str(self, value=emoji)
|
||||||
string, emoji_url, = await self.get_emoji_info(emoji)
|
string, emoji_url, = await self.get_emoji_info(emoji)
|
||||||
except Exception:
|
except (IndexError, UnboundLocalError):
|
||||||
return await ctx.send("Please provide a valid emoji!")
|
return await ctx.send("Please provide a valid emoji!")
|
||||||
|
|
||||||
if await ctx.embed_requested():
|
if await ctx.embed_requested():
|
||||||
|
|
Loading…
Reference in a new issue