diff options
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r-- | src/callbacks.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs index a82d5e9..53ae07c 100644 --- a/src/callbacks.rs +++ b/src/callbacks.rs @@ -49,6 +49,48 @@ pub async fn handler( } } }, + "space" => unsafe { + // Select the sapce + match browser::select_option("select2-results__option", "data-select2-id", call[2]) + .await + { + Ok(result) => { + if result { + let timetable = browser::get_timetable().await.unwrap(); + let keyboard = make_inline_keyboard( + &timetable, + "timetable", + chat_id.parse::<i64>().unwrap(), + ) + .await; + + // Edit the previous spaces message with timetable' buttons + cx.requester + .edit_message_text( + chat_id.to_string(), + cx.update.message.clone().unwrap().id, + "When?", + ) + .await?; + + cx.requester + .edit_message_reply_markup( + chat_id.to_string(), + cx.update.message.clone().unwrap().id, + ) + .reply_markup(keyboard) + .await?; + + return Ok(true); + } else { + return Ok(false); + } + } + Err(_) => { + return Ok(false); + } + } + }, _ => Ok(false), } } |