My final goal : I would like to get every single channels in every single guilds I belong to.
As a first step, created simple program that I identify that I am logged in as myself.
I first found my token via this video
In a nutshell the video instructs to get the token via
Chrome -> discord.com -> F12 -> Application -> Local Storage -> filter “token” -> click “Toggle device toolbar” -> voila
Threw it in .env as variable TOKEN=...
and my index.js is implemented as followings
const Discord = require("discord.js");
const dotenv = require("dotenv");
dotenv.config();
const client = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
]
});
client.on('ready', ()=> {
console.log(`Logged in as ${client.user.tag}`);
});
client.login(process.env.TOKEN);
However, when I run node index.js
I receive following errors
D:SourceTreediscord.js 0_get_server_channel_listnode_modulesdiscord.jssrcclientwebsocketWebSocketManager.js:129
const invalidToken = new Error(WSCodes[4004]);
^
Error [TOKEN_INVALID]: An invalid token was provided.
Is the token found in the video wrong?
Or is there something else I am doing wrong?