From 96679221f075d5cf4d7a50df80c6cf01bbc97791 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:47:42 +0530 Subject: [PATCH 1/2] Add `/avatar` command to let users see other user avatars --- cogs/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cogs/utils.py b/cogs/utils.py index 330469e..1d4ca1d 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -116,6 +116,19 @@ async def whoami(self, ctx: ApplicationContext, user: discord.User=None): localembed.add_field(name="Net worth", value=f"{currency.get_user_networth(user.id)} coins", inline=False) await ctx.respond(embed=localembed) + @commands.slash_command( + name="avatar", + description="Return a user's profile avatar." + ) + @option(name="user", description="Who's profile avatar do you want to see?", type=discord.User, default=None) + async def avatar(self, ctx: ApplicationContext, user: discord.User = None): + """Return a user's profile avatar.""" + if user is None: + user = ctx.author + localembed = discord.Embed(title=f"{user.display_name}'s Profile Avatar", color=discord.Color.random()) + localembed.set_image(url=user.avatar) + await ctx.respond(embed=localembed) + @commands.slash_command( name="profile", description="Shows basic stats about your isobot profile, or someone else's profile stats." From a7efefa0d37579ffc90076af174b8e13d2077701 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:53:57 +0530 Subject: [PATCH 2/2] Add avatar link for `/avatar` embed description --- cogs/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/utils.py b/cogs/utils.py index 1d4ca1d..98a267e 100644 --- a/cogs/utils.py +++ b/cogs/utils.py @@ -125,7 +125,7 @@ async def avatar(self, ctx: ApplicationContext, user: discord.User = None): """Return a user's profile avatar.""" if user is None: user = ctx.author - localembed = discord.Embed(title=f"{user.display_name}'s Profile Avatar", color=discord.Color.random()) + localembed = discord.Embed(title=f"{user.display_name}'s Profile Avatar", description=f"[avatar link]({user.avatar})", color=discord.Color.random()) localembed.set_image(url=user.avatar) await ctx.respond(embed=localembed)