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
17
18
use crate::Client;
use crate::errors::Result;
use crate::raw::functions;

use super::check_folder_invite_link::slug;

impl Client {
    /// Joins a shared folder by invite link, with every chat in it you haven't joined.
    ///
    /// Accepts the full link or its slug, and calls [`Client::check_folder_invite_link`] first.
    pub async fn join_folder(&self, invite_link: &str) -> Result<()> {
        let slug = slug(invite_link)?.to_owned();
        let info = self.check_folder_invite_link(invite_link).await?;
        let peers = self.resolve_peers(info.missing_chats.iter().map(|c| c.id)).await?;
        self.invoke(&functions::chatlists::JoinChatlistInvite { slug, peers }).await?;
        Ok(())
    }
}