diff --git a/include/dpp/dispatcher.h b/include/dpp/dispatcher.h index 18d07b807d..fef838fba7 100644 --- a/include/dpp/dispatcher.h +++ b/include/dpp/dispatcher.h @@ -971,6 +971,16 @@ struct DPP_EXPORT ready_t : public event_dispatch_t { * @brief shard id */ uint32_t shard_id = {}; + + /** + * @brief Array of guild IDs the bot is in, at the time of this event. + */ + std::vector guilds{}; + + /** + * @brief The number of guilds the bot is in, at the time of this event. + */ + uint32_t guild_count{0}; }; /** diff --git a/src/dpp/events/ready.cpp b/src/dpp/events/ready.cpp index 7f68359392..7990293d98 100644 --- a/src/dpp/events/ready.cpp +++ b/src/dpp/events/ready.cpp @@ -71,6 +71,10 @@ void ready::handle(discord_client* client, json &j, const std::string &raw) { dpp::ready_t r(client, raw); r.session_id = client->sessionid; r.shard_id = client->shard_id; + for (const auto& guild : j["d"]["guilds"]) { + r.guilds.emplace_back(snowflake_not_null(&guild, "id")); + } + r.guild_count = r.guilds.size(); client->creator->on_ready.call(r); } }