blob: abe7f2e6275bd56fde5b753261a0ec741ea3e2e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
use std::error::Error;
use teloxide::prelude::*;
use teloxide::utils::command::BotCommand;
#[derive(BotCommand)]
#[command(rename = "lowercase", description = "These commands are supported:")]
enum Command {
#[command(description = "display this text")]
Help,
}
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(())
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
teloxide::enable_logging!();
log::info!("Starting bot...");
let bot = Bot::from_env().auto_send();
teloxide::commands_repl(bot, "unict-reservation", handler).await;
Ok(())
}
|