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

impl Client {
    /// Returns the wallpapers saved to the account.
    pub async fn get_wallpapers(&self) -> Result<Vec<ChatBackground>> {
        match self.invoke(&functions::account::GetWallPapers { hash: 0 }).await? {
            base::account::WallPapers::WallPapers(w) => {
                Ok(w.wallpapers.into_iter().map(ChatBackground::parse).collect())
            }
            base::account::WallPapers::WallPapersNotModified => Ok(Vec::new()),
        }
    }
}