To Obtain User Information by Identification on discord.py

Asked 2 years ago, Updated 2 years ago, 142 views

How do I get user information by identifying myself?

python discord

2022-09-29 22:16

2 Answers

@commands.command(name='test')
async def test (self, ctx, member:discord.Member):
  wait ctx.send(embed=discord.Embed(title=f'{member} Details', description='Description')

*Note: This is how to write when using the command framework

Description:
·member: discord.Member makes it easy by adding a method called discordMember in advance to the argument
That's all ( )
In addition to this, member.avatar.url gets the URL of the icon.
See API Reference for more information


2022-09-29 22:16

@client.command()
async def userinfo(ctx, userid=None):
    if userid==None:
        userid=str(ctx.author.id)
    try : user = wait client.fetch_user(userid)
    exception: wait ctx.reply("No user is affected by the specified id.")
    wait ctx.reply("username:" + user.name.replace("@", "@")))


2022-09-29 22:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.