Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.81k stars 2.31k forks source link

Issue with emoji reactions to menus in 3.5-dev #5906

Closed RheingoldRiver closed 1 year ago

RheingoldRiver commented 1 year ago

What Red version are you using?

3.5-dev starting with commit f025283

What were you trying to do?

Add emojis to a menu, like this, in a specified order, with more emojis than the rate-limit

image

What did you expect to happen?

  1. Always have the emojis print in the same order every time (we ensure that they're sent in the same order every time by our code)
  2. Handle the rate-limit errors gracefully & retry as needed

What actually happened?

Through commit d7d6ab4, this was handled fine. Starting with commit f025283, however:

  1. The emojis printed in a random order
  2. Upon hitting the ratelimit, an error was printed to the user, and no retry happened

image image image

How can we reproduce this error?

  1. Make a command that creates an embed and adds at least 6 emoji reactions, in the same order to it, it doesn't actually need to be a functioning menu. But here are our cogs if you want to install them. You would need dbcog and padinfo, and it should work with just that, the command is [p]id.
  2. Run the command with commit f025283 or later.

Anything else?

We updated our bot a week ago, but the issue started today, so I'm not sure what's up with that. However, rolling back the Red version fixed the issue so there's definitely something going wrong that started with that commit. And it wasn't an ephemeral thing for just a few minutes either, it was broken for about 5 hours before we thought to try a rollback.

Flame442 commented 1 year ago

Seems like a duplicate of #5905, just with a different endpoint. Closing this in favor of that issue.

RheingoldRiver commented 1 year ago
Exception in command 'id'
Traceback (most recent call last):
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 190, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 219, in _id
    await self._do_id(ctx, query)
  File "/home/bot/.local/share/Red-DiscordBot/data/tsubaki_prod/cogs/CogManager/cogs/padinfo/padinfo.py", line 275, in _do_id
    await menu.create(ctx, state)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/embed/menu.py", line 38, in create
    return await send_embed(ctx, embed_wrapper, message=message)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discordmenu/discord_client.py", line 54, in send_embed
    await asyncio.gather(*add)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/message.py", line 1061, in add_reaction
    await self._state.http.add_reaction(self.channel.id, self.id, emoji)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/http.py", line 759, in request
    raise HTTPException(response, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being rate limited.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1347, in invoke
    await ctx.command.invoke(ctx)
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 986, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/bot/tsubaki/prod/lib/python3.8/site-packages/discord/ext/commands/core.py", line 199, in wrapped
    raise CommandInvokeError(exc) from exc

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 429 Too Many Requests (error code: 0): You are being rate limited.