vaegram 0.3.0

Telegram MTProto client library for users and bots
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::Client;
use crate::errors::Result;
use crate::methods::accepted;
use crate::raw::{base, functions};
use crate::types::{MenuButton, PeerRef};

impl Client {
    /// Sets the menu button the bot shows in the private chat with a user.
    ///
    /// `None` for `chat_id` sets the default button for all users.
    pub async fn set_chat_menu_button(&self, chat_id: Option<PeerRef>, menu_button: MenuButton) -> Result<()> {
        let user_id = match chat_id {
            Some(id) => self.resolve_user(&id).await?,
            None => base::InputUser::InputUserEmpty,
        };
        accepted(self.invoke(&functions::bots::SetBotMenuButton { user_id, button: menu_button.write() }).await?)
    }
}