Add rate limit logging and enhance Discord bot initialization

- Introduced a new module `rate_limit_logging.py` to log HTTP headers for Discord API rate limits (HTTP 429).
- Updated the Discord bot initialization in `__init__.py` to include a custom HTTP trace configuration for better rate limit handling.
- Adjusted logging levels in `run-web.py` to reduce verbosity for rate limit headers.
This commit is contained in:
2026-03-25 23:10:02 +01:00
parent 3c7d7f4e80
commit b51430e2b2
3 changed files with 71 additions and 1 deletions
+2 -1
View File
@@ -30,11 +30,12 @@ from discordbot.patreon import checkPatreonPosts
from discordbot.youtube import checkYouTubeVideos
from discordbot.auto_rooms import on_voice_state_update_auto_rooms, on_raw_reaction_add_auto_rooms, on_message_auto_rooms, cleanup_orphaned_auto_rooms
from discordbot.member_stats import record_message, on_voice_state_update_track_voice
from discordbot.rate_limit_logging import build_discord_http_trace_config
from protondb import searhProtonDb
class DiscordBot(discord.Client):
def __init__(self, *, intents: discord.Intents):
super().__init__(intents=intents)
super().__init__(intents=intents, http_trace=build_discord_http_trace_config())
self.tree = app_commands.CommandTree(self)
self.synced = False