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
16
use crate::Client;
use crate::dispatcher::Entities;
use crate::errors::Result;
use crate::raw::{base, functions};
use crate::types::ConnectedBot;

impl Client {
    /// Returns the bots connected to the account's business profile.
    pub async fn get_connected_bots(&self) -> Result<Vec<ConnectedBot>> {
        let base::account::ConnectedBots::ConnectedBots(b) =
            self.invoke(&functions::account::GetConnectedBots {}).await?;
        let b = *b;
        let entities = Entities::new(self, b.users, Vec::new());
        Ok(b.connected_bots.into_iter().map(|bot| ConnectedBot::parse(bot, &entities)).collect())
    }
}