So I’m using python to keep my bot online with UptimeRobot, so I used the following code to keep it online:
JavaScript
x
17
17
1
from flask import Flask
2
from threading import Thread
3
4
app = Flask('')
5
6
@app.route('/')
7
8
def main():
9
return "Your Bot Is Ready"
10
11
def run():
12
app.run(host="0.0.0.0", port=8000)
13
14
def keep_alive():
15
server = Thread(target=run)
16
server.start()
17
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
JavaScript
1
16
16
1
from flask import Flask
2
from threading import Thread
3
4
app = Flask('')
5
6
@app.route('/')
7
def main():
8
return "Your Bot Is Ready!" #Change this if you want
9
10
def run():
11
app.run(host="0.0.0.0", port=8080) #don't touch this
12
13
def keep_alive():
14
server = Thread(target=run)
15
server.start()
16
Now Import import keep_alive #don't forget to import the file!
To your bot main folder