Discord.py: Blocked from using API

Created on 10 Nov 2020  路  5Comments  路  Source: Rapptz/discord.py

Summary

So I was just trying to run my bot and this is the error which I got for no fault of mine! This is also not the first time I am getting this error, I checked links but they didn't help the issue!!!

Reproduction Steps

I literally just ran the bot

Expected Results

I expected the bot to run but it didn't go that way.

Actual Results

Here:

Traceback (most recent call last):
  File "bot.py", line 1991, in <module>
    client.run(BOT_TOKEN)
  File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 679, in run
    return future.result()
  File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 658, in runner
    await self.start(*args, **kwargs)
  File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 621, in start
    await self.login(*args, bot=bot)
  File "/home/container/.local/lib/python3.8/site-packages/discord/client.py", line 472, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/home/container/.local/lib/python3.8/site-packages/discord/http.py", line 288, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/home/container/.local/lib/python3.8/site-packages/discord/http.py", line 209, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.
sys:1: RuntimeWarning: coroutine 'Command.__call__' was never awaited

Later

Please sort this issue out as I am not even abusing API, the most advanced thing I am doing is giveaways! And also I have an asyncio.sleep(10) for changing the bots streaming status. I have seen more advanced bots run!!!

I asked my friend about this and he told me to wait for 5 hours, please reduce the cooldown or stop this issue as it just happens randomly.

invalid

All 5 comments

I don't know why you've been banned from the API but it's not really something I control. A cloudflare ban lasts an hour. Wait it out.

Thanks for the quick reply, so I just have to wait. Any tips for waiting or not doing API abuse next time as well.

Discord said this before,
automating the API in that way /is/ abuse. Automatically doing "X" every N is generally not a good idea. Where X could be posting a message, changing someone's nickname, renaming a role, changing a channel topic, etc...

Generally bots should only react to user actions...

Although, for very large N we generally don't care. But for small N, we do care. Think rainbow bots, etc....
So generally don't do API calls in quick loops and such and you should be fine.

You usually get this ban after passing 10,000 429s or 403s or 401s in 10 minutes.

Ohhhhhhhhhhh, now I get it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danshat picture danshat  路  3Comments

MrBrahm picture MrBrahm  路  3Comments

Yolotroll101 picture Yolotroll101  路  3Comments

Rimmy50 picture Rimmy50  路  3Comments

tairabiteru picture tairabiteru  路  3Comments