Skip to content

Struct CommandOptionBuilder

zaun_bot::CommandOptionBuilder · Struct

pub struct CommandOptionBuilder(…)

Builds a CommandOption.

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

An option of kind. name: 1–32 lowercase; description: 1–100.

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

A text option.

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

An integer option.

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

A member option.

pub fn required(self) -> Self

Must be filled.

pub fn autocomplete(self) -> Self

Ask the bot for suggestions as the invoker types (Bot::on_autocomplete).

pub fn choice<impl Into<String>, impl Into<String>>(self, name: impl Into<String>, value: impl Into<String>) -> Self

Adds a fixed text choice (≤ 25; not with autocomplete).

pub fn range(self, min: f64, max: f64) -> Self

Numeric bounds (integer and number options).

pub fn length(self, min: u16, max: u16) -> Self

Length bounds (text options, 0–6 000).

pub fn build(self) -> CommandOption

The finished option.

Clone, Debug

Full rustdoc page