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§
- Create an attachment option with a builder.
- Create a boolean option with a builder.
- Create a channel option with a builder.
- Builder to create a
Command
. - Create a integer option with a builder.
- Create a mentionable option with a builder.
- Create a number option with a builder.
- Create a role option with a builder.
- Create a string option with a builder.
- Create a subcommand option with a builder.
- Create a subcommand group option with a builder.
- Create a user option with a builder.