Bot shutting down if not pinged/used

discord
#1

Idk if this is glitch help or discord bot help but ok.

Since glitch only has 3000 as a port i can’t use it to ping the bot with uptimerobot since i have the port used somewhere else. So could i add this code down bellow so that the project doesn’t die/sleep. Idk how it works. Maybe someone who knows discord.js can help

bot.on(“error”, async (err) => {
console.log(err);
let channel = bot.channels.get(“571352423818330123”)
channel.send(err.message)
});

#2

Hello @ramoth123! I’m sorry you’re having trouble with your project. I’m going to re-categorize your question into the “Discord Help” category so others can find it more easily.

#3

@ramoth123

Can you invite me to your project so I can take a closer look?

#4

I think we have found a to make it work

#5

What was the eventual solution?

#6

Why won’t you be able to ping, add an file bot.js:
const express = require(“express”);
const app = express();

app.get("/", (request, response) => {
console.log(“Ping received!”);
response.sendStatus(200);
});

// listen for requests :slight_smile:
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ’ + listener.address().port);
});

#7

Well, i am had that already but then i needed my port somewhere else in my project so i used port 3000 in 2 places which gave me an error, so i had to remove the ping request thing. But we found a way to have both. Idk how my dev did it but he did. So its fixed for now