Tgbot2:User、Chat对象

User对象

FieldTypeDescription
idIntegerUnique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
is_botBooleanTrue, if this user is a bot
first_nameStringUser’s or bot’s first name
last_nameStringOptional. User’s or bot’s last name
usernameStringOptional. User’s or bot’s username
language_codeStringOptional. IETF language tag of the user’s language
is_premiumTrueOptional. True, if this user is a Telegram Premium user
added_to_attachment_menuTrueOptional. True, if this user added the bot to the attachment menu
can_join_groupsBooleanOptional. True, if the bot can be invited to groups. Returned only in getMe.
can_read_all_group_messagesBooleanOptional. True, if privacy mode is disabled for the bot. Returned only in getMe.
supports_inline_queriesBooleanOptional. True, if the bot supports inline queries. Returned only in getMe.
Bot API响应中使用的所有类型都表示为JSON-对象。

Chat对象

FieldTypeDescription
idIntegerUnique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
typeStringType of chat, can be either “private”, “group”, “supergroup” or “channel”
titleStringOptional. Title, for supergroups, channels and group chats
usernameStringOptional. Username, for private chats, supergroups and channels if available
first_nameStringOptional. First name of the other party in a private chat
last_nameStringOptional. Last name of the other party in a private chat
is_forumTrueOptional. True, if the supergroup chat is a forum (has topics enabled)
photoChatPhotoOptional. Chat photo. Returned only in getChat.
active_usernamesArray of StringOptional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.
available_reactionsArray of ReactionTypeOptional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat.
accent_color_idIntegerOptional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat.
background_custom_emoji_idStringOptional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat.
profile_accent_color_idIntegerOptional. Identifier of the accent color for the chat’s profile background. See profile accent colors for more details. Returned only in getChat.
profile_background_custom_emoji_idStringOptional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat.
emoji_status_custom_emoji_idStringOptional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat.
emoji_status_expiration_dateIntegerOptional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in getChat.
bioStringOptional. Bio of the other party in a private chat. Returned only in getChat.
has_private_forwardsTrueOptional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat.
has_restricted_voice_and_video_messagesTrueOptional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
join_to_send_messagesTrueOptional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
join_by_requestTrueOptional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
descriptionStringOptional. Description, for groups, supergroups and channel chats. Returned only in getChat.
invite_linkStringOptional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
pinned_messageMessageOptional. The most recent pinned message (by sending date). Returned only in getChat.
permissionsChatPermissionsOptional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
slow_mode_delayIntegerOptional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat.
unrestrict_boost_countIntegerOptional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat.
message_auto_delete_timeIntegerOptional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
has_aggressive_anti_spam_enabledTrueOptional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.
has_hidden_membersTrueOptional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.
has_protected_contentTrueOptional. True, if messages from the chat can’t be forwarded to other chats. Returned only in getChat.
has_visible_historyTrueOptional. True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat.
sticker_set_nameStringOptional. For supergroups, name of group sticker set. Returned only in getChat.
can_set_sticker_setTrueOptional. True, if the bot can change the group sticker set. Returned only in getChat.
custom_emoji_sticker_set_nameStringOptional. For supergroups, the name of the group’s custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat.
linked_chat_idIntegerOptional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
locationChatLocationOptional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
此对象表示聊天。

属于什么分类:

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注