adding user support
This commit is contained in:
parent
a7c42594b5
commit
9ab8e93c05
1 changed files with 18 additions and 11 deletions
|
@ -341,29 +341,36 @@ class Utils(commands.Cog):
|
||||||
return await self._amongus(ctx, map, True)
|
return await self._amongus(ctx, map, True)
|
||||||
|
|
||||||
@commands.command(name='whois')
|
@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]"""
|
"""Affiche les infos sur l'utilisateur.\n ➡ Syntaxe: {PREFIX}whois [user]"""
|
||||||
_, fromSlash, user = isSlash(user)
|
_, fromSlash, user = isSlash(user)
|
||||||
|
|
||||||
if len(user) <= 1:
|
if len(user) <= 1:
|
||||||
if user == ():
|
if user == ():
|
||||||
user = [ctx.author]
|
user = [ctx.author]
|
||||||
nom = f"{user[0].name}#{user[0].discriminator}"
|
else:
|
||||||
if user[0].nick:
|
user = user[0]
|
||||||
nom = f"{user[0].nick} ({user[0].name}#{user[0].discriminator})"
|
member_obj = ctx.guild.get_member(user.id)
|
||||||
embed = discord.Embed(color = discord.Colour.random()).set_author(name = nom, icon_url = user[0].avatar_url)
|
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:
|
if fromSlash != True:
|
||||||
await addReaction(ctx.message, 0)
|
await addReaction(ctx.message, 0)
|
||||||
return await ctx.send(embed = embed)
|
return await ctx.send(embed = embed)
|
||||||
|
|
Reference in a new issue