Reputation: 2826
The code below lets me get every information about a user in discord. However, I couldn't find a way to get the emails of users. Is it deprecated? Can someone help me with the code?
client.on('ready', () => {
console.log(`logged in as ${client.user.username}`);
var Count;
for(Count in client.users.array()){
var User = client.users.array()[Count];
/* client.sendMessage(User, msg); */
//userName += User.username + "#" + User.discriminator + '\n';
}
})
Upvotes: 3
Views: 32521
Reputation: 1962
According to the latest stable docs, you can use user.email to retrieve the Email from a user account. Seeing as you're not using email anywhere in you're code, I'm not sure what you're asking about when it comes to "can someone help me with the code". I will provide an example, however, on how to retrieve the value.
const email = client.user.email; // Will return null if no email is available.
From my tests, it seems that the Email variable only shows up for user accounts, meaning if you're trying to retrieve the Email of a bot account, it will return null. If you're trying to retrieve the Email of other users, though, that is not a capability provided by the Discord API.
Upvotes: 2