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
use crate::Client;
use crate::errors::Result;
use crate::methods::pages::wire_limit;
use crate::raw::{base, functions};
use crate::types::ReactionType;

impl Client {
    /// Returns the reactions Telegram lists as top reactions, up to `limit`.
    pub async fn get_top_reactions(&self, limit: usize) -> Result<Vec<ReactionType>> {
        match self.invoke(&functions::messages::GetTopReactions { limit: wire_limit(limit), hash: 0 }).await? {
            base::messages::Reactions::Reactions(r) => Ok(r.reactions.iter().filter_map(ReactionType::parse).collect()),
            base::messages::Reactions::ReactionsNotModified => Ok(Vec::new()),
        }
    }
}