Good evening, I just want to fetch a user with the id, but when I replace the id with a variable it doesn't work anymore. Does anyone have any idea?
working:
client.users.fetch("765574410119282749").then(async (user) => {console.log(user)})
not working:
var id = "765574410119282749"
client.users.fetch(id).then(async (user) => {console.log(user)})
i use discord.js V13
CodePudding user response:
To make your code working you need to use client.users.cache.get("id")
, so your code will look like this:
var id = "765574410119282749"
let user = client.users.cache.get(id);
console.log(user)