it keeps saying Error [TOKEN_INVALID]: An invalid token was provided.
at WebSocketManager.connect (/home/gamingboikid/discordbot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:133:26)
at Client.login (/home/gamingboikid/discordbot/node_modules/discord.js/src/client/Client.js:223:21) {
[Symbol(code)]: ‘TOKEN_INVALID’
} .
how do i get rid of it and this is my code
const { Client, Collection, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_VOICE_STATES] });
client.once("ready", (c) => {
console.log(`Ready, Logged in as d`);
});
try {
client.login("");
} catch (error) {
console.log(error)
}
i will not show my token
new coding but still didnt work
2
Answers
There is nothing wrong with your code, you just need to reset your Discord bot token so you can obtain a new token. Go to https://discord.com/developers/applications, select your bot, go to the Bot section, click on "Reset Token", and then "Yes, do it!".
Please make sure to insert the bot token in "":
client.login("INSERT TOKEN HERE")
You can get the client token of the bot by going to https://discord.com/developers/applications then selecting your application, and adding a bot through the Bot tab. Copy the Token of the bot, and paste it in the
INSERT TOKEN HERE
Your new code: