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

impl Client {
    /// Returns the boost level of the chat and the boosts needed for the next level.
    pub async fn get_boosts_status(&self, chat_id: impl Into<PeerRef>) -> Result<BoostsStatus> {
        let peer = self.resolve_peer(chat_id).await?;
        let base::premium::BoostsStatus::BoostsStatus(status) =
            self.invoke(&functions::premium::GetBoostsStatus { peer }).await?;
        Ok(BoostsStatus::parse(*status))
    }
}