apid_telegram_bot/types/user.rs
1use serde::{Deserialize, Serialize};
2
3/// This object represents a Telegram user or bot.
4#[derive(Debug, PartialEq, Serialize, Deserialize)]
5pub struct User {
6 /// Unique identifier for this user or bot.
7 ///
8 /// This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
9 /// But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
10 pub id: i64,
11
12 /// True, if this user is a bot
13 pub is_bot: bool,
14
15 /// User's or bot's first name
16 pub first_name: String,
17
18 /// User's or bot's last name
19 #[serde(skip_serializing_if = "Option::is_none")]
20 pub last_name: Option<String>,
21
22 /// User's or bot's username
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub username: Option<String>,
25
26 /// [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the user's language
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub language_code: Option<String>,
29
30 /// *True*, if this user is a Telegram Premium user
31 #[serde(default, skip_serializing_if = "crate::util::is_false")]
32 pub is_premium: bool,
33
34 /// *True*, if this user added the bot to the attachment menu
35 #[serde(default, skip_serializing_if = "crate::util::is_false")]
36 pub added_to_attachment_menu: bool,
37
38 /// *True*, if the bot can be invited to groups.
39 /// Returned only in [getMe](https://core.telegram.org/bots/api#getme).
40 #[serde(default, skip_serializing_if = "crate::util::is_false")]
41 pub can_join_groups: bool,
42
43 /// *True*, if privacy mode is disabled for the bot.
44 /// Returned only in [getMe](https://core.telegram.org/bots/api#getme).
45 #[serde(default, skip_serializing_if = "crate::util::is_false")]
46 pub can_read_all_group_messages: bool,
47
48 /// *True*, if the bot supports inline queries.
49 /// Returned only in [getMe](https://core.telegram.org/bots/api#getme).
50 #[serde(default, skip_serializing_if = "crate::util::is_false")]
51 pub supports_inline_queries: bool,
52}