vaegram 0.2.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::raw::functions;
use crate::types::PeerRef;

impl Client {
    /// Sets the chat you send as by default in a chat. See [`Client::get_send_as_chats`].
    pub async fn set_send_as_chat(
        &self,
        chat_id: impl Into<PeerRef>,
        send_as_chat_id: impl Into<PeerRef>,
    ) -> Result<()> {
        let peer = self.resolve_peer(chat_id).await?;
        let send_as = self.resolve_peer(send_as_chat_id).await?;
        self.invoke(&functions::messages::SaveDefaultSendAs { peer, send_as }).await?;
        Ok(())
    }
}