Discord bot appearing offline in Discord itself

Hi my bot (the-zone-bot) keeps going offline in discord after 5 minutes. The bot is running fine and hasn’t shut down thanks to Uptimerobot, but whenever it goes offline in discord I have to rerun the bot to make it appear online. The bot is just supposed to be the first user for a friend’s user so it shouldn’t do anything except be online 24/7. Thanks in advanced.

1 Like

Have you made sure uptime robot is set up correctly, and have you check if uptime robot has downtime on their end?

It’s down right now but it wasn’t before posting this and testing it. It’s set to HTTP(S) and https://the-zone-bot.glitch.me/ so unless either of them are wrong then it’s set up correctly. I saw some others on the forum have similar problems, but most of the solutions were for it being down on Glitch, which my bot isn’t.

1 Like

Whenever I go to the link for your project, it have me a gateway timeout error 504, so maybe this has got something to do with your problem. Can you try seeing if this problem still happens when using Status Cake. Status cake is like uptime robot, and does the same thing, so if it does not work with Status Cake or uptime robot, then your project might have an error itself!

Okay so there was an error (it just didn’t want to tell until now) and I think I fixed it but now the project seems to be stuck loading. The weird thing is, is that the bot is online on discord. Uptime robot’s connection is timing out also.

1 Like

Can you please share your discord with me, as I would like to see this problem and to see what is happening to the bot in discord itself.

The uptime robot connection would be timing out because you have not set up an express for the bot to load the websites page, so this is normal as it is for a bot and not a website, you could use a simple express startup and an empty html file to be loaded, so then you would not get a timeout error.

Ok, In the discord server, I mentioned I would post this into here, incase others find it useful, just like you need it for!

var express = require('express');
var app = express();
var listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});
app.use(express.static('public'));
app.get('/', function(request, response) {
  response.sendFile(__dirname + '/index.html');
});

Put that code into the bot’s main file, then in the same folder as the main file, create a file named index.html. If you do not use a folder for the main file, then you do not need to put the index.html into a folder.
you can put anything you want into this index.html that you want to have shown on the link for the bot that uptime robot uses.

EDIT: Glad this solution has helped you, I hope that you are able to do everything you need now, and I hope that this can help others if needed!