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:\SourceTree\discord.js\00_get_server_channel_list\node_modules\discord.js\src\client\websocket\WebSocketManager.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?
If you are making a discord bot The token you get from that video is your user token, not your bots token. To get your bots token go to https://discord.com/developers/applications Go to your Bots Application > Bot Tab on the left > Reset Token > Copy Token
If you dont already have an application press New Application, Name it > Bot tab on the left > Build A Bot > Reset Token > Copy Token
https://www.writebots.com/discord-bot-token/ Read Through this if ur having trouble