Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to keep your discord bot running 24/7 without the Hacker Plan
h
LeviathanCoding

I personally don't make discord bots but I helped my friend make one run all the time and it can be done in two simple steps.

Once you finish your discord bot, attach a simple web server into it. If using discord.js, set up a simple "Hello World" web server and if using discord.py, simply make a flask server.

Javascript

Add a simple express server at the end of the code.

Make sure you run npm install express in the terminal!!

How to do it in python.

To set up a flask server, simply add this code to the end of your python file:

also, run pip install flask in the terminal.

After that's done, your repl will still fall asleep. To fix that, make an account at uptimerobot and add your repl domain or link. It should look like ReplName.YourUsername.repl.co

After that, make sure you RUN your repl

and everything should be up and running.

Voters
SBtrains
TonyWu4
PixiGem
SudhanshuMishra
MaciahLawson
JaredBradyBrady
xfinnbar
LeviathanCoding
Comments
hotnewtop
WillingDude

is there a way to use this outside of repl? ie, vscode

EricPlayzYT

@WillingDude yes there is a way. You just need to import flask(python) or express(node.js) and set it to a port. Once you go to that port, set a ip/port monitor on uptimerobot.com and your done! Also copy the code above in the post. You might actually need to assign this to a domain if you want.

MagnusOelsner

...

MagnusOelsner

Where Do I add This Line Of Code For Java

LeviathanCoding

@MagnusOelsner , idk how to do java

VulcanWM

Just saying commenting in Python is #

LeviathanCoding

@VulcanWM , ooch, I accidentally pasted that I think lol