Skip to content

Commit

Permalink
feat: added APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE application…
Browse files Browse the repository at this point in the history
… flag (#644)
  • Loading branch information
braindigitalis authored Apr 2, 2023
2 parents 808ef85 + 3fd859d commit 1aee2b5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/dpp/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions include/dpp/permissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/**
Expand Down
14 changes: 14 additions & 0 deletions include/dpp/role.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,20 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
* @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
Expand Down
8 changes: 8 additions & 0 deletions src/dpp/role.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1aee2b5

Please # to comment.