Welp unexpected token error(again)

im getting an error named unexpected token and there is no bug anywhere it happened to me before but i solve that.(i deleted the channel that my bot spams random things and it get stickbugged)
heres my
index.js
const Discord = require(‘discord.js’);
const client = new Discord.Client();
const id = “this id doesnt care bout you”;

client.on(‘ready’, () => {
let spamNum = 0;
let rand = (Math.round(Math.random() * 1000))
setInterval(function() {
if (spamNum === 0 && open === “yea”) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 1;
} else if (spamNum === 1) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 2;
}
else if (spamNum === 2) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 3;
}
else if (spamNum === 3) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 4;
}
else if (spamNum === 4) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
}
else if (spamNum === 5) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 0
}

}, 1 * 1000);

});

client.login(process.env.token);
here is my package.json
{
“name”: “batunun spam botu”,
“version”: “2.0.3”,
“description”: “”,
“main”: “node index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”,
“start”: “node index.js”
},
“engines”: {
“node”: “8.4.0”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/An-Idiots-Guide/guidebot.git”
},
“author”: “SelimEminSStudios”,
“license”: “MIT”,
“bugs”: {
“url”: “”
},
“homepage”: “”,
“dependencies”: {
“discord.js”: “^11.5.1”,
“enmap”: “^4.8.6”,
“express”: “^4.16.4”,
“fs”: “^0.0.2”,
“isgd”: “^1.1.3”,
“moment”: “^2.24.0”,
“moment-duration-format”: “^2.2.2”,
“quick.db”: “^6.3.2”,
“random-puppy”: “^1.1.0”,
“snekfetch”: “^4.0.4”
}
}
procfile:worker: node index.js
watch.json
{
“install”: {
“include”: [
“^package\.json$”,
“^\.env$”
]
},
“restart”: {
“exclude”: [
“^public/”,
“^dist/”
],
“include”: [
“\.js$”,
“\.json”
]
},
“throttle”: 900000
}

Why do people don’t wrap their code in code blocks?

Wrap it by hitting the backtick button three times (or grave accent)

The end should have three more backticks

<h1>
And now there is syntax highlighting from the wrapped code
</h1>

Could you possibly show your error?

const Discord = require(‘discord.js’);
const client = new Discord.Client();
const id = “this id doesnt care bout you”;

client.on(‘ready’, () => {
let spamNum = 0;
let rand = (Math.round(Math.random() * 1000))
setInterval(function() {
if (spamNum === 0 && open === “yea”) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 1;
} else if (spamNum === 1) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 2;
}
else if (spamNum === 2) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 3;
}
else if (spamNum === 3) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 4;
}
else if (spamNum === 4) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
}
else if (spamNum === 5) {
client.channels.get(id).send(Math.round(Math.random() * 1000000000000000000000000000))
spamNum = 0
}

}, 1 * 1000);
});

client.login(process.env.token);
{
“name”: “batunun spam botu”,
“version”: “2.0.3”,
“description”: “”,
“main”: “node index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”,
“start”: “node index.js”
},
“engines”: {
“node”: “8.4.0”
},
“repository”: {
“type”: “git”,
“url”: “git+https://github.com/An-Idiots-Guide/guidebot.git”
},
“author”: “SelimEminSStudios”,
“license”: “MIT”,
“bugs”: {
“url”: “”
},
“homepage”: “”,
“dependencies”: {
“discord.js”: “^11.5.1”,
“enmap”: “^4.8.6”,
“express”: “^4.16.4”,
“fs”: “^0.0.2”,
“isgd”: “^1.1.3”,
“moment”: “^2.24.0”,
“moment-duration-format”: “^2.2.2”,
“quick.db”: “^6.3.2”,
“random-puppy”: “^1.1.0”,
“snekfetch”: “^4.0.4”
}
}
procfile:worker: node index.js
watch.json
{
“install”: {
“include”: [
“^package\.json$”,
“^\.env$”
]
},
“restart”: {
“exclude”: [
“^public/”,
“^dist/”
],
“include”: [
“\.js$”,
“\.json”
]
},
“throttle”: 900000
}

I think you might want to use process.env.TOKEN instead? I don’t remember if shell variables are case sensitive.

btw Moment.js has been deprecated - switch to Day.js. It might take a little time to change your code but it downloads much faster.

procfile is it’s own file and watch.json is it’s own file.

Procfile is a Heroku-specific file.

From my experience with environment variables, they are case sensitive.

3 Likes