discord.js how to get a Discord username from a user ID

bobby the pikachu

im programming a Discord bot and I would like to get Discord usernames from user IDs so I know who voted for my bot ive I've tried that using Google to find the answer but it doesn't really show me

Dorian349

You need to collect the user from your client.

const Discord = require("discord.js");
const client = new Discord.Client();

//This return the username of the specified user ID.
const user = client.users.cache.get("USERID");
if (!user) return console.log("Couldn't find the user");
console.log(user.username)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Get Name of User From ID - Discord JDA

Discord Python - How to get the username from the user ID?

Obtaining username from user id | discord.py

How to get user id from oauth on discord

How to get specific member username with discord.js

Get Discord user ID from username

How to get username of user not in Discord guild?

Discord.js how to get user id just from the username

Cannot get the id of a username Discord JS

How to get Member object from user id discord.py

How to get User object from id discord.py

How to get the ID of any user given the Username in Discord?

How to get user ID from Discord username?

Discord.JS get member from user ID

How do I get a user from their discord tag in Discord JDA?

Get User Username - discord.js

How to get user Id from username in facebook

Discord.js how can i get user nickname using the user's id

Discord.js how to ping a user with their user id

Get voice channel id from user id discord.py

How to get a mentioned user's id from a message | Discord.js

How to get Discord member username from user id in python and move to another channel?

get id from displayname Discord JS

Discord.js | Displaying a username from an ID returns undefined

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

Discord.js: How to find server member (to assign roles in Discord) by Discord User-ID?

Discord.js - Cannot get user or member by username from client object

How to get user id of interaction with Discord.JS

discord.js - How to get user Display Name from User Profile of user

TOP Ranking

HotTag

Archive