summaryrefslogtreecommitdiff
path: root/src/commands.rs
blob: 1aee09893d77be722d392d6435aae42b3f928625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::error::Error;
use teloxide::prelude::{AutoSend, Bot, Message, UpdateWithCx};
use teloxide::utils::command::BotCommand;

#[derive(BotCommand)]
#[command(rename = "lowercase", description = "These commands are supported:")]
pub enum Command {
    #[command(description = "Display this text")]
    Help,
}

pub async fn handler(
    cx: UpdateWithCx<AutoSend<Bot>, Message>,
    command: Command,
) -> Result<(), Box<dyn Error + Send + Sync>> {
    match command {
        Command::Help => cx.answer(Command::descriptions()).await?,
    };
    Ok(())
}