victorgawk / yellowtracker

Yellow Tracker is a discord bot primarly designed to track bosses (aka MVPs).
MIT License
2 stars 9 forks source link

Rate Limits and other errors? #5

Closed KariArisu closed 1 month ago

KariArisu commented 11 months ago

I've never worked with a Discord bot before, so I apologize in advance.

After getting everything set up through a lot of trial and error, the bot mostly works fine. The only issue I have is that, very often, when adding an MVP to track it will error in Discord, then add the MVP anyways. Plus, my command prompt window has a ton of errors and messages about rate limits.

Here is an example log:

[2023-12-17 21:52:55] [INFO    ] __main__: Start bot client.
[2023-12-17 21:52:55] [INFO    ] discord.client: logging in using static token
[2023-12-17 21:52:55] [INFO    ] __main__: Start timer.
[2023-12-17 21:52:57] [INFO    ] discord.gateway: Shard ID None has connected to Gateway (Session ID: d7080be725f74c1fa98725907b9da903).
[2023-12-17 21:52:59] [INFO    ] yellowtracker.event.on_ready_event: Connected as MVP Tracker#9492 on 1 servers.
[2023-12-17 21:52:59] [INFO    ] yellowtracker.event.on_ready_event: Sync slash commands with guild id 276158517457584129.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Create database pool.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Load servers settings.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Load MVPs.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Load mining locations.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Load MVP entries.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Load mining location entries.
[2023-12-17 21:53:00] [INFO    ] yellowtracker.event.on_ready_event: Init track channels.
[2023-12-17 21:53:01] [INFO    ] yellowtracker.event.on_ready_event: Track channels init done.
[2023-12-17 22:19:13] [INFO    ] discord.gateway: Shard ID None has successfully RESUMED session d7080be725f74c1fa98725907b9da903.
[2023-12-17 22:46:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 22:49:50] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 22:50:14] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 22:52:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:22:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:22:44] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:23:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:26:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:27:14] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:27:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:35:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:37:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:37:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:38:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:38:50] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:41:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:41:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:42:08] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:42:32] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:44:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:44:32] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:51:32] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:52:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:53:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:55:08] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:55:32] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:56:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:57:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:57:56] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:58:32] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-17 23:59:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:02:16] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 3.53 seconds.
[2023-12-18 00:02:21] [ERROR   ] yellowtracker.util.coroutine_util: Unexpected error.
  File "D:\RO_Stuff\yellowtracker-master\src\app.py", line 125, in <module>
    loop.run_forever()
  File "C:\Program Files\Python310\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 1881, in _run_once
    handle._run()
  File "C:\Program Files\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Program Files\Python310\lib\site-packages\discord\ui\modal.py", line 187, in _scheduled_task
    await self.on_submit(interaction)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\service\channel_service.py", line 477, in on_submit
    await ChannelService.track_entry(self.bot, interaction, self.channel_state, name, user_time)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\service\channel_service.py", line 77, in track_entry
    await CoroutineUtil.run(interaction.response.send_message(
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 13, in run
    log.error(f"Unexpected error.\n{CoroutineUtil.get_stack_str()}", exc_info=True)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 18, in get_stack_str
    stack = traceback.format_stack()
Traceback (most recent call last):
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 11, in run
    return await coroutine
  File "C:\Program Files\Python310\lib\site-packages\discord\interactions.py", line 778, in send_message
    await adapter.create_interaction_response(
  File "C:\Program Files\Python310\lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2023-12-18 00:02:21] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 4.89 seconds.
[2023-12-18 00:02:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:03:38] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:03:56] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:04:42] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 1.51 seconds.
[2023-12-18 00:04:44] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 5.79 seconds.
[2023-12-18 00:04:50] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 5.87 seconds.
[2023-12-18 00:04:56] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 5.85 seconds.
[2023-12-18 00:04:57] [ERROR   ] yellowtracker.util.coroutine_util: Unexpected error.
  File "D:\RO_Stuff\yellowtracker-master\src\app.py", line 125, in <module>
    loop.run_forever()
  File "C:\Program Files\Python310\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 1881, in _run_once
    handle._run()
  File "C:\Program Files\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Program Files\Python310\lib\site-packages\discord\ui\modal.py", line 187, in _scheduled_task
    await self.on_submit(interaction)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\service\channel_service.py", line 477, in on_submit
    await ChannelService.track_entry(self.bot, interaction, self.channel_state, name, user_time)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\service\channel_service.py", line 77, in track_entry
    await CoroutineUtil.run(interaction.response.send_message(
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 13, in run
    log.error(f"Unexpected error.\n{CoroutineUtil.get_stack_str()}", exc_info=True)
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 18, in get_stack_str
    stack = traceback.format_stack()
Traceback (most recent call last):
  File "D:\RO_Stuff\yellowtracker-master\src\yellowtracker\util\coroutine_util.py", line 11, in run
    return await coroutine
  File "C:\Program Files\Python310\lib\site-packages\discord\interactions.py", line 778, in send_message
    await adapter.create_interaction_response(
  File "C:\Program Files\Python310\lib\site-packages\discord\webhook\async_.py", line 219, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
[2023-12-18 00:17:08] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:23:02] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.
[2023-12-18 00:23:26] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1181768210396229703/messages/1181779328309133463 responded with 429. Retrying in 0.30 seconds.

Can you give me any advice or solutions?

victorgawk commented 1 month ago

I have been facing these errors too, no solution yet. Probably it is related to the Discord commands API.

I have also implemented a way to track by sending a text message, which could avoid those errors. Closing by now.