Skip to content

Commit

Permalink
feat(Edit): add inline keyboard func
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitroPodolsky committed Mar 3, 2024
1 parent 8b965d9 commit 551170b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/telegram/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,26 @@ pub fn pages(page: usize) -> Vec<Vec<InlineKeyboardButton>> {

pub fn get_telegram_user_id(msg: &MyDialogue) -> String {
return msg.chat_id().to_string()
}

pub fn edit_buttons() -> Vec<Vec<InlineKeyboardButton>> {
let edit_keys = vec!["Deadline", "Description", "TaskName", "Category"];
let finish_button = InlineKeyboardButton::callback("Finish", "finish");

let mut inlines_buttons = vec![];

let edit_buttons = edit_keys
.iter()
.map(|button| {
InlineKeyboardButton::callback(
button.to_string(),
button.to_string().to_lowercase(),
)
})
.collect::<Vec<_>>();

inlines_buttons.push(edit_buttons);
inlines_buttons.push(vec![finish_button]);

inlines_buttons
}

0 comments on commit 551170b

Please sign in to comment.