Skip to content

Commit

Permalink
new apis for inline switch and web app
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Jun 25, 2024
1 parent e55ff19 commit 87a8095
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orzklv"
version = "0.0.5"
version = "0.0.6"
edition = "2021"
homepage = "https://github.com/orzklv/liborzklv"
repository = "https://github.com/orzklv/liborzklv"
Expand Down
22 changes: 22 additions & 0 deletions src/telegram/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ impl Keyboard {
pub fn get(&self) -> InlineKeyboardMarkup {
InlineKeyboardMarkup::new(self.keyboard.clone())
}

pub fn switch_inline_current(&mut self, text: &str, query: &str) -> InlineKeyboardMarkup {
self.keyboard.last_mut().unwrap().push(
InlineKeyboardButton::switch_inline_query_current_chat(text, query),
);

self.get()
}

pub fn web_app(&mut self, text: &str, link: &str) -> InlineKeyboardMarkup {
self.keyboard
.last_mut()
.unwrap()
.push(InlineKeyboardButton::web_app(
text,
WebAppInfo {
url: Url::from_str(link).unwrap(),
},
));

self.get()
}
}

#[cfg(test)]
Expand Down

0 comments on commit 87a8095

Please sign in to comment.