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

impl Client {
    /// Counts you as a viewer of the given stories.
    ///
    /// Fails with `Error::InvalidArgument` if `story_ids` is empty.
    pub async fn view_stories(&self, chat_id: impl Into<PeerRef>, story_ids: &[i32]) -> Result<()> {
        if story_ids.is_empty() {
            return Err(Error::InvalidArgument("view_stories needs at least one story id"));
        }
        let peer = self.resolve_peer(chat_id).await?;
        self.invoke(&functions::stories::IncrementStoryViews { peer, id: story_ids.to_vec() }).await?;
        Ok(())
    }
}