Last commit of the night i think i added /avatar and /whois

main
supopur 2 years ago
parent d005f0fbef
commit 814085c496

@ -103,6 +103,37 @@ class EssentialCommands(commands.Cog):
embed = discord.Embed(title="Server Unlocked", description="All channels have been unlocked.") embed = discord.Embed(title="Server Unlocked", description="All channels have been unlocked.")
await ctx.followup.send(embed=embed) 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) @commands.slash_command(guild_ids=guild_ids)
@option('title', description="The biggest text.", required=True) @option('title', description="The biggest text.", required=True)
@option('content', description="The actuall text to put in the embed.", 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) await ctx.send(embed=embed)
def setup(bot): def setup(bot):
bot.add_cog(EssentialCommands(bot)) bot.add_cog(EssentialCommands(bot))

Loading…
Cancel
Save