I have a trouble about my discord bot

im using uptimerobot.com to create my first discord bot, but it does not work well. i really dont have no idea to solve this problem. the following picture shows how i use uptimerobot.com

Hey @33333-33333,

Welcome to Glitch!

Are you seeing any errors in the Glitch Logs?


according to the logs, i got errors 5~6 hours ago (above the line)
however, i did not receive any errors 1~4 hours ago. (note that i did not change anything)


when i clicked “jump to”, i was made to move the end of the code. i dont know why

This error usually happens when your Discord bot token is invalid. Can you try generating a new Discord token and using it?

although i regenerate my token and paste it env, it could not work well…
plus, no error is in logs

Hey @33333-33333,

Can you provide the project name so that I can take a look? And it would be better to move all your tokens, even commented ones to the .env file.

url deleted
here is the link of it

Ehhh…the project is set to private! Maybe you can make it public for a while…

sry i made it public

Hey @33333-33333,

The error was caused because a Discord bot token was not provided. And the token was not provide because you referred it in the .env in a wrong way. To fix the issue, in line 1 of your main.js, change the statement to:

const TOKEN = process.env.DISCORD_BOT_TOKEN;

because you declared the Discord token as DISCORD_BOT_TOKEN, not simply TOKEN in the .env file.

And make sure you have the following statement at the bottom of your main.js:

client.login(TOKEN);

That should fix the issue :smiley:

Happy Glitching!

i tried your solution but it still does not work :(((((

here is the link

When I remixed your project, it never stopped loading. The circle will keep on moving next to the Tools button. There might be something wrong with the code.

could you tell me where it is wrong?

for the infinite loading part, add this to the top of bot.js or index.js or wherever the main part of your bot is:

const http = require(‘http’);
const express = require(‘express’);
const app = express();
app.use(express.static(‘public’));
app.get("/", (request, response) => {
console.log(Date.now() + " ping received!");
response.sendStatus(200);
// The file “index.html” is being sent to the server, which will be rendered once someone has visited the route /
response.sendFile(__dirname + ‘/public/’);
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(http://[PROJECT NAME HERE].glitch.me/);
}, 280000);

let me know if that works for the infinitely loading circle part.

1 Like


oh error. i guess the code is correct…

What is your discord tag, could you add me, and dm me your project invite link so i could take a look at your errors, and possibly help you?

i know the errors, you gotta replace the pasted ' with a normal ’

ohh. right. I didn’t catch that when i looked at the screenshot above :sweat_smile:

1 Like
const http = require("http");
const express = require("express");
const app = express();
app.use(express.static("public"));
app.get("/", (request, response) => {
console.log(Date.now() + " ping received!");
response.sendStatus(200);
// The file “index.html” is being sent to the server, which will be rendered once someone has visited the route  "/"
response.sendFile(__dirname + "/public/");
});
app.listen(process.env.PORT);
setInterval(() => {
http.get("http://[PROJECT NAME HERE].glitch.me/" );
}, 280000);