mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +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 {
|
) -> HandlerResult {
|
||||||
match msg.text().map(ToOwned::to_owned) {
|
match msg.text().map(ToOwned::to_owned) {
|
||||||
Some(full_name) => {
|
Some(full_name) => {
|
||||||
let products = InlineKeyboardMarkup::default().append_row(
|
let products = ["Apple", "Banana", "Orange", "Potato"].map(|product| {
|
||||||
vec!["Apple", "Banana", "Orange", "Potato"].into_iter().map(|product| {
|
InlineKeyboardButton::callback(product.to_owned(), product.to_owned())
|
||||||
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?;
|
dialogue.update(State::ReceiveProductChoice { full_name }).await?;
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue