From 1899e6aabeda3cb5917c74a56a5ee0883e6358b1 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Mon, 15 Jul 2024 16:07:27 +0000 Subject: [PATCH] change get_gateway_bot to use coro when available --- src/dpp/cluster.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dpp/cluster.cpp b/src/dpp/cluster.cpp index 83d53a0528..4866e7a67b 100644 --- a/src/dpp/cluster.cpp +++ b/src/dpp/cluster.cpp @@ -190,7 +190,12 @@ void cluster::start(bool return_after) { /* Start up all shards */ gateway g; try { +#ifdef DPP_CORO + confirmation_callback_t cc = co_get_gateway_bot().sync_wait(); + g = std::get(cc.value); +#else g = dpp::sync(this, &cluster::get_gateway_bot); +#endif log(ll_debug, "Cluster: " + std::to_string(g.session_start_remaining) + " of " + std::to_string(g.session_start_total) + " session starts remaining"); if (g.session_start_remaining < g.shards) { throw dpp::connection_exception(err_no_sessions_left, "Discord indicates you cannot start enough sessions to boot this cluster! Cluster startup aborted. Try again later.");