Skip to content

Commit ad58bdd

Browse files
authored
Update main.py
1 parent a3f5753 commit ad58bdd

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

main.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,32 @@ async def schedule_daily_message():
106106

107107
await channel.send("Good Morning")
108108

109-
109+
@bot.slash_command(name="userinfo", description="Get detailed information about a user.")
110+
async def userinfo(ctx: nextcord.InteractionType, user: nextcord.Member = None):
111+
if user is None:
112+
user = ctx.user
113+
114+
# Get information about the user
115+
username = str(user)
116+
created_at = user.created_at.strftime("%Y-%m-%d \n*%H:%M:%S* UTC")
117+
joined_at = user.joined_at.strftime("%Y-%m-%d \n*%H:%M:%S* UTC")
118+
roles = [role.mention for role in user.roles if role != ctx.guild.default_role]
119+
if len(roles) == 0:
120+
roles = ["None"]
121+
user_id = str(user.id)
122+
avatar_url = user.avatar.url
123+
124+
125+
embed = nextcord.Embed(title="User Information", color=0x00ff00)
126+
embed.set_thumbnail(url=avatar_url)
127+
embed.add_field(name="Username", value=username, inline=False)
128+
embed.add_field(name="Account Created On", value=created_at, inline=False)
129+
embed.add_field(name="Joined This Server On", value=joined_at, inline=False)
130+
embed.add_field(name="Roles", value=", ".join(roles), inline=False)
131+
embed.add_field(name="Status", value=user.status, inline=False)
132+
embed.add_field(name="User ID", value=user_id, inline=False)
133+
embed.add_field(name="Activity", value=user.activity, inline=False)
134+
await ctx.send(embed=embed)
135+
136+
110137
bot.run("YOUR_BOT_TOKEN")

0 commit comments

Comments
 (0)