Skip to content

Struct SlashCommand

zaun_bot::SlashCommand · Struct

pub struct SlashCommand(…)

Builds an [ApplicationCommand]: a slash command, or a user or message context command.

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

A slash command. name: 1–32 lowercase letters, digits, - or _; description: 1–100.

pub fn user<impl Into<String>>(name: impl Into<String>) -> Self

A user context-menu command (“Apps → name” on a member).

pub fn message<impl Into<String>>(name: impl Into<String>) -> Self

A message context-menu command.

pub fn option(self, option: CommandOptionBuilder) -> Self

Adds an option (≤ 25; required ones first).

pub fn sub_command(self, sub: SubCommand) -> Self

Adds a sub-command.

pub fn group(self, group: SubCommandGroup) -> Self

Adds a group of sub-commands.

pub fn default_member_permissions(self, bits: u64) -> Self

Bits the invoker needs in the channel; 0 makes it owner-only.

pub fn localized_name(self, locale: &str, name: &str) -> Self

Adds a translated name (BCP 47 locale).

pub fn build(self) -> ApplicationCommand

The finished command.

Clone, Debug

Full rustdoc page