How to cache and receive User Object

Hello, I'm currently trying to cache users by using
let test = client.users.cache
let test = client.users.cache
and i log it by:
test.forEach((ID, USER) => {
console.log(USER);
});
test.forEach((ID, USER) => {
console.log(USER);
});
How can i get the User object back instead of IDs?
8 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
adam
adamOP16mo ago
Latest discord.js version wym?
d.js docs
d.js docs16mo ago
method Collection#forEach() Executes a provided function once per each key/value pair in the Map, in insertion order.
adam
adamOP16mo ago
Alright now i get a log, how can i make it random pick?
d.js docs
d.js docs16mo ago
method Collection#random() Obtains unique random value(s) from this collection.
adam
adamOP16mo ago
And how can i make it ignore user if its a bot
d.js docs
d.js docs16mo ago
property User#bot Whether or not the user is a bot
adam
adamOP16mo ago
Alright thanks
Want results from more Discord servers?
Add your server