Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
prajesh8484 authored Mar 29, 2023
1 parent a3f5753 commit ad58bdd
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,32 @@ async def schedule_daily_message():

await channel.send("Good Morning")


@bot.slash_command(name="userinfo", description="Get detailed information about a user.")
async def userinfo(ctx: nextcord.InteractionType, user: nextcord.Member = None):
if user is None:
user = ctx.user

# Get information about the user
username = str(user)
created_at = user.created_at.strftime("%Y-%m-%d \n*%H:%M:%S* UTC")
joined_at = user.joined_at.strftime("%Y-%m-%d \n*%H:%M:%S* UTC")
roles = [role.mention for role in user.roles if role != ctx.guild.default_role]
if len(roles) == 0:
roles = ["None"]
user_id = str(user.id)
avatar_url = user.avatar.url


embed = nextcord.Embed(title="User Information", color=0x00ff00)
embed.set_thumbnail(url=avatar_url)
embed.add_field(name="Username", value=username, inline=False)
embed.add_field(name="Account Created On", value=created_at, inline=False)
embed.add_field(name="Joined This Server On", value=joined_at, inline=False)
embed.add_field(name="Roles", value=", ".join(roles), inline=False)
embed.add_field(name="Status", value=user.status, inline=False)
embed.add_field(name="User ID", value=user_id, inline=False)
embed.add_field(name="Activity", value=user.activity, inline=False)
await ctx.send(embed=embed)


bot.run("YOUR_BOT_TOKEN")

0 comments on commit ad58bdd

Please sign in to comment.