discord.py: Can you get the name of a user that's not in a server with your bot from their id?

Isaac

I have seen discord bots that have the ability to get info(like the name) of users from their id that aren't even in any servers with that bot, and I was wondering if this is possible in discord.py. I know about

client.get_user(id)

but if the user isn't in any servers with the bot it won't work. Can you do this in discord.py?

BrainDead

You can use the API call fetch_user

user = await client.fetch_user(user_id)

Stick to that link (official documentation) and you won't be wasting time on trivial setbacks like this.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do you make a bot transfer it's ownership(of a discord server) to a user using the discord.py API?

Discord bot get user id by only name

Can I get discord server name without id or convert it from id to name - discord.JS

Get Name of User From ID - Discord JDA

Discord.py get server name or id by server link

Is it possible to get a user object or their id from their name and tag? [Discord.py]

discord.py | how to get list user banned name and id

Get a user that is not on the server by their name and discriminator (discord.py)

Get voice channel id from user id discord.py

How can I get the name of a role with the role's ID in Discord.py?

discord.py: How to get the first letter of a user's name?

How can I get an member object from the user_id in discord.py

How to get a user's avatar with their id in discord.py?

Get user's avatar with their ID in discord.py

How to get Member object from user id discord.py

How to get User object from id discord.py

How to get user id from nickname in discord.py?

Discord.py: Can't get mentioned user's information from DM

Discord.js How to get show your server member count from your bot

Discord.py how to get a server's id?

get_user(id) cant find user - returns None (self bot discord.py)

How can you check voice channel id that bot is connected to? (discord.py)

Cant get user name discord.py

How can I check if user id is already registered to the bot? [discord.py]

Discord.py: How do I get the User_ID of a "Bot" object?

Discord.py: Get user object with id

Get the ID of a discord channel with a bot with discord.py

How can I get the number of messages sent by a user in a discord server and store it in a list [Discord.py]

Discord.py: Obtaining user ID from username of member who doesn't share a guild with the bot