Merge pull request #601 from teloxide/use-dialogue-chat-id-purchase

Use `dialogue.chat_id()` in `examples/purchase.rs`
This commit is contained in:
Hirrolot 2022-04-24 23:21:43 +06:00 committed by GitHub
commit aaee7451f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@
// ```
use teloxide::{
dispatching::dialogue::{self, GetChatId, InMemStorage},
dispatching::dialogue::{self, InMemStorage},
prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup},
utils::command::BotCommands,
@ -124,14 +124,12 @@ async fn receive_product_selection(
full_name: String,
) -> HandlerResult {
if let Some(product) = &q.data {
if let Some(chat_id) = q.chat_id() {
bot.send_message(
chat_id,
format!("{full_name}, product '{product}' has been purchased successfully!"),
)
.await?;
dialogue.exit().await?;
}
bot.send_message(
dialogue.chat_id(),
format!("{full_name}, product '{product}' has been purchased successfully!"),
)
.await?;
dialogue.exit().await?;
}
Ok(())