How do I use repl.it
for my Python Discord Bot, and keep it running 24/7.
I used to use keep_alive
but it stops working for some reason.
Does anyone have any suggestions?
I keep getting this error in the console:
172.18.0.1 - - [16/Feb/2019 11:25:10] "GET / HTTP/1.1" 200 -
To keep your repl.it bot online 24/7 you have to do 3 things :
1. To keep our bot alive we have to add the following code on the head of our py file:
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your Bot Is Ready"
def run():
app.run(host="0.0.0.0", port=8000)
def keep_alive():
server = Thread(target=run)
server.start()
2. Adding a background task :
status = cycle(['with Python','JetHub'])
@bot.event
async def on_ready():
change_status.start()
print("Your bot is ready")
@tasks.loop(seconds=10)
async def change_status():
await bot.change_presence(activity=discord.Game(next(status)))
3. Setup the Uptime Robot :
If you have made your discord bot in discord.js, I wrote a medium article on that : Host a Discord Bot 24/7 Online for FREE!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With