From b7b0fd0f007d4179dfca1b0a5cb9b3b9307fe434 Mon Sep 17 00:00:00 2001 From: UltimateSppy765 <73820738+UltimateSppy765@users.noreply.github.com> Date: Mon, 27 Feb 2023 08:48:11 +0530 Subject: [PATCH] Fix websocket error when intents is 0 --- src/dpp/discordclient.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dpp/discordclient.cpp b/src/dpp/discordclient.cpp index 4e94a9ab0e..b022656327 100644 --- a/src/dpp/discordclient.cpp +++ b/src/dpp/discordclient.cpp @@ -347,7 +347,7 @@ bool discord_client::handle_frame(const std::string &buffer) std::this_thread::sleep_for(std::chrono::seconds(wait)); } log(dpp::ll_debug, "Connecting new session..."); - json obj = { + json obj = { { "op", 2 }, { "d", @@ -362,13 +362,11 @@ bool discord_client::handle_frame(const std::string &buffer) }, { "shard", json::array({ shard_id, max_shards }) }, { "compress", false }, - { "large_threshold", 250 } + { "large_threshold", 250 }, + { "intents", this->intents } } } }; - if (this->intents) { - obj["d"]["intents"] = this->intents; - } this->write(jsonobj_to_string(obj)); this->connect_time = creator->last_identify = time(NULL); reconnects++;