Added menu endpoints
This commit is contained in:
@@ -24,6 +24,22 @@ pub async fn account_markup(
|
||||
Ok(markup)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn menu_markup(names: impl IntoIterator<Item = String>) -> InlineKeyboardMarkup {
|
||||
let names = names
|
||||
.into_iter()
|
||||
.map(|name| {
|
||||
let hash = <Sha256 as Digest>::digest(name.as_bytes());
|
||||
let mut data = "get ".to_owned();
|
||||
data.reserve(43);
|
||||
B64_ENGINE.encode_string(hash, &mut data);
|
||||
InlineKeyboardButton::callback(name, data)
|
||||
})
|
||||
.chunks(3);
|
||||
|
||||
InlineKeyboardMarkup::new(&names)
|
||||
}
|
||||
|
||||
/// Creates a markup with a "Delete message" button.
|
||||
/// This markup should be added for all messages that won't be deleted afterwards
|
||||
#[inline]
|
||||
|
Reference in New Issue
Block a user