Skip to content
← Back to Community
why our discord bot is making too many requests?!
Profile icon
AbdulrahmanShaw

We made a discord for studying server that starts timers and makes a leaderboard, the bot works fine but after random amount of use discord API banns the bot we looked on the code, but we couldn't find the block that could make too many requests.

The case is the bot is just sending messages and fetching some users names for the leaderboard.

Could you guys help us find why this thing is happening ?

Thanks for all.

The error message:

429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently.

Voters
Profile icon
denisrudnitskyy
Profile icon
XdekHckr
Profile icon
AbdulrahmanShaw
Comments
hotnewtop
Profile icon
HackermonDev

Although it is not recommended, running kill 1 in the replit's terminal resets the repl and changes the repl's IP address, momentarily bypassing the ban.

Profile icon
ch1ck3n

i have a feeling you are in a infinite loop. try making it so that the bot says something when it is doing an action to make sure how many times it's making a request or smth

Profile icon
AbdulrahmanShaw

@ch1ck3n
of course we have infinite loops to check if the timer ended, if the timer ended the bot will send a message to the channel

Profile icon
AbdulrahmanShaw

@ch1ck3n
do i have to add sleep to avoid this problem?

Profile icon
ch1ck3n
Profile icon
AbdulrahmanShaw

@ch1ck3n
but the bot is just uses message send function when the timer ends.

I didn't understand how this could happen while we are not using these functions

Profile icon
ch1ck3n

@AbdulrahmanShaw
what lines accesses the API

Profile icon
AbdulrahmanShaw

@ch1ck3n
client.loop.create_task
And all the lines that has "await" word