Skip to content

Commit

Permalink
Merge pull request #15 from Daste745/ephemeral-errors
Browse files Browse the repository at this point in the history
Make command error messages ephemeral
  • Loading branch information
Daste745 authored Mar 10, 2023
2 parents 0070418 + 43d0f7f commit 2465146
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions nagatoro/extensions/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@ async def avatar(
if profile == "server":
if itx.guild is None:
return await itx.response.send_message(
f"The server profile is only supported on servers"
f"The server profile is only supported on servers",
ephemeral=True,
)

elif isinstance(user, User):
return await itx.response.send_message(
f"{user} is not a member of this server"
f"{user} is not a member of this server",
ephemeral=True,
)

elif isinstance(user, Member):
if user.guild_avatar is None:
return await itx.response.send_message(
f"{user} doesn't have a server avatar"
f"{user} doesn't have a server avatar",
ephemeral=True,
)
else:
avatar = user.guild_avatar
Expand All @@ -57,7 +60,8 @@ async def avatar(

if format == "gif" and not avatar.is_animated():
return await itx.response.send_message(
f"{user} doesn't have an animated avatar, please use a different format"
f"{user} doesn't have an animated avatar, please use a different format",
ephemeral=True,
)

elif format is None:
Expand Down Expand Up @@ -86,11 +90,15 @@ async def banner(
user = await self.bot.fetch_user(user.id)

if user.banner is None:
return await itx.response.send_message(f"{user} doesn't have a banner")
return await itx.response.send_message(
f"{user} doesn't have a banner",
ephemeral=True,
)

if format == "gif" and not user.banner.is_animated():
return await itx.response.send_message(
f"{user} doesn't have an animated banner, please use a different format"
f"{user} doesn't have an animated banner, please use a different format",
ephemeral=True,
)

if format is None:
Expand Down

0 comments on commit 2465146

Please sign in to comment.