From 6937dc4713483397fcf49c5fc99d4785708dba54 Mon Sep 17 00:00:00 2001 From: Azhar Momin Date: Sat, 31 May 2025 18:32:53 +0530 Subject: [PATCH] Add `--enable-debug-events` flag to CLI Enables discord.py socket debug events. --- redbot/core/_cli.py | 3 +++ redbot/core/bot.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/redbot/core/_cli.py b/redbot/core/_cli.py index 333e78fe700..e13820621ec 100644 --- a/redbot/core/_cli.py +++ b/redbot/core/_cli.py @@ -135,6 +135,9 @@ def parse_cli_flags(args): ) parser.add_argument("--version", "-V", action="store_true", help="Show Red's current version") parser.add_argument("--debuginfo", action="store_true", help="Show debug information.") + parser.add_argument( + "--enable-debug-events", action="store_true", help="Enable discord.py socket debug events." + ) parser.add_argument( "--list-instances", action="store_true", diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 359b65e3657..e0fd95f7f0b 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -232,6 +232,9 @@ async def prefix_manager(bot, message) -> List[str]: kwargs["max_messages"] = message_cache_size self._max_messages = message_cache_size + if cli_flags.enable_debug_events: + kwargs["enable_debug_events"] = True + self._uptime = None self._checked_time_accuracy = None