Ask coding questions

← Back to all posts
Uptime Robot not working with Discord Cloudflare
h
cloudagon

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?

Answered by c4syner [earned 5 cycles]
View Answer
Voters
G4RR3TTjonnyboi
cloudagon
Comments
hotnewtop
c4syner

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

Then usage would look like:

c4syner

@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!

cloudagon

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

c4syner

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

cloudagon

@c4syner Okay, thank you!

G4RR3TTjonnyboi

@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

@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

@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

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

Coder100

Anyways, this has been happening to a lot of us recently with our bots going down and such. You can only keep up to 20 servers online at a time, however I feel like in your case, https://keeper-upper.turbio.repl.co and https://ping.matdoes.dev are good solutions.

cloudagon

@Coder100 I only have one bot on one server so that isn't a problem for me. Also those websites don't seem to be different from Uptime Robot's system so wouldn't it still break with them? Thanks for your help.

Coder100

@xCloudzx hi, the thing is, repl.it right now is a bit unstable, so the best thing you can do is to have as many pinging services as possible

Coder100

also, btw, keeper-upper is repl.it's official one @xCloudzx

Coder100

your bot cannot be banned unless the code is malicious, not anything to do with requests.

cloudagon

My bot was temporarily banned. I think Discord considers what I did to be API Abuse. @Coder100

Coder100

ohh no, that's a message overflow @xCloudzx

Coder100

basically someone sent a lot of commands and made your bot spam, and reach the quota @xCloudzx

Coder100

not a big deal, just make sure to add cooldown @xCloudzx

cloudagon

@Coder100 How would I do that? I've looked it up and found no answers. Is there any code I can look at?

Coder100

Store it in a dict, something like this:

@xCloudzx

cloudagon

@Coder100 Wouldn't that only allow me to send one message every 10 seconds on the whole bot, not just one server? That's too slow. Is there any way to just get the amount of time I need to wait and do it only when I need to wait?

Coder100

wdym @xCloudzx

Coder100

right now, it will set the cooldown for that user globally, because doing it in just one server will not help with your problem @xCloudzx

Coder100
cloudagon

@Coder100 How do other bots handle this problem though? Because I'm sure not all of them have cooldowns.

Coder100

soft rate-limiting @xCloudzx

Coder100

unfortunately, you will need lower-level access to how the commands are executed to implement that @xCloudzx

Coder100

basically, every time a user sends a message, it will be put into a waiting line (an array), and every 0.5 seconds that array gets executed and cleared. If the bot experiences an API rate limiting, the array gets cleared to prevent spam. @xCloudzx

cloudagon

@Coder100 This looks like a very nice solution, I will definitely try it. Thanks!

cloudagon

@Coder100 I see, but how does that break my bot? I understand not sending the message, but why was I not able to run my bot?