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

Time:06-13

I wanted to make my own discord bot which 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 express = require("express");
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 doesn't get online.

CodePudding user response:

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

  • Related