Skip to content
Sign upLog in
← Back to Community

Repl.it File Isn't Running 24/7 Even Though I Linked Uptimerobot To It

Profile icon
[deleted]

Hi there! I had just made a new discord bot using repl, and I hooked it up to uptime robot to keep it running, but the bot keeps going offline every two minutes or so, so then I have to open up the project and run it again. Is there something that I am doing wrong?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
BautistaVes
Profile icon
nileshoctgon
Profile icon
Muhammadmdman
Profile icon
0kb0mm3r
Profile icon
2004105010047
Profile icon
MirandaLopes
Profile icon
josysalt
Comments
hotnewtop
Profile icon
Coder100

Hello, there are other options other than uptimerobot. Try these along with it as well: mat's ping, official (beta) keeper-upper of repl.it.

Hopes this helps!

Also, be sure to mark as correct answer if it has helped you!

Profile icon
[deleted]

@Coder100
Hey, in the first option, it still goes offline, and the second one keeps saying “authentication failed”.

Profile icon
Coder100

hmmm... send the repl in question

@JollyJack8

Profile icon
[deleted]

@Coder100
like my file?

Profile icon
Coder100

oh, nvm. Ok, so the problem is that you have no HTTP server! Http servers is what makes the bots stay alive (a terminal app shuts down after you close the tab, but a web server shuts down after 1 hour of no activity). So, just add this to your code (anywhere in the file):

const http = require("http"); http.createServer((_, res) => res.end("Alive")).listen(8080)

and your bot will work!


@JollyJack8

Profile icon
[deleted]

@Coder100
so I did that, but now the commands don’t work, the bot is just idle online.

Profile icon
Coder100

no no, don't replace the entire code into somewhere else!! Add the code along with the bot code

@JollyJack8

Profile icon
[deleted]

@Coder100
I did. I put it in server.js, and it also went offline again.

Profile icon
Coder100

that's because server.js isn't run. So, just add this to index.js:

require("./server")

@JollyJack8

Profile icon
[deleted]

@Coder100
omg tysm it works so well! c:

Profile icon
Coder100

no problem!! (:

@JollyJack8

Profile icon
LEGEND121

how to do in python?


@Coder100

Profile icon
dragN-BrawlStar

@Coder100
i used the code you provided above, but still the bot if offline :(
image

Profile icon
josysalt

hey first change ur bots status to streaming. then it will work

Profile icon
[deleted]

@josysalt
I did that but it still keeps going offline. Now sometimes it’s just sitting use not responding to any commands

Profile icon
josysalt

@JollyJack8
hmm... weird. is it js? cuz for me it works with py. ill give u template if u need.

Profile icon
[deleted]

@josysalt
yeah it’s js. Like, I did the stream and it says online, but if I run a command, it just stays idle and doesn’t respond. And sometimes it just goes offline altogether.