[Discord] Bot Shutting Down


Create an interval that makes a get request to your project every 5 minutes.

Here is an example.

const http = require('http');
const express = require('express');
const app = express();

setInterval(() => {
}, 300000);

Discord bot uptime

the main reason we recommend using a third-party cron/uptime service in lieu of local settimeout calls is that local settimeouts will be reset if we, for some reason, have to restart the servers.


I would do a 280s interval so that there is a little leeway and the app doesn’t shut down an instant before pinging itself. If you use uptime robot as well as this, then the app should never have more than five minutes downtime (and then only when the client is reinstantiated as per jennschiffer's comment).


I did the steps of how to get it to work, but now everytime I am using a command, its answering 17 times…
Any help?

And btw, your discord invite link is expired.


The only reason your bot would be replying would be either you have 17 instances of client running, or you have setup the message handler multiple times.
The best bet is to reset your bot’s token and then try to run the bot and see if it still answers 17 times.

and regarding discord invite link, I though that I might be helping people out with glitch stuffs around discord, especially getting too busy with life, and also because there is a great team here to help out with any issues. :smiley:


Also check for any While/For loops that may be repeating the message


use uptime bot or something else
to make your code run 24/7


It would have been better if you had looked through all the replies in the thread.

Lately people are replying in random thread by just looking at the title and without looking at the replies.
(Not attacking you)

But I believe user should look through the post and all the replies before making a reply by just looking at the thread.

If you have a look into the replies, the issue was already solved.


your gitbook website broke, it’s on the legacy one that I cannot login too.


Its not broken, but instead taken down. Because the author of idoits-guide told me to take it down.
And also I am no-longer providing support for glitch over discord.
All because you can get awesome support out here.

So you can simply put your issue out as new thread (But first check if its already reported, solved and so on) and then you will get solution/answer real soon.


I have a follow up question to your guide above. I read through post and didn’t see anything related. I followed your steps to the letter, and my bot seems to be timing out[1]? In discord, bot works just fine[2], but when i go to the bot’s page on glitch https:// tigglesbot.glitch. me/ it appears to just time out, and nothing seems to load onto the page. Also, it is telling me that there must be an error in my code or something, which also does not seem to be the case when I check my logs[3]. Any help here? End goal is to just keep this bot online without me having to run nodejs locally every time.

1 - https://cl.ly/3R0d413J0B0t
2 - https://cl.ly/2w3f0a1g1v0l
3 -

ty in advance!


You’re not listening on a port and haven’t defined any routes in your app. It will continue to show the loading icon until that’s resolved. Try adding the following toward the top of index.js

var express = require('express');
var app = express();
app.get("/", (request, response) => {

You can then use the url https://tigglesbot.glitch.me in uptimerobot or another service to keep the bot awake.


Here’s the link to my code: https://glitch.com/edit/#!/lying-bus

When I try to add this code to my project at the top of bot.js I get the following error:


  throw er; // Unhandled 'error' event


Error: listen EADDRINUSE :::3000

at Object._errnoException (util.js:992:11)

at _exceptionWithHostPort (util.js:1014:20)

at Server.setupListenHandle [as _listen2] (net.js:1355:14)

at listenInCluster (net.js:1396:12)

at Server.listen (net.js:1480:7)

at Function.listen (/rbd/pnpm-volume/c8e7a0c5-ef98-4267-b4c0-3c915c8f695c/node_modules/.registry.npmjs.org/express/4.16.3/node_modules/express/lib/application.js:618:24)

at Object. (/app/bot.js:187:5)

at Module._compile (module.js:652:30)

at Object.Module._extensions..js (module.js:663:10)

at Module.load (module.js:565:32)

at tryModuleLoad (module.js:505:12)

at Function.Module._load (module.js:497:3)

at Function.Module.runMain (module.js:693:10)

at startup (bootstrap_node.js:191:16)

at bootstrap_node.js:612:3

Am I adding it in the wrong place?


Looks like you’re already listening on that port.


You’re already listening on a port. What problem are you trying to solve by adding the code?


Hi! Sorry. I figured it out.


Actually my bot still completely shuts down when I quit my glitch edit page even though I set it up according to these instructions: How to make a glitch project to run constantly?

Here’s how I set up the monitor in Uptime:


How are you establishing that your bot ‘completely shuts down’? Botkit Slack bots use webhooks so it isn’t necessary to keep the bot awake as it should wake in response to an incoming request. Nevertheless, your project is responding properly to a http request to lying-bus.glich.me, so it being hit by UptimeRobot would be enough to prevent it from sleeping.


It was a problem with not calling convo.stop() at the end! Thank you.


At first uptimerobot was not working but I decided to choose ‘port’ instead of ‘http’ and then chose the ‘https’ port and kept everything else what was said by @shindakun , and guess what it worked like magic. Thanks to discord.js, Glitch and uptimerobot for this successful project.

Using uptime robot - 404 not found?