#[non_exhaustive]pub struct CommandPermission {
pub id: GenericId,
pub kind: CommandPermissionType,
pub permission: bool,
}Expand description
One command permission: allows or denies a command for a role, user or channel.
discord.js counterpart: ApplicationCommandPermissions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: GenericIdThe role, user or channel; see everyone and
all_channels for the special values.
kind: CommandPermissionTypeWhat id refers to.
permission: booltrue to allow, false to deny.
Implementations§
Source§impl CommandPermission
impl CommandPermission
Sourcepub const fn new(
id: GenericId,
kind: CommandPermissionType,
permission: bool,
) -> Self
pub const fn new( id: GenericId, kind: CommandPermissionType, permission: bool, ) -> Self
Creates a permission.
discord.js counterpart: ApplicationCommandPermissions.
Sourcepub const fn everyone(guild_id: GuildId) -> GenericId
pub const fn everyone(guild_id: GuildId) -> GenericId
The ID that stands for @everyone (all members) in guild_id: the guild ID itself.
discord.js counterpart: Guild#roles.everyone’s ID (the guild’s ID).
Sourcepub const fn all_channels(guild_id: GuildId) -> Option<GenericId>
pub const fn all_channels(guild_id: GuildId) -> Option<GenericId>
The ID that stands for all channels in guild_id: the guild ID minus one, or None
for the (impossible) guild ID 1.
discord.js counterpart: none (discord.js leaves the guild ID minus one to the bot).
Trait Implementations§
Source§impl Clone for CommandPermission
impl Clone for CommandPermission
impl Copy for CommandPermission
Source§impl Debug for CommandPermission
impl Debug for CommandPermission
Source§impl<'de> Deserialize<'de> for CommandPermission
impl<'de> Deserialize<'de> for CommandPermission
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CommandPermission
Source§impl Hash for CommandPermission
impl Hash for CommandPermission
Source§impl PartialEq for CommandPermission
impl PartialEq for CommandPermission
Source§impl Serialize for CommandPermission
impl Serialize for CommandPermission
impl StructuralPartialEq for CommandPermission
Auto Trait Implementations§
impl Freeze for CommandPermission
impl RefUnwindSafe for CommandPermission
impl Send for CommandPermission
impl Sync for CommandPermission
impl Unpin for CommandPermission
impl UnsafeUnpin for CommandPermission
impl UnwindSafe for CommandPermission
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more