# Struct SlashCommand

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

`zaun_bot::SlashCommand` · Struct

```rust
pub struct SlashCommand(…)
```

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

## Methods

### `new`

```rust
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.

### `user`

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

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

### `message`

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

A message context-menu command.

### `option`

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

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

### `sub_command`

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

Adds a sub-command.

### `group`

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

Adds a group of sub-commands.

### `default_member_permissions`

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

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

### `localized_name`

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

Adds a translated name (BCP 47 locale).

### `build`

```rust
pub fn build(self) -> ApplicationCommand
```

The finished command.

## Trait implementations

`Clone`, `Debug`

[Full rustdoc page](/docs/api/rust/zaun-bot/zaun_bot/command/struct.SlashCommand.html)
