pub struct CommandBuilder<T: Clone + Send + Sync> {Show 14 fields
pub name: String,
pub name_localizations: Option<HashMap<String, String>>,
pub description: String,
pub description_localizations: Option<HashMap<String, String>>,
pub kind: CommandType,
pub guild_id: Option<Id<GuildMarker>>,
pub default_member_permissions: Option<Permissions>,
pub contexts: Option<Vec<InteractionContextType>>,
pub integration_types: Option<Vec<ApplicationIntegrationType>>,
pub nsfw: Option<bool>,
pub func: Option<fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>>,
pub groups: Vec<SubCommandGroupBuilder<T>>,
pub subcommands: Vec<SubCommandBuilder<T>>,
pub options: Vec<CommandOption>,
}
Fields§
§name: String
§name_localizations: Option<HashMap<String, String>>
§description: String
§description_localizations: Option<HashMap<String, String>>
§kind: CommandType
§guild_id: Option<Id<GuildMarker>>
§default_member_permissions: Option<Permissions>
§contexts: Option<Vec<InteractionContextType>>
§integration_types: Option<Vec<ApplicationIntegrationType>>
§nsfw: Option<bool>
§func: Option<fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>>
§groups: Vec<SubCommandGroupBuilder<T>>
§subcommands: Vec<SubCommandBuilder<T>>
§options: Vec<CommandOption>
Implementations§
Source§impl<T: Clone + Send + Sync> CommandBuilder<T>
impl<T: Clone + Send + Sync> CommandBuilder<T>
pub fn new( name: impl Into<String>, description: impl Into<String>, kind: CommandType, ) -> Self
pub fn handler( self, handler: fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>, ) -> Self
pub fn group(self, group: SubCommandGroupBuilder<T>) -> Self
pub fn subcommand(self, command: SubCommandBuilder<T>) -> Self
pub fn guild_id(self, guild_id: Id<GuildMarker>) -> Self
pub fn default_member_permissions( self, default_member_permissions: Permissions, ) -> Self
pub fn contexts( self, contexts: impl IntoIterator<Item = InteractionContextType>, ) -> Self
pub fn nsfw(self, nsfw: bool) -> Self
pub fn description_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
pub fn integration_types( self, integration_types: impl IntoIterator<Item = ApplicationIntegrationType>, ) -> Self
pub fn option(self, option: impl Into<CommandOption>) -> Self
pub fn build(self) -> Command
Trait Implementations§
Source§impl<T: Clone + Clone + Send + Sync> Clone for CommandBuilder<T>
impl<T: Clone + Clone + Send + Sync> Clone for CommandBuilder<T>
Source§fn clone(&self) -> CommandBuilder<T>
fn clone(&self) -> CommandBuilder<T>
Returns a duplicate 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<T> Freeze for CommandBuilder<T>
impl<T> RefUnwindSafe for CommandBuilder<T>
impl<T> Send for CommandBuilder<T>
impl<T> Sync for CommandBuilder<T>
impl<T> Unpin for CommandBuilder<T>
impl<T> UnwindSafe for CommandBuilder<T>
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