mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Update README.md
This commit is contained in:
parent
5000c4cec4
commit
56c1c55f88
1 changed files with 5 additions and 3 deletions
|
@ -125,7 +125,7 @@ Commands are strongly typed and defined declaratively, similar to how we define
|
|||
([Full](examples/simple_commands.rs))
|
||||
|
||||
```rust,no_run
|
||||
use teloxide::{prelude::*, utils::command::BotCommand};
|
||||
use teloxide::{prelude::*, utils::command::BotCommands};
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
|
@ -139,7 +139,7 @@ async fn main() {
|
|||
teloxide::commands_repl(bot, answer, Command::ty()).await;
|
||||
}
|
||||
|
||||
#[derive(BotCommand, Clone)]
|
||||
#[derive(BotCommands, Clone)]
|
||||
#[command(rename = "lowercase", description = "These commands are supported:")]
|
||||
enum Command {
|
||||
#[command(description = "display this text.")]
|
||||
|
@ -156,7 +156,9 @@ async fn answer(
|
|||
command: Command,
|
||||
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
match command {
|
||||
Command::Help => bot.send_message(message.chat.id, Command::descriptions().to_string()).await?,
|
||||
Command::Help => {
|
||||
bot.send_message(message.chat.id, Command::descriptions().to_string()).await?
|
||||
}
|
||||
Command::Username(username) => {
|
||||
bot.send_message(message.chat.id, format!("Your username is @{}.", username)).await?
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue