Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(model): Add new USE_SOUNDBOARD, MANAGE_GUILD_EXPRESSIONS and VIEW_CREATOR_MONETIZATION_ANALYTICS permissions #2180

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion twilight-model/src/guild/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ bitflags! {
const MANAGE_NICKNAMES = 1 << 27;
const MANAGE_ROLES = 1 << 28;
const MANAGE_WEBHOOKS = 1 << 29;
#[deprecated(since = "0.15.2", note = "use `MANAGE_GUILD_EXPRESSIONS` instead")]
const MANAGE_EMOJIS_AND_STICKERS = 1 << 30;
/// Allows management and editing of emojis, stickers, and soundboard sounds.
const MANAGE_GUILD_EXPRESSIONS = 1 << 30;
const USE_SLASH_COMMANDS = 1 << 31;
const REQUEST_TO_SPEAK = 1 << 32;
/// Allows for creating, editing, and deleting scheduled events.
Expand All @@ -65,6 +68,10 @@ bitflags! {
///
/// [Guild Timeouts]: https://support.discord.com/hc/en-us/articles/4413305239191-Time-Out-FAQ
const MODERATE_MEMBERS = 1 << 40;
/// Allows for viewing role subscription insights.
const VIEW_CREATOR_MONETIZATION_ANALYTICS = 1 << 41;
/// Allows for using the soundboard in a voice channel
zeylahellyer marked this conversation as resolved.
Show resolved Hide resolved
const USE_SOUNDBOARD = 1 << 42;
}
}

Expand Down Expand Up @@ -176,7 +183,7 @@ mod tests {
const_assert_eq!(Permissions::MANAGE_NICKNAMES.bits(), 1 << 27);
const_assert_eq!(Permissions::MANAGE_ROLES.bits(), 1 << 28);
const_assert_eq!(Permissions::MANAGE_WEBHOOKS.bits(), 1 << 29);
const_assert_eq!(Permissions::MANAGE_EMOJIS_AND_STICKERS.bits(), 1 << 30);
const_assert_eq!(Permissions::MANAGE_GUILD_EXPRESSIONS.bits(), 1 << 30);
const_assert_eq!(Permissions::USE_SLASH_COMMANDS.bits(), 1 << 31);
const_assert_eq!(Permissions::REQUEST_TO_SPEAK.bits(), 1 << 32);
const_assert_eq!(Permissions::MANAGE_EVENTS.bits(), 1 << 33);
Expand All @@ -187,6 +194,11 @@ mod tests {
const_assert_eq!(Permissions::SEND_MESSAGES_IN_THREADS.bits(), 1 << 38);
const_assert_eq!(Permissions::USE_EMBEDDED_ACTIVITIES.bits(), 1 << 39);
const_assert_eq!(Permissions::MODERATE_MEMBERS.bits(), 1 << 40);
const_assert_eq!(
Permissions::VIEW_CREATOR_MONETIZATION_ANALYTICS.bits(),
1 << 41
);
const_assert_eq!(Permissions::USE_SOUNDBOARD.bits(), 1 << 42);

#[test]
fn serde() {
Expand Down
6 changes: 3 additions & 3 deletions twilight-util/src/permission_calculator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'a> PermissionCalculator<'a> {
/// permissions.
///
/// **Note** that this method will not return guild-level permissions such
/// as [Manage Emojis and Stickers]; if you need the guild-level permissions
/// as [Manage Guild Expressions]; if you need the guild-level permissions
/// use [`root`].
///
/// # Conditional exclusions
Expand Down Expand Up @@ -310,7 +310,7 @@ impl<'a> PermissionCalculator<'a> {
/// - [Ban Members]
/// - [Change Nickname]
/// - [Kick Members]
/// - [Manage Emojis and Stickers]
/// - [Manage Guild Expressions]
/// - [Manage Guild]
/// - [Manage Nicknames]
/// - [View Audit Log]
Expand All @@ -333,7 +333,7 @@ impl<'a> PermissionCalculator<'a> {
/// [Deafen Members]: twilight_model::guild::Permissions::DEAFEN_MEMBERS
/// [Embed Links]: twilight_model::guild::Permissions::EMBED_LINKS
/// [Kick Members]: twilight_model::guild::Permissions::KICK_MEMBERS
/// [Manage Emojis and Stickers]: twilight_model::guild::Permissions::MANAGE_EMOJIS_AND_STICKERS
/// [Manage Guild Expressions]: twilight_model::guild::Permissions::MANAGE_GUILD_EXPRESSIONS
/// [Manage Guild]: twilight_model::guild::Permissions::MANAGE_GUILD
/// [Manage Messages]: twilight_model::guild::Permissions::MANAGE_MESSAGES
/// [Manage Nicknames]: twilight_model::guild::Permissions::MANAGE_NICKNAMES
Expand Down
2 changes: 1 addition & 1 deletion twilight-util/src/permission_calculator/preset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub const PERMISSIONS_ROOT_ONLY: Permissions = Permissions::from_bits_truncate(
| Permissions::BAN_MEMBERS.bits()
| Permissions::CHANGE_NICKNAME.bits()
| Permissions::KICK_MEMBERS.bits()
| Permissions::MANAGE_EMOJIS_AND_STICKERS.bits()
| Permissions::MANAGE_GUILD_EXPRESSIONS.bits()
| Permissions::MANAGE_GUILD.bits()
| Permissions::MANAGE_NICKNAMES.bits()
| Permissions::VIEW_AUDIT_LOG.bits()
Expand Down