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
use crate::Client;
use crate::errors::{Error, Result};
use crate::raw::functions;
use crate::types::PeerRef;

impl Client {
    /// Unpins stories from a chat's profile and returns the ids that were unpinned.
    ///
    /// Fails with `Error::InvalidArgument` if `story_ids` is empty.
    pub async fn unpin_chat_stories(&self, chat_id: impl Into<PeerRef>, story_ids: &[i32]) -> Result<Vec<i32>> {
        if story_ids.is_empty() {
            return Err(Error::InvalidArgument("unpin_chat_stories needs at least one story id"));
        }
        let peer = self.resolve_peer(chat_id).await?;
        self.invoke(&functions::stories::TogglePinned { peer, id: story_ids.to_vec(), pinned: false }).await
    }
}