Discord bot down

My project is called malaria. After about 5 minutes my discord bot goes offline. And I have added things in watch.json and have uptime robot. I need help.

Here is a helpful guide written by another user. You can find it here:
https://support.glitch.com/t/how-to-make-a-glitch-project-to-run-constantly/2439/2?u=excelledbot

1 Like

It might be helpful to know what your UptimeRobot config looks like, but based on the contents of your bot’s logs I don’t see it going offline every 5 minutes - it looks like it’s pretty constantly up to me.

What is the basis of your impression that it’s stopping every 5 minutes?

My project is live but on discord it is offline. I don’t know the reason for that.

Ah, interesting. I guess I’ll give the Discord experts a change to weigh in since they’re probably more likely to be able to help, but what I was seeing in the logs also sort of looked like it was running in Discord as well - at least the “reconnecting” event seems to be being fired, which I would have thought would be coming from Discord…

Are there anything in logs? Or show a screenshot of code.

It just fires the reconnecting event every second.

That’s weird, have you tried using

const Discord = require("discord.js");
const client = new Discord.Client();
 
client.on("ready", () => {
  console.log("I am ready!");
});
 
client.on("message", (message) => {
  if (message.content.startsWith("ping")) {
    message.channel.send("pong!");
  }
});
 
client.login("SuperSecretBotTokenHere");

(Pinched from http://anidiots.guide/first-bot/your-first-bot)

Just to see if it’s the module’s problem?

What do you mean? I do have a ping command but what about that?

1 Like

Hmm show us your watch.json please, just to make sure it’s not an infinite loop or something lol

PS: I used to have my bot write to a file on start, so Glitch automatically restarted over and over haha took me a long time to realise the issue

So it seems like you have a xp.json which keeps tracks of the amount of messages users have sent. Messages are almost always being sent I’m assuming…? So xp.json will constantly get updated, causing your project to constantly restart.

Add all the files that are getting changed a lot into watch.json, excludes
image

{
  "install": {
    "include": [
      "^package\\.json$",
      "^\\.env$"
    ]
  },
  "restart": {
    "exclude": [
       // here
    ],
    "include": [
      "\\.js$",
      "\\.json"
    ]
  },
  "throttle": 900000
}

Maybe this: “\.json” is the issue? I have no idea about regex or whatever that is, so I don’t know if it matches the json files

But it seems like you have set a high throttle which causes the project not to restart…? Weird:/

Maybe you hit the 1000 logins per day?

Note: After 1000 Logins per day, your discord bot token will no longer work and you will have to make a new one.
Note: Please add your Discord bots list token to the .env file

PS: Also can you show us a screenshot of it saying reconnecting in the console? (Are there any errors, or is it just saying reconnecting)

Just saying reconnecting.

1 Like

I’ve done what you did above but it is still offline.

It’s good now because now it’s online. I don’t even know what happened.

1 Like

Then it went offline next minute.

1 Like

You can check for these events:
image
Might log more useful info as I have no idea what’s happening either




etc…

I added the debug event. After my bot goes offline it says debugging... at ${new Date}.

I didn’t add the resumed event yet.

1 Like

This should do

client.on("warn", data => console.log(data));
client.on("disconnect", data => console.log("Bot is disconnecting..."));
client.on("reconnect", data => console.log("Bot is disconnecting..."));
client.on("error", data => console.log(data));

Can you paste a screenshot of logs when bot goes offline.

WARNING:
Debug event outputs your bot token censor before posting

1 Like

I have the above but how do I check for debug?

1 Like
client.on("debug", data => console.log(data));

Should work