Ask coding questions

← Back to all posts
About keeping a discord bot online 24/7
YeetyMcYeetster (5)

Hello,

I have hosted my discord bots (in js and in py) and i have never ran in to a problem until now with my discord.py bot. I am using keep_alive and uptimerobot is pinging it everything runs fine but when i close my tab then the bot stops working, in uptimerobot there are no errors.
My keep_alive.py file:

from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def main():
    return "alive"

def run():
    app.run(host="0.0.0.0", port=8080)

def keep_alive():
    server = Thread(target=run)
    server.start()
Comments
hotnewtop
Ven0m515 (1)

Same for me too.

isige (1)

this happens to me sometimes too idk
i'm trying to run the Red framework for 2 bots, and i only have 1 rpi which can barely handle 1

CubingOP (1)

use uptime robot for pinging your webserver every 5 minutes.

a7blockeyblue (0)

@CubingOP How? I have had UpTime running it with the "Up" status and its not online.

CubingOP (1)

@a7blockeyblue watch from 58:42 for hosting bot and creating web server https://www.youtube.com/watch?v=SPTfmiYiuok