discord.js extracting emails from discord tag

I am wanting to extract someone's email from their discord tag. Im quite new to coding in this language and I am not sure how to go about doing this. I've been looking around and I found this line of code.

const email = client.user.email;

I have tried a bunch of codes and I am unable to understand what I am doing. So could someone help me please write me a code to extract an email from a discord account any way possible.

Thanks.

Upvotes: 0

Views: 9127

Answers (2)

Twilight
Twilight

Reputation: 370

You need to use Discord OAuth2 with email scope included in order to get the email of a discord user once the user authorizes access to your application.

There are a lot of scopes and some of them are being:

enter image description here

with that being said, there is no other way of getting email address of other users on discord.

Upvotes: 0

PerplexingParadox
PerplexingParadox

Reputation: 1196

It's currently not possible. From here, the answerer actually says that it's not possible to retrieve the email of other users. This is also shown on the discord.js documentation where none of the properties shown list the user's email.

Upvotes: 1

Related Questions