diff --git a/include/dpp/cluster.h b/include/dpp/cluster.h index b9c64bcd8c..a3f157e20b 100644 --- a/include/dpp/cluster.h +++ b/include/dpp/cluster.h @@ -3153,7 +3153,7 @@ class DPP_EXPORT cluster { * @brief Get public archived threads in a channel (Sorted by archive_timestamp in descending order) * @see https://discord.com/developers/docs/resources/channel#list-public-archived-threads * @param channel_id Channel to get public archived threads for - * @param before_timestamp Get threads before this timestamp + * @param before_timestamp Get threads archived before this timestamp * @param limit Number of threads to get * @param callback Function to call when the API call completes * On success the callback will contain a dpp::thread_map object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). @@ -3164,7 +3164,7 @@ class DPP_EXPORT cluster { * @brief Get private archived threads in a channel (Sorted by archive_timestamp in descending order) * @see https://discord.com/developers/docs/resources/channel#list-private-archived-threads * @param channel_id Channel to get public archived threads for - * @param before_timestamp Get threads before this timestamp + * @param before_timestamp Get threads archived before this timestamp * @param limit Number of threads to get * @param callback Function to call when the API call completes * On success the callback will contain a dpp::thread_map object in confirmation_callback_t::value. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error(). diff --git a/include/dpp/role.h b/include/dpp/role.h index fd16b39122..3a313ccc62 100644 --- a/include/dpp/role.h +++ b/include/dpp/role.h @@ -37,6 +37,7 @@ enum role_flags : uint8_t { r_premium_subscriber = 0b00001000, //!< Whether this is the guild's booster role r_available_for_purchase = 0b00010000, //!< Whether the role is available for purchase r_guild_connections = 0b00100000, //!< Whether the role is a guild's linked role + r_in_prompt = 0b01000000, //!< Whether the role can be selected by members in an onboarding prompt }; /** @@ -287,6 +288,11 @@ class DPP_EXPORT role : public managed, public json_interface { * @return bool True if the role is a linked role */ bool is_linked() const; + /** + * @brief True if the role can be selected by members in an onboarding prompt + * @return bool True if the role can be selected by members in an onboarding prompt + */ + bool is_selectable_in_prompt() const; /** * @brief True if has create instant invite permission * @note Having the administrator permission causes this method to always return true diff --git a/src/dpp/role.cpp b/src/dpp/role.cpp index dc11b7772c..7739a3ef19 100644 --- a/src/dpp/role.cpp +++ b/src/dpp/role.cpp @@ -32,6 +32,11 @@ namespace dpp { using json = nlohmann::json; +/* A mapping of discord's flag values to our bitmap (they're different bit positions to fit other stuff in) */ +std::map rolemap = { + { 1 << 0, dpp::r_in_prompt }, +}; + role::role() : managed(), guild_id(0), @@ -70,6 +75,14 @@ role& role::fill_from_json(snowflake _guild_id, nlohmann::json* j) this->colour = int32_not_null(j, "color"); this->position = int8_not_null(j, "position"); this->permissions = snowflake_not_null(j, "permissions"); + + uint8_t f = int8_not_null(j, "flags"); + for (auto & flag : rolemap) { + if (f & flag.first) { + this->flags |= flag.second; + } + } + this->flags |= bool_not_null(j, "hoist") ? dpp::r_hoist : 0; this->flags |= bool_not_null(j, "managed") ? dpp::r_managed : 0; this->flags |= bool_not_null(j, "mentionable") ? dpp::r_mentionable : 0; @@ -167,6 +180,10 @@ bool role::is_linked() const { return this->flags & dpp::r_guild_connections; } +bool role::is_selectable_in_prompt() const { + return this->flags & dpp::r_in_prompt; +} + bool role::has_create_instant_invite() const { return has_administrator() || permissions.has(p_create_instant_invite); }