Simplify InlineKeyboardButton construction

This commit is contained in:
Hirrolot 2022-04-25 01:38:55 +06:00
parent f555d1d2d3
commit 52678b187c

View file

@ -115,13 +115,13 @@ async fn receive_full_name(
) -> HandlerResult {
match msg.text().map(ToOwned::to_owned) {
Some(full_name) => {
let products = InlineKeyboardMarkup::default().append_row(
vec!["Apple", "Banana", "Orange", "Potato"].into_iter().map(|product| {
let products = ["Apple", "Banana", "Orange", "Potato"].map(|product| {
InlineKeyboardButton::callback(product.to_owned(), product.to_owned())
}),
);
});
bot.send_message(msg.chat.id, "Select a product:").reply_markup(products).await?;
bot.send_message(msg.chat.id, "Select a product:")
.reply_markup(InlineKeyboardMarkup::new([products]))
.await?;
dialogue.update(State::ReceiveProductChoice { full_name }).await?;
}
None => {