From aa499c5639a75e94b43b751d379ab7eb0fcacf9a Mon Sep 17 00:00:00 2001 From: Evanroby Date: Sat, 23 May 2026 05:51:24 +0200 Subject: [PATCH] Add `--enable-debug-events` flag to CLI (#6660) Co-authored-by: amazingakai <93782497+amazingakai@users.noreply.github.com> Co-authored-by: Jakub Kuczys --- redbot/core/_cli.py | 6 ++++++ redbot/core/bot.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/redbot/core/_cli.py b/redbot/core/_cli.py index 312d3c999..886c9421f 100644 --- a/redbot/core/_cli.py +++ b/redbot/core/_cli.py @@ -137,6 +137,12 @@ 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 raw socket events (on_socket_raw_receive and on_socket_raw_send)." + " This may reduce the bot's performance significantly.", + ) parser.add_argument( "--list-instances", action="store_true", diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 891a7cadd..2af27c4b7 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -249,6 +249,9 @@ class Red( 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