vaegram 0.2.0

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

impl Client {
    /// Pins a forum topic to the top of the topic list.
    pub async fn pin_forum_topic(&self, chat_id: impl Into<PeerRef>, topic_id: i32) -> Result<()> {
        self.toggle_forum_topic_pin(chat_id, topic_id, true).await
    }

    pub(crate) async fn toggle_forum_topic_pin(
        &self,
        chat_id: impl Into<PeerRef>,
        topic_id: i32,
        pinned: bool,
    ) -> Result<()> {
        let peer = self.resolve_peer(chat_id).await?;
        self.invoke(&functions::messages::UpdatePinnedForumTopic { peer, topic_id, pinned }).await?;
        Ok(())
    }
}