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

impl Client {
    /// Returns the statistics Telegram keeps for a broadcast channel.
    pub async fn get_channel_statistics(&self, chat_id: impl Into<PeerRef>) -> Result<ChannelStatistics> {
        let channel = self.resolve_channel(&chat_id.into()).await?;
        let stats = self.invoke(&functions::stats::GetBroadcastStats { dark: false, channel }).await?;
        Ok(ChannelStatistics::parse(stats))
    }
}