Skip to content

Commit

Permalink
feat: Implement clyde AI permission bits (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis authored Aug 31, 2023
1 parent e32e13b commit 96e61db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/dpp/permissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ enum permissions : uint64_t {
p_use_soundboard = 0x40000000000, //!< allows for using soundboard in a voice channel
p_use_external_sounds = 0x0000200000000000, //!< allows the usage of custom soundboard sounds from other servers
p_send_voice_messages = 0x0000400000000000, //!< allows sending voice messages
p_use_clyde_ai = 0x0000800000000000, //!< allows use of Clyde AI
};

/**
Expand Down
7 changes: 7 additions & 0 deletions include/dpp/role.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,13 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
* @return bool True if user has the send voice messages permission or is administrator.
*/
bool has_send_voice_messages() const;
/**
* @brief True if has permission to use clyde AI.
* @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 clyde AI permission or is administrator.
*/
bool has_use_clyde_ai() const;

/**
* @brief Get guild members who have this role
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/role.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ bool role::has_send_voice_messages() const {
return has_administrator() || permissions.has(p_send_voice_messages);
}

bool role::has_use_clyde_ai() const {
return has_administrator() || permissions.has(p_use_clyde_ai);
}

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 96e61db

Please sign in to comment.