Module command

Source
Available on crate feature builder only.
Expand description

Create a [Command] with a builder.

§Examples

use twilight_model::application::command::CommandType;
use twilight_util::builder::command::{BooleanBuilder, CommandBuilder, StringBuilder};

CommandBuilder::new(
    "blep",
    "Send a random adorable animal photo",
    CommandType::ChatInput,
)
.option(
    StringBuilder::new("animal", "The type of animal")
        .required(true)
        .choices([
            ("Dog", "animal_dog"),
            ("Cat", "animal_cat"),
            ("Penguin", "animal_penguin"),
        ]),
)
.option(BooleanBuilder::new(
    "only_smol",
    "Whether to show only baby animals",
));
use twilight_model::application::command::CommandType;
use twilight_util::builder::command::{CommandBuilder, NumberBuilder};

CommandBuilder::new(
    "birthday",
    "Wish a friend a happy birthday",
    CommandType::ChatInput,
)
.name_localizations([("zh-CN", "生日"), ("el", "γενέθλια")])
.description_localizations([("zh-Cn", "祝你朋友生日快乐")])
.option(
    NumberBuilder::new("age", "Your friend's age")
        .name_localizations([("zh-CN", "岁数")])
        .description_localizations([("zh-CN", "你朋友的岁数")]),
);

Structs§

AttachmentBuilder
Create an attachment option with a builder.
BooleanBuilder
Create a boolean option with a builder.
ChannelBuilder
Create a channel option with a builder.
CommandBuilder
Builder to create a [Command].
IntegerBuilder
Create a integer option with a builder.
MentionableBuilder
Create a mentionable option with a builder.
NumberBuilder
Create a number option with a builder.
RoleBuilder
Create a role option with a builder.
StringBuilder
Create a string option with a builder.
SubCommandBuilder
Create a subcommand option with a builder.
SubCommandGroupBuilder
Create a subcommand group option with a builder.
UserBuilder
Create a user option with a builder.