vaegram 0.2.0

Telegram MTProto client library for users and bots
Documentation
use crate::Client;
use crate::errors::Result;
use crate::raw::{base, functions};
use crate::types::{KeyboardButton, PeerRef};

impl Client {
    /// Prepares a keyboard button that the bot's Mini App can ask `user_id` to press.
    ///
    /// Returns the request id Telegram assigns to the prepared button.
    pub async fn save_prepared_keyboard_button(
        &self,
        user_id: impl Into<PeerRef>,
        button: &KeyboardButton,
    ) -> Result<String> {
        let user_id = self.resolve_user(&user_id.into()).await?;
        let request = functions::bots::RequestWebViewButton { user_id, button: button.write() };
        let base::bots::RequestedButton::RequestedButton(b) = self.invoke(&request).await?;
        Ok(b.webapp_req_id)
    }
}