Tried change the token parameters and still got this issue, i’ve only started the bot and here is what i got, never saw this happened before.
r.js:136
const invalidToken = new DiscordjsError(ErrorCodes.TokenInvalid);
^
Error [TokenInvalid]: An invalid token was provided.
at WebSocketManager.connect (C:UsersTrevorDesktopNeuroDiscordnode_modulesdiscord.jssrcclientwebsocketWebSocketManager.js:136:26)
at Client.login (C:UsersTrevorDesktopNeuroDiscordnode_modulesdiscord.jssrcclientClient.js:228:21)
at Object. (C:UsersTrevorDesktopNeuroDiscordindex.js:18:8)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: ‘TokenInvalid’
}
The code that i’m using:
require('dotenv/config')
const { Client, Events, GatewayIntentBits } = require("discord.js")
const { OpenAI } = require("openai")
require("dotenv/config")
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
})
client.once(Events.ClientReady, (ClientUser) =>{
console.log(`logged in as ${clientUser.user.tag}`)
})
client.login(process.env.BOT_TOKEN)
Node.js v20.12.2
tried to repeat all the stuff was in tutorial and thought that is gonna run, but still got an Error
Trevor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.