Discord bot is not running with uptime robot and repl.it

Issue

I wanted to make my own discord bot wich should be online without my pc running, so i followed this tutorial: https://www.youtube.com/watch?v=Gqurhm2QxA0

It all worked fine and yesterday my bot was running and the whole time even without the repl.it website being online. I thought my discord bot was staying online forever.
But today he is not online, even if i restart my repl.it project. Here is my code for index.js:

const app = express();
const discord = require("discord.js");
const client = new discord.Client({intents:["GUILDS","GUILD_MESSAGES"]});
var bump_timeout = true;
app.listen(3000,()=>{
  console.log("bot is online");
});

app.get("/",(req, res) =>{
  res.send("hello world uwu");
});
client.on("message", message => {
  if(message.content === "!d bump" && bump_timeout==true){
    bump_timeout = false;
    message.channel.send("you got 100 coins!");
    setTimeout(bump_switchtimeout, 5000);
  }
})

function bump_switchtimeout(){
  bump_timeout = true;
}

client.on("ready", () => {
  console.log("bot is ready");
})


client.login(*here is the token*);```

I hope you can find out why the bot doesnt gets online.

Solution

Repl.it only has a certain amount of time it can keep your project online, and once it passes that threshold it won’t stay online anymore. It also has to do with the fact that repl.it only keeps your project online if theres active use of it (eg with a website, people are visitng said website). Nothing to do with your code.
Try Heroku, which is free, or other paid hosting services https://www.heroku.com/
https://plox.host/discordbot-hosting

Answered By – async

Answer Checked By – Candace Johnson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.