mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Fix command parsing in examples/button.rs
This commit is contained in:
parent
6d668ec06b
commit
f39180543e
1 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,7 @@ use teloxide::{
|
|||
prelude::*,
|
||||
types::{
|
||||
InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputMessageContent,
|
||||
InputMessageContentText,
|
||||
InputMessageContentText, Me,
|
||||
},
|
||||
utils::command::BotCommands,
|
||||
};
|
||||
|
@ -61,9 +61,10 @@ fn make_keyboard() -> InlineKeyboardMarkup {
|
|||
async fn message_handler(
|
||||
m: Message,
|
||||
bot: AutoSend<Bot>,
|
||||
me: Me,
|
||||
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
if let Some(text) = m.text() {
|
||||
match BotCommands::parse(text, "buttons") {
|
||||
match BotCommands::parse(text, me.username()) {
|
||||
Ok(Command::Help) => {
|
||||
// Just send the description of all commands.
|
||||
bot.send_message(m.chat.id, Command::descriptions().to_string()).await?;
|
||||
|
|
Loading…
Reference in a new issue