mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Simplify InlineKeyboardButton
construction
This commit is contained in:
parent
f555d1d2d3
commit
52678b187c
1 changed files with 6 additions and 6 deletions
|
@ -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| {
|
||||
InlineKeyboardButton::callback(product.to_owned(), product.to_owned())
|
||||
}),
|
||||
);
|
||||
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 => {
|
||||
|
|
Loading…
Reference in a new issue