Skip to content

Commit b7367ee

Browse files
authored
feat: Add missing BYPASS_SLOWMODE permission (bit 52) (#1562)
1 parent c468323 commit b7367ee

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

include/dpp/permissions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ enum permissions : uint64_t {
299299
* @brief Allows pinning and unpinning messages
300300
*/
301301
p_pin_messages = 0x0008000000000000,
302+
303+
/**
304+
* @brief Allows members to bypass the slow mode rate limit for sending messages in a channel.
305+
*/
306+
p_bypass_slowmode = 0x0010000000000000,
302307
};
303308

304309
/**

include/dpp/role.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,15 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
877877
*/
878878
bool has_pin_messages() const;
879879

880+
/**
881+
* @brief True if has the bypass slow mode permission.
882+
*
883+
* @note Having the administrator permission causes this method to always return true
884+
* Channel specific overrides may apply to permissions.
885+
* @return bool True if user has the bypass slow mode permission or is administrator.
886+
*/
887+
bool has_bypass_slowmode() const;
888+
880889
/**
881890
* @brief Get guild members who have this role.
882891
*

src/dpp/role.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ bool role::has_pin_messages() const {
361361
return has_administrator() || permissions.has(p_pin_messages);
362362
}
363363

364+
bool role::has_bypass_slowmode() const {
365+
return has_administrator() || permissions.has(p_bypass_slowmode);
366+
}
367+
364368
role& role::set_name(const std::string& n) {
365369
name = utility::validate(n, 1, 100, "Role name too short");
366370
return *this;

0 commit comments

Comments
 (0)