I’m currently making a discord bot, using glitch to host.
The bot runs successfully but only if I put my token in the config file rather than the .env file which isnt very secure.
Everytime I try and run the bot while I have the following code:
config.json
{
“token”: process.env.TOKEN,
“prefix”: “.”,
“ownerID”: process.env.OWNER
}
.env
TOKEN=“random token”,
OWNER=“random ID”,
PROJECT_DOMAIN=“random-name”
I get a Syntax error that I can’t seem to solve saying:
SyntaxError: /app/config.json: Unexpected token p in JSON at position 13
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (module.js:592:27)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object. (/app/server.js:8:16)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
module.js:595
throw err;
^
SyntaxError: /app/config.json: Unexpected token p in JSON at position 13
Any idea what I’m doing wrong?