Struct twilight_util::builder::command::CommandBuilder
source · pub struct CommandBuilder(/* private fields */);
Available on crate feature
builder
only.Expand description
Builder to create a [Command
].
Implementations§
source§impl CommandBuilder
impl CommandBuilder
sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
kind: CommandType
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, kind: CommandType ) -> Self
Create a new default [Command
] builder.
sourcepub fn validate(self) -> Result<Self, CommandValidationError>
pub fn validate(self) -> Result<Self, CommandValidationError>
Ensure the command is valid.
Errors
Refer to the errors section of [twilight_validate::command::command
]
for possible errors.
sourcepub const fn guild_id(self, guild_id: Id<GuildMarker>) -> Self
pub const fn guild_id(self, guild_id: Id<GuildMarker>) -> Self
Set the guild ID of the command.
Defaults to None
.
sourcepub const fn default_member_permissions(
self,
default_member_permissions: Permissions
) -> Self
pub const fn default_member_permissions( self, default_member_permissions: Permissions ) -> Self
Set the default member permission required to run the command.
Defaults to None
.
sourcepub const fn dm_permission(self, dm_permission: bool) -> Self
pub const fn dm_permission(self, dm_permission: bool) -> Self
Set whether the command is available in DMs.
Defaults to None
.
sourcepub fn description_localizations<K: Into<String>, V: Into<String>>(
self,
localizations: impl IntoIterator<Item = (K, V)>
) -> Self
pub fn description_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)> ) -> Self
Set the localization dictionary for the command description.
Defaults to None
.
sourcepub fn name_localizations<K: Into<String>, V: Into<String>>(
self,
localizations: impl IntoIterator<Item = (K, V)>
) -> Self
pub fn name_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)> ) -> Self
Set the localization dictionary for the command name.
Defaults to None
.
Trait Implementations§
source§impl Clone for CommandBuilder
impl Clone for CommandBuilder
source§fn clone(&self) -> CommandBuilder
fn clone(&self) -> CommandBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for CommandBuilder
impl Send for CommandBuilder
impl Sync for CommandBuilder
impl Unpin for CommandBuilder
impl UnwindSafe for CommandBuilder
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