adding user support

This commit is contained in:
Mylloon 2021-08-23 12:59:11 +02:00
parent a7c42594b5
commit 9ab8e93c05

View file

@ -341,29 +341,36 @@ class Utils(commands.Cog):
return await self._amongus(ctx, map, True)
@commands.command(name='whois')
async def _whois(self, ctx, *user: discord.Member):
async def _whois(self, ctx, *user: discord.User):
"""Affiche les infos sur l'utilisateur.\n ➡ Syntaxe: {PREFIX}whois [user]"""
_, fromSlash, user = isSlash(user)
if len(user) <= 1:
if user == ():
user = [ctx.author]
nom = f"{user[0].name}#{user[0].discriminator}"
if user[0].nick:
nom = f"{user[0].nick} ({user[0].name}#{user[0].discriminator})"
embed = discord.Embed(color = discord.Colour.random()).set_author(name = nom, icon_url = user[0].avatar_url)
else:
user = user[0]
member_obj = ctx.guild.get_member(user.id)
if member_obj: user = member_obj
nom = f"{user.name}#{user.discriminator}"
if member_obj:
if user.nick:
nom = f"{user.nick} ({user.name}#{user.discriminator})"
embed = discord.Embed(color = discord.Colour.random()).set_author(name = nom, icon_url = user.avatar_url)
embed.add_field(name = "ID", value = user[0].id)
embed.add_field(name = "ID", value = user.id)
embed.add_field(name = "Compte créé le", value = timestampScreen(user[0].created_at))
embed.add_field(name = "Compte créé le", value = timestampScreen(user.created_at))
embed.add_field(name = "Âge du compte", value = ageLayout(getAge(user[0].created_at)))
embed.add_field(name = "Âge du compte", value = ageLayout(getAge(user.created_at)))
embed.add_field(name = "Mention", value = user[0].mention)
embed.add_field(name = "Mention", value = user.mention)
embed.add_field(name = "Serveur rejoint le", value = timestampScreen(user[0].joined_at))
if member_obj:
embed.add_field(name = "Serveur rejoint le", value = timestampScreen(user.joined_at))
embed.add_field(name = "Est sur le serveur depuis", value = ageLayout(getAge(user[0].joined_at)))
if member_obj:
embed.add_field(name = "Est sur le serveur depuis", value = ageLayout(getAge(user.joined_at)))
if fromSlash != True:
await addReaction(ctx.message, 0)
return await ctx.send(embed = embed)