use crate::{Context, Error};
#[derive(Debug, poise::ChoiceParameter)]
pub enum MyStringChoice {
#[name = "The first choice"]
A,
#[name = "The second choice"]
#[name = "A single choice can have multiple names"]
B,
C,
}
#[poise::command(prefix_command, slash_command)]
pub async fn choice(
ctx: Context<'_>,
#[description = "The choice you want to choose"] choice: MyStringChoice,
) -> Result<(), Error> {
ctx.say(format!("You entered {:?}", choice)).await?;
Ok(())
}
#[poise::command(slash_command)]
pub async fn inline_choice(
ctx: Context<'_>,
#[description = "Which continent are you from"]
#[choices("Europe", "Asia", "Africa", "America", "Australia", "Antarctica")]
continent: &'static str,
) -> Result<(), Error> {
ctx.say(format!("{} is a great continent!", continent))
.await?;
Ok(())
}
#[poise::command(slash_command)]
pub async fn inline_choice_int(
ctx: Context<'_>,
#[description = "Choose a number"]
#[choices(1, 2, 3, 4, 5, 4, 3, 2, 1)]
number: u32,
) -> Result<(), Error> {
ctx.say(format!("You chose {}... for better or for worse", number))
.await?;
Ok(())
}