vaegram 0.2.0

Telegram MTProto client library for users and bots
Documentation
use crate::Client;
use crate::errors::Result;
use crate::raw::functions;
use crate::types::PeerRef;

impl Client {
    /// Approves every pending join request of the chat, or only those made through `invite_link`.
    pub async fn approve_all_chat_join_requests(
        &self,
        chat_id: impl Into<PeerRef>,
        invite_link: Option<&str>,
    ) -> Result<()> {
        self.hide_all_chat_join_requests(chat_id.into(), invite_link, true).await
    }

    pub(super) async fn hide_all_chat_join_requests(
        &self,
        chat_id: PeerRef,
        invite_link: Option<&str>,
        approved: bool,
    ) -> Result<()> {
        let request = functions::messages::HideAllChatJoinRequests {
            approved,
            peer: self.resolve_peer(chat_id).await?,
            link: invite_link.map(str::to_owned),
        };
        self.invoke(&request).await?;
        Ok(())
    }
}