Sreyas Menon
Sreyas Menon

Reputation: 33

Replit Discord Bot Keeps Turning Off

First off, I would like to say, I know very little coding, so please bear with me here.

Introduction

Despite not knowing any coding, I decided to make a discord bot for the fun of it. I also don't have any money, so I can't buy any fancy servers or software, so I started making it on replit. The bot is all done, and it doesn't do much really, just sends an embed on seeing a command, and I've set up a command handler and everything.

Problem

The problem I'm having is, it keeps going offline. Before it would go offline after a few hours, but I tested it recently, and it went out in around 20 minutes. There's no error or anything, just when I open up replit its off and I have to run it again.

Troubleshooting

I looked online, but all of those said to get a server and hook it up to uptimerobot, or have keepAlive(), but I have already had all this since the beginning. I even checked uptimerobot and it hasn't lost connection once in the past 2 weeks.

To test this, I made another quick discord bot, with only a ping command, and after 3 or so days, it has yet to go off. So I'm thinking that the problem might be I have too many commands (105 to be exact) for the basic replit resources to handle, but I'm not sure.

No one has even used the bot when it goes offline, so I really don't know what to do.

Any help would be great.

Thanks

Upvotes: 2

Views: 2585

Answers (3)

Robbour2
Robbour2

Reputation: 31

I would not recommend using uptime robot to host those replits because they only check ever 5 minutes (if you dont want to pay). I would rather use https://www.freshworks.com/website-monitoring because it has a 1 minute keepalive.

Upvotes: 2

Mushroom idiot
Mushroom idiot

Reputation: 69

Replit's free plan doesn't allow 24/7 hosting

But there is a trick!

Add this to your code

const express = require("express")
const app = express()

const server = app.listen(3000, () => {
    console.log(`Express running → PORT ${server.address().port}`)
})

app.get("/", (req, res) => {
    res.send("Online!")
})

Then copy your replit link and use a service which periodically pings your repl project to do that, here's a video of how to do it https://youtu.be/wZbAinOmays

How it works

Express is a package used for making HTTP servers and if you make a request to the HTTP server periodically, replit won't stop your project.

I would still use a paid service, because as others pointed out, you get what you pay for

Upvotes: 0

Ren Hiyama
Ren Hiyama

Reputation: 479

I won't suggest repl.it if you want to host your discord bot. Some good alternatives would be Heroku and Railway. I would personally suggest Railway (https://railway.app)

(Do note: you need to learn git and GitHub if you are going to use either of this platforms, and of course you need to learn them either way at a later date.)

(Also do note that I don't really suggest using these free hosters, get a paid vps, or keep using this.)

Upvotes: 1

Related Questions