pub struct SlashCommand(/* private fields */);Expand description
Builds an ApplicationCommand: a slash command, or a user or message context command.
Implementations§
Source§impl SlashCommand
impl SlashCommand
Sourcepub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
A slash command. name: 1–32 lowercase letters, digits, - or _; description:
1–100.
Sourcepub fn user(name: impl Into<String>) -> Self
pub fn user(name: impl Into<String>) -> Self
A user context-menu command (“Apps → name” on a member).
Sourcepub fn option(self, option: CommandOptionBuilder) -> Self
pub fn option(self, option: CommandOptionBuilder) -> Self
Adds an option (≤ 25; required ones first).
Sourcepub fn sub_command(self, sub: SubCommand) -> Self
pub fn sub_command(self, sub: SubCommand) -> Self
Adds a sub-command.
Sourcepub fn group(self, group: SubCommandGroup) -> Self
pub fn group(self, group: SubCommandGroup) -> Self
Adds a group of sub-commands.
Sourcepub fn default_member_permissions(self, bits: u64) -> Self
pub fn default_member_permissions(self, bits: u64) -> Self
Bits the invoker needs in the channel; 0 makes it owner-only.
Sourcepub fn localized_name(self, locale: &str, name: &str) -> Self
pub fn localized_name(self, locale: &str, name: &str) -> Self
Adds a translated name (BCP 47 locale).
Sourcepub fn build(self) -> ApplicationCommand
pub fn build(self) -> ApplicationCommand
The finished command.
Trait Implementations§
Source§impl Clone for SlashCommand
impl Clone for SlashCommand
Source§fn clone(&self) -> SlashCommand
fn clone(&self) -> SlashCommand
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Freeze for SlashCommand
impl RefUnwindSafe for SlashCommand
impl Send for SlashCommand
impl Sync for SlashCommand
impl Unpin for SlashCommand
impl UnsafeUnpin for SlashCommand
impl UnwindSafe for SlashCommand
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