Struct CommandBuilder

Source
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>

Source

pub fn new( name: impl Into<String>, description: impl Into<String>, kind: CommandType, ) -> Self

Source

pub fn handler( self, handler: fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>, ) -> Self

Source

pub fn group(self, group: SubCommandGroupBuilder<T>) -> Self

Source

pub fn subcommand(self, command: SubCommandBuilder<T>) -> Self

Source

pub fn guild_id(self, guild_id: Id<GuildMarker>) -> Self

Source

pub fn default_member_permissions( self, default_member_permissions: Permissions, ) -> Self

Source

pub fn contexts( self, contexts: impl IntoIterator<Item = InteractionContextType>, ) -> Self

Source

pub fn nsfw(self, nsfw: bool) -> Self

Source

pub fn description_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)>, ) -> Self

Source

pub fn name_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)>, ) -> Self

Source

pub fn integration_types( self, integration_types: impl IntoIterator<Item = ApplicationIntegrationType>, ) -> Self

Source

pub fn option(self, option: impl Into<CommandOption>) -> Self

Source

pub fn build(self) -> Command

Trait Implementations§

Source§

impl<T: Clone + Clone + Send + Sync> Clone for CommandBuilder<T>

Source§

fn clone(&self) -> CommandBuilder<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Clone + Send + Sync> Debug for CommandBuilder<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone + Send + Sync> From<CommandBuilder<T>> for Command

Source§

fn from(value: CommandBuilder<T>) -> Self

Converts to this type from the input type.

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more