Skip to content

Commit 372ab76

Browse files
authored
feat: added missing permissions (#1501)
1 parent ab82bc1 commit 372ab76

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

include/dpp/permissions.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,22 @@ enum permissions : uint64_t {
251251
*/
252252
p_use_soundboard = 0x40000000000,
253253

254+
/**
255+
* @brief Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user.
256+
*
257+
* @note Not yet available to developers.
258+
* @see https://discord.com/developers/docs/change-log#clarification-on-permission-splits-for-expressions-and-events
259+
*/
260+
p_create_guild_expressions = 0x80000000000,
261+
262+
/**
263+
* @brief Allows for creating scheduled events, and editing and deleting those created by the current user.
264+
*
265+
* @note Not yet available to developers.
266+
* @see https://discord.com/developers/docs/change-log#clarification-on-permission-splits-for-expressions-and-events
267+
*/
268+
p_create_events = 0x0000100000000000,
269+
254270
/**
255271
* @brief Allows the usage of custom soundboard sounds from other servers.
256272
*/
@@ -266,6 +282,19 @@ enum permissions : uint64_t {
266282
*/
267283
p_use_clyde_ai = 0x0000800000000000,
268284

285+
/**
286+
* @brief Allows sending polls
287+
*/
288+
p_send_polls = 0x0002000000000000,
289+
290+
/**
291+
* @brief Allows user-installed apps to send public responses.
292+
* When disabled, users will still be allowed to use their apps but the responses will be ephemeral.
293+
*
294+
* @note This only applies to apps not also installed to the server.
295+
*/
296+
p_use_external_apps = 0x0004000000000000,
297+
269298
/**
270299
* @brief Allows pinning and unpinning messages
271300
*/

include/dpp/role.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,28 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
801801
*/
802802
bool has_use_soundboard() const;
803803

804+
/**
805+
* @brief True if has the create guild expressions permission.
806+
*
807+
* @note Having the administrator permission causes this method to always return true
808+
* Channel specific overrides may apply to permissions.
809+
*
810+
* @note Not yet available to developers.
811+
* @return bool True if user has the create guild expressions permission or is administrator.
812+
*/
813+
bool has_create_guild_expressions() const;
814+
815+
/**
816+
* @brief True if has the create events permission.
817+
*
818+
* @note Having the administrator permission causes this method to always return true
819+
* Channel specific overrides may apply to permissions.
820+
*
821+
* @note Not yet available to developers.
822+
* @return bool True if user has the create events permission or is administrator.
823+
*/
824+
bool has_create_events() const;
825+
804826
/**
805827
* @brief True if has the use external sounds permission.
806828
*
@@ -828,6 +850,24 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
828850
*/
829851
bool has_use_clyde_ai() const;
830852

853+
/**
854+
* @brief True if has the send polls permission.
855+
*
856+
* @note Having the administrator permission causes this method to always return true
857+
* Channel specific overrides may apply to permissions.
858+
* @return bool True if user has the send polls permission or is administrator.
859+
*/
860+
bool has_send_polls() const;
861+
862+
/**
863+
* @brief True if has the use external apps permission.
864+
*
865+
* @note Having the administrator permission causes this method to always return true
866+
* Channel specific overrides may apply to permissions.
867+
* @return bool True if user has the use external apps permission or is administrator.
868+
*/
869+
bool has_use_external_apps() const;
870+
831871
/**
832872
* @brief True if has permission to use pin messages.
833873
*

src/dpp/role.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,14 @@ bool role::has_use_soundboard() const {
329329
return has_administrator() || permissions.has(p_use_soundboard);
330330
}
331331

332+
bool role::has_create_guild_expressions() const {
333+
return has_administrator() || permissions.has(p_create_guild_expressions);
334+
}
335+
336+
bool role::has_create_events() const {
337+
return has_administrator() || permissions.has(p_create_events);
338+
}
339+
332340
bool role::has_use_external_sounds() const {
333341
return has_administrator() || permissions.has(p_use_external_sounds);
334342
}
@@ -341,6 +349,14 @@ bool role::has_use_clyde_ai() const {
341349
return has_administrator() || permissions.has(p_use_clyde_ai);
342350
}
343351

352+
bool role::has_send_polls() const {
353+
return has_administrator() || permissions.has(p_send_polls);
354+
}
355+
356+
bool role::has_use_external_apps() const {
357+
return has_administrator() || permissions.has(p_use_external_apps);
358+
}
359+
344360
bool role::has_pin_messages() const {
345361
return has_administrator() || permissions.has(p_pin_messages);
346362
}

0 commit comments

Comments
 (0)