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

impl Client {
    /// Returns the themes available to the account.
    pub async fn get_themes(&self) -> Result<Vec<Theme>> {
        match self.invoke(&functions::account::GetThemes { format: THEME_FORMAT.into(), hash: 0 }).await? {
            base::account::Themes::Themes(t) => Ok(t.themes.into_iter().map(Theme::parse).collect()),
            base::account::Themes::ThemesNotModified => Ok(Vec::new()),
        }
    }
}