I’m having an issue with the discord bot code where it says “unexpected token.” I don’t know what to do to fix this, please help me.
Downgrade discordjs to version 12 or use a supported version of node, which might not be possible depending on the platform. It is on Replit?
yeah this is on replit, where do i download version 12
From the Shell tab run npm i discord.js@12.5.3 or just change the version in package.json and run it to update the packages.
thank you, it worked!!!
Now i have this issue
TypeError: Cannot read property 'TOKEN' of undefined
at /home/runner/Gods-Blessing/index.js:14:26
at Script.runInContext (vm.js:130:18)
at Object.<anonymous> (/run_dir/interp.js:209:20)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
what’s your code? it’s impossible to say what’s causing that without seeing your code.
Code is the same
const Discord = require("discord.js")
const client = new Discord.Client()
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`)
})
client.on("message", msg => {
if (msg.content === "тян") {
msg.reply("Шо те надо")
}
})
client.login(process.enc.TOKEN)
What is enc? Watch out for typos ![]()
It is not the point. I’ve wrote my problem above
This is the entire point. enc does not exist, therefore the runtime does not know what process.enc.TOKEN is:
process.encisundefined- => runtime cannot read property
TOKENofundefined:
Hope this clarifies
If you are still stuck, I recommend opening a new topic with as much detail as necessary to get help.
ok thanks. Now i got it 
4 posts were split to a new topic: Discord: An invalid token was provided
2 posts were merged into an existing topic: Discord: An invalid token was provided
