From 814085c4963c03c7128716d0b46adb7a608cda75 Mon Sep 17 00:00:00 2001 From: supopur Date: Fri, 17 Mar 2023 22:28:33 +0100 Subject: [PATCH] Last commit of the night i think i added /avatar and /whois --- commands.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/commands.py b/commands.py index 285b75d..249a0d0 100644 --- a/commands.py +++ b/commands.py @@ -103,6 +103,37 @@ class EssentialCommands(commands.Cog): embed = discord.Embed(title="Server Unlocked", description="All channels have been unlocked.") await ctx.followup.send(embed=embed) + + @commands.slash_command(guild_ids=guild_ids) + @option('user', description="The username of the user you want the avatars picture incl 1234 numbers", required=True) + async def avatar(self, ctx, member: discord.Member): + try: + avatar_url = member.avatar.url + except: + await ctx.respond(f"Unable to get {member.name}'s avatar as he probably has a default avatar.") + else: + await ctx.respond(f"{member.name}'s avatar: {avatar_url}") + + + @commands.slash_command(guild_ids=guild_ids) + @option('member', description="The username of the user to run the check on.") + async def whois(self, ctx, member: discord.Member = None): + member = member or ctx.author + roles = [role.mention for role in member.roles[1:]] + if not roles: + roles = ["None"] + embed = discord.Embed(title=f"{member.display_name}'s Info", color=member.color) + try: + embed.set_thumbnail(url=member.avatar.url) + except: pass + embed.add_field(name="Name", value=str(member), inline=False) + embed.add_field(name="ID", value=member.id, inline=False) + embed.add_field(name="Account Created", value=member.created_at.strftime("%d/%m/%Y %H:%M:%S"), inline=False) + embed.add_field(name="Join Date", value=member.joined_at.strftime("%d/%m/%Y %H:%M:%S"), inline=False) + embed.add_field(name="Roles", value=" ".join(roles), inline=False) + await ctx.send(embed=embed) + + @commands.slash_command(guild_ids=guild_ids) @option('title', description="The biggest text.", required=True) @option('content', description="The actuall text to put in the embed.", required=True) @@ -124,6 +155,8 @@ class EssentialCommands(commands.Cog): await ctx.send(embed=embed) + + def setup(bot): bot.add_cog(EssentialCommands(bot))