#[non_exhaustive]pub struct User {Show 16 fields
pub id: i64,
pub is_bot: bool,
pub first_name: String,
pub last_name: Option<String>,
pub username: Option<String>,
pub language_code: Option<String>,
pub can_join_groups: Option<bool>,
pub can_read_all_group_messages: Option<bool>,
pub supports_inline_queries: Option<bool>,
pub is_premium: Option<bool>,
pub added_to_attachment_menu: Option<bool>,
pub can_connect_to_business: Option<bool>,
pub has_main_web_app: Option<bool>,
pub has_topics_enabled: Option<bool>,
pub allows_users_to_create_topics: Option<bool>,
pub can_manage_bots: Option<bool>,
}Expand description
This object represents a Telegram user or bot.
Corresponds to the Bot API User object.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: i64Unique identifier for this user or bot.
is_bot: booltrue if this user is a bot.
first_name: StringUser’s or bot’s first name.
last_name: Option<String>User’s or bot’s last name.
username: Option<String>User’s or bot’s username.
language_code: Option<String>IETF language tag of the user’s language.
can_join_groups: Option<bool>true if the bot can be invited to groups.
Returned only in getMe.
can_read_all_group_messages: Option<bool>true if privacy mode is disabled for the bot.
Returned only in getMe.
supports_inline_queries: Option<bool>true if the bot supports inline queries.
Returned only in getMe.
true if this user is a Telegram Premium user.
true if this user added the bot to the attachment menu.
can_connect_to_business: Option<bool>true if the bot can be connected to a Telegram Business account.
Returned only in getMe.
has_main_web_app: Option<bool>true if the bot has the main Web App.
Returned only in getMe.
has_topics_enabled: Option<bool>true if the bot has forum topic mode enabled in private chats.
Returned only in getMe.
allows_users_to_create_topics: Option<bool>true if the bot allows users to create and delete topics in private chats.
Returned only in getMe.
can_manage_bots: Option<bool>true if the bot can manage other bots.
Returned only in getMe.
Added in Bot API 9.6.
Implementations§
Source§impl User
impl User
Sourcepub fn new(id: i64, is_bot: bool, first_name: impl Into<String>) -> User
pub fn new(id: i64, is_bot: bool, first_name: impl Into<String>) -> User
Create a new User with the required fields.
All optional fields default to None.
Sourcepub fn mention_html(&self, name: Option<&str>) -> String
pub fn mention_html(&self, name: Option<&str>) -> String
Returns an HTML <a> tag that mentions this user.
If name is None, the user’s first name is used as the display text.
Sourcepub fn mention_markdown(&self, name: Option<&str>) -> String
pub fn mention_markdown(&self, name: Option<&str>) -> String
Returns a Markdown link that mentions this user.
If name is None, the user’s first name is used as the display text.
Sourcepub fn mention_markdown_v2(&self, name: Option<&str>) -> String
pub fn mention_markdown_v2(&self, name: Option<&str>) -> String
Returns a MarkdownV2-safe link that mentions this user.
If name is None, the user’s first name is used as the display text.
Note: The caller is responsible for escaping name for MarkdownV2.