From 3d0f03b0bd0685160f1393cdb3a6371bdbdfb89a Mon Sep 17 00:00:00 2001 From: Phil B Date: Sat, 1 Apr 2023 22:25:48 +0200 Subject: [PATCH 1/2] feat: added VIEW_CREATOR_MONETIZATION_ANALYTICS and USE_SOUNDBOARD permission --- include/dpp/cluster.h | 4 ++-- include/dpp/permissions.h | 2 ++ include/dpp/role.h | 14 ++++++++++++++ src/dpp/role.cpp | 8 ++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/dpp/cluster.h b/include/dpp/cluster.h index 773e728c9d..6cfa93a39c 100644 --- a/include/dpp/cluster.h +++ b/include/dpp/cluster.h @@ -2341,7 +2341,7 @@ class DPP_EXPORT cluster { /** * @brief Get all emojis for a guild * - * @see https://discord.com/developers/docs/resources/emoji#get-guild-emojis + * @see https://discord.com/developers/docs/resources/emoji#list-guild-emojis * @param guild_id Guild ID to get emojis for * @param callback Function to call when the API call completes. * On success the callback will contain a dpp::emoji_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(). @@ -2376,7 +2376,7 @@ class DPP_EXPORT cluster { * @brief Edit a single emoji. * * You must ensure that the emoji passed contained image data using the emoji::load_image() method. - * @see https://discord.com/developers/docs/resources/emoji#get-guild-emoji + * @see https://discord.com/developers/docs/resources/emoji#modify-guild-emoji * @note This method supports audit log reasons set by the cluster::set_audit_reason() method. * @param guild_id Guild ID to edit emoji on * @param newemoji Emoji to edit diff --git a/include/dpp/permissions.h b/include/dpp/permissions.h index cf5c071b23..a39fbb6bd0 100644 --- a/include/dpp/permissions.h +++ b/include/dpp/permissions.h @@ -71,6 +71,8 @@ enum permissions : uint64_t { p_send_messages_in_threads = 0x04000000000, //!< allows for sending messages in threads p_use_embedded_activities = 0x08000000000, //!< allows for using activities (applications with the EMBEDDED flag) in a voice channel p_moderate_members = 0x10000000000, //!< allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels + p_view_creator_monetization_analytics = 0x20000000000, //!< allows for viewing role subscription insights + p_use_soundboard = 0x40000000000, //!< allows for using soundboard in a voice channel }; /** diff --git a/include/dpp/role.h b/include/dpp/role.h index 1fb8f90e4e..e9115a6eb5 100644 --- a/include/dpp/role.h +++ b/include/dpp/role.h @@ -550,6 +550,20 @@ class DPP_EXPORT role : public managed, public json_interface { * @return bool True if user has the moderate users permission or is administrator. */ bool has_moderate_members() const; + /** + * @brief True if has the view creator monetization analytics permission. + * @note Having the administrator permission causes this method to always return true + * Channel specific overrides may apply to permissions. + * @return bool True if user has the view creator monetization analytics permission or is administrator. + */ + bool has_view_creator_monetization_analytics() const; + /** + * @brief True if has the use soundboard permission. + * @note Having the administrator permission causes this method to always return true + * Channel specific overrides may apply to permissions. + * @return bool True if user has the use soundboard permission or is administrator. + */ + bool has_use_soundboard() const; /** * @brief Get guild members who have this role diff --git a/src/dpp/role.cpp b/src/dpp/role.cpp index f91cd0558b..11de340d6b 100644 --- a/src/dpp/role.cpp +++ b/src/dpp/role.cpp @@ -311,6 +311,14 @@ bool role::has_moderate_members() const { return has_administrator() || permissions.has(p_moderate_members); } +bool role::has_view_creator_monetization_analytics() const { + return has_administrator() || permissions.has(p_view_creator_monetization_analytics); +} + +bool role::has_use_soundboard() const { + return has_administrator() || permissions.has(p_use_soundboard); +} + role& role::set_name(const std::string& n) { name = utility::validate(n, 1, 100, "Role name too short"); return *this; From 3fd859d4cca2c7edc785cd744063f017ae056622 Mon Sep 17 00:00:00 2001 From: Phil B Date: Sat, 1 Apr 2023 22:27:42 +0200 Subject: [PATCH 2/2] feat: added APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE application flag --- include/dpp/application.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/dpp/application.h b/include/dpp/application.h index 7c32c6dce1..e4346a4f87 100644 --- a/include/dpp/application.h +++ b/include/dpp/application.h @@ -45,6 +45,8 @@ enum team_member_status : uint8_t { * @brief Flags for a bot or application */ enum application_flags : uint32_t { + /// Indicates if an app uses the Auto Moderation API + apf_application_automod_rule_create_badge = (1 << 6), /// Has gateway presence intent apf_gateway_presence = (1 << 12), /// Has gateway presence intent for <100 guilds