yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
708 stars 93 forks source link

Error 429 5005 #261

Closed thelifeworm closed 2 years ago

thelifeworm commented 2 years ago

When the bot writes a lot at a time in the chat. Happens

Error 5005: {
  "global": false,
  "message": "You are being rate limited.",
  "retry_after": 2.506
}

and it crashes. std::terminate image

How not to get a crash?

thelifeworm commented 2 years ago

After #define ASIO_NO_EXCEPTIONS i get exception from sleepydiscord. image Is there any way to replace the exception? for example to return an error code or something similar?

yourWaifu commented 2 years ago

The docs already has multiple ways to avoid a crash from there kinds of errors. https://yourwaifu.dev/sleepy-discord/docs/requests 2nd, you really should slow down if you're getting rate limited. Last, defining ASIO_NO_EXCEPTIONS here isn't going to help you. LoL 🤣

thelifeworm commented 2 years ago

Oh thank you. I now use .error()