Skip to content
Advertisement

Discord bot wont go online with UptimeRobot

So I’m using python to keep my bot online with UptimeRobot, so I used the following code to keep it online:

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()

UptimeRobot says its online but when I go to discord, its not. Can anyone help me

Advertisement

Answer

Create a Folder named : keep_alive.py

then

from flask import Flask
from threading import Thread

app = Flask('')

@app.route('/')
def main():
  return "Your Bot Is Ready!" #Change this if you want

def run():
    app.run(host="0.0.0.0", port=8080) #don't touch this

def keep_alive():
    server = Thread(target=run)
    server.start()

Now Import import keep_alive #don't forget to import the file! To your bot main folder

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement