Uptime Robot not working with Discord Cloudflare
h
xCloudzx (1)

Apparently Uptime Robot is sending invalid requests so my bot got temporarily banned from discord.com and I cannot run it anymore. Is there any alternative to Uptime Robot that will work with Discord?

You are viewing a single comment. View All
c4syner (77)

Try using my modified version of keep_alive, it doesn't require an external pinger.

from flask import Flask
from threading import Thread
import random
import time
import requests
import logging
app = Flask('')
@app.route('/')
def home():
    return "You have found the home of a Python program!"

def run():
  app.run(host='0.0.0.0',port=random.randint(2000,9000)) 
def ping(target, debug):
    while(True):
        r = requests.get(target)
        if(debug == True):
            print("Status Code: " + str(r.status_code))
        time.sleep(random.randint(180,300)) #alternate ping time between 3 and 5 minutes
def awake(target, debug=False):  
    log = logging.getLogger('werkzeug')
    log.disabled = True
    app.logger.disabled = True  
    t = Thread(target=run)
    r = Thread(target=ping, args=(target,debug,))
    t.start()
    r.start()

Then usage would look like:

import neverSleep
neverSleep.awake(yourReplURL, False)
#All your code: \/
c4syner (77)

@c4syner Oh and rename the top code to neverSleep.py. BTW I've had a discord bot staying alive for the past 2 months without issue with this!

xCloudzx (1)

@c4syner This looks promising! So I would put never sleep.awake at the top as opposed to right before bot.run?

c4syner (77)

@xCloudzx That's just what I did, you could put this where keep_alive is. (removing keep_alive of course)

G4RR3TTjonnyboi (0)

@c4syner Sorry I am just viewing this, I was wondering... Does it require Uptimerobot still? or is it just possible to have neversleep and no uptimerobot, idk thanks I know this was 5 months ago but just wondering...

c4syner (77)

@G4RR3TTjonnyboi It's been a while since I've used this but when I first built this, it didn't need any external programs. It kept itself alive by essentially pinging itself every few random minutes.

G4RR3TTjonnyboi (0)

@c4syner Thank you I know it has been a few months, It's just I have had the same problem and had to use this, Thanks and sorry for the trouble.

c4syner (77)

@G4RR3TTjonnyboi No trouble at all! If you need help getting it set up just ping me here.