diff --git a/.travis.yml b/.travis.yml index 74c7dfb..aa9a2b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: - 2.4.9 -- 2.6.5 +- 2.7.0 addons: apt: sources: @@ -19,6 +19,7 @@ env: global: secure: DmAoRsr+dTPVNs486nBXzChjzCCVdoxfmSbvqMBBl0v8uuUIZD1rSfYKcEaL5pmE7vgYq3X+3Dk0gf4ef/p2xPVKqFKrkBiF/7t06WgQTH7003gHMLq3aC7R9+1xvqJDzpoc6UB59Y1fOJBe5YfqDuw1dT9a46tzY2uzoVpEpbN8M/hssaKf6Wuzvpz5yekFeXq2raPwi3aOqvkSG+ODoacVdYQgJ4Vn0//CI2HzWijkQCvdsefWQUKkbgtuLWRp3UNy8AEhVWzQnTcSM7oc+MwMsOI/90DZkTP5n2WJl/CFTM5b70VyrIciG92SvTAhhBo/p7t3QBJa6kJMPXAHh5q+3wqVQA411+CoVF48bO5rKjKY3Ply49uqAzVJRh+Tkhf5uC1pHiZ6QKGxu1Czde+mKItBpaDmJFmQi0CSdv2WYXLnJWOQIO6vc2P3liwpMDRDyaGWOQtUYS+gHAlRbD4NPycIkGjkcjmLMqSEEO1TdCpM+CYwTvNTkRS+9HrWXZNdEfWORDYHgYohoIP6kY6XWSgunUb6F6pVxLoPWJNEBEVuIMZeOa/s9oklxBzD5XXIzBx4QsPYanvfxoN1uOcXlBXbOGqwiqb+urokNDw+BzWhbA+xY03U2+yO0Ujh3HQDyMDtrXEQfaPC0SxpEvIINVYwznG4sMKvbOaCVSo= before_install: +- gem install -v 2.1.2 bundler - set -e - cd td - mkdir -p build diff --git a/bin/parser b/bin/parser index 4d048e7..a2f74f8 100755 --- a/bin/parser +++ b/bin/parser @@ -1,9 +1,8 @@ #!/usr/bin/env ruby -require 'open-uri' require 'active_support/all' AUTOLOAD_BASE_DIR = 'tdlib/types' -TD_API_TL_LOCATION = "https://raw.githubusercontent.com/tdlib/td/v1.5.0/td/generate/scheme/td_api.tl" +TD_API_TL_LOCATION = 'td/td/generate/scheme/td_api.tl' def parse_tl_type(type) @@ -221,7 +220,7 @@ klass = <<-RUBY module TD::Types class Base < Dry::Struct # throw an error when unknown keys provided - input input.strict + schema schema.strict # convert string keys to symbols transform_keys(&:to_sym) diff --git a/lib/tdlib/client_methods.rb b/lib/tdlib/client_methods.rb index 7e6bb15..3d860c5 100644 --- a/lib/tdlib/client_methods.rb +++ b/lib/tdlib/client_methods.rb @@ -53,6 +53,22 @@ def add_chat_members(chat_id, user_ids) 'user_ids' => user_ids) end + # Adds a user to the contact list or edits an existing contact by their user identifier. + # + # @param contact [TD::Types::Contact, nil] The contact to add or edit; phone number can be empty and needs to be + # specified only if known, vCard is ignored. + # @param share_phone_number [Boolean] True, if the new contact needs to be allowed to see current user's phone + # number. + # A corresponding rule to {TD::Types::UserPrivacySetting::ShowPhoneNumber} will be added if needed. + # Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be + # asked to share their phone number. + # @return [TD::Types::Ok] + def add_contact(contact = nil, share_phone_number) + broadcast('@type' => 'addContact', + 'contact' => contact, + 'share_phone_number' => share_phone_number) + end + # Adds a custom server language pack to the list of installed language packs in current localization target. # Can be called before authorization. # @@ -101,7 +117,7 @@ def add_local_message(chat_id, sender_user_id, reply_to_message_id, disable_noti # Can be called before authorization. # Can be called synchronously. # - # @param verbosity_level [Integer] Minimum verbosity level needed for the message to be logged, 0-1023. + # @param verbosity_level [Integer] The minimum verbosity level needed for the message to be logged, 0-1023. # @param text [String] Text of a message to log. # @return [TD::Types::Ok] def add_log_message(verbosity_level, text) @@ -275,6 +291,13 @@ def block_user(user_id) 'user_id' => user_id) end + # Checks whether the current session can be used to transfer a chat ownership to another user. + # + # @return [TD::Types::CanTransferOwnershipResult] + def can_transfer_ownership + broadcast('@type' => 'canTransferOwnership') + end + # Stops the downloading of a file. # If a file has already been downloaded, does nothing. # @@ -299,19 +322,6 @@ def cancel_upload_file(file_id) 'file_id' => file_id) end - # Reports to the server whether a chat is a spam chat or not. - # Can be used only if ChatReportSpamState.can_report_spam is true. - # After this request, ChatReportSpamState.can_report_spam becomes false forever. - # - # @param chat_id [Integer] Chat identifier. - # @param is_spam_chat [Boolean] If true, the chat will be reported as spam; otherwise it will be marked as not spam. - # @return [TD::Types::Ok] - def change_chat_report_spam_state(chat_id, is_spam_chat) - broadcast('@type' => 'changeChatReportSpamState', - 'chat_id' => chat_id, - 'is_spam_chat' => is_spam_chat) - end - # Changes imported contacts using the list of current user contacts saved on the device. # Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. # Query result depends on the result of the previous query, so only one query is possible at the same time. @@ -413,6 +423,16 @@ def check_chat_username(chat_id, username) 'username' => username) end + # Checks whether the maximum number of owned public chats has been reached. + # Returns corresponding error if the limit was reached. + # + # @param type [TD::Types::PublicChatType] Type of the public chats, for which to check the limit. + # @return [TD::Types::Ok] + def check_created_public_chats_limit(type) + broadcast('@type' => 'checkCreatedPublicChatsLimit', + 'type' => type) + end + # Checks the database encryption key for correctness. # Works only when the current authorization state is authorizationStateWaitEncryptionKey. # @@ -534,6 +554,17 @@ def close_secret_chat(secret_chat_id) 'secret_chat_id' => secret_chat_id) end + # Confirms QR code authentication on another device. + # Returns created session on success. + # + # @param link [String] A link from a QR code. + # The link must be scanned by the in-app camera. + # @return [TD::Types::Session] + def confirm_qr_code_authentication(link) + broadcast('@type' => 'confirmQrCodeAuthentication', + 'link' => link) + end + # Returns an existing chat corresponding to a known basic group. # # @param basic_group_id [Integer] Basic group identifier. @@ -605,12 +636,14 @@ def create_new_sticker_set(user_id, title, name, is_masks, stickers) # @param title [String] Title of the new chat; 1-128 characters. # @param is_channel [Boolean] True, if a channel chat should be created. # @param description [String] Chat description; 0-255 characters. + # @param location [TD::Types::ChatLocation] Chat location if a location-based supergroup is being created. # @return [TD::Types::Chat] - def create_new_supergroup_chat(title, is_channel, description) + def create_new_supergroup_chat(title, is_channel, description, location) broadcast('@type' => 'createNewSupergroupChat', 'title' => title, 'is_channel' => is_channel, - 'description' => description) + 'description' => description, + 'location' => location) end # Returns an existing chat corresponding to a given user. @@ -685,7 +718,7 @@ def delete_chat_history(chat_id, remove_from_chat_list, revoke) end # Deletes all messages sent by the specified user to a chat. - # Supported only in supergroups; requires can_delete_messages administrator privileges. + # Supported only for supergroups; requires can_delete_messages administrator privileges. # # @param chat_id [Integer] Chat identifier. # @param user_id [Integer] User identifier. @@ -778,7 +811,7 @@ def delete_saved_order_info end # Deletes a supergroup or channel along with all messages in the corresponding chat. - # This will release the supergroup or channel username and remove all members; requires creator privileges in the + # This will release the supergroup or channel username and remove all members; requires owner privileges in the # supergroup or channel. # Chats with more than 1000 members can't be deleted using this method. # @@ -1011,6 +1044,21 @@ def edit_message_reply_markup(chat_id, message_id, reply_markup) 'reply_markup' => reply_markup) end + # Edits the time when a scheduled message will be sent. + # Scheduling state of all messages in the same album or forwarded together with the message will be also changed. + # + # @param chat_id [Integer] The chat the message belongs to. + # @param message_id [Integer] Identifier of the message. + # @param scheduling_state [TD::Types::MessageSchedulingState] The new message scheduling state. + # Pass null to send the message immediately. + # @return [TD::Types::Ok] + def edit_message_scheduling_state(chat_id, message_id, scheduling_state) + broadcast('@type' => 'editMessageSchedulingState', + 'chat_id' => chat_id, + 'message_id' => message_id, + 'scheduling_state' => scheduling_state) + end + # Edits the text of a message (or a text of a game message). # Returns the edited message after the edit is completed on the server side. # @@ -1075,9 +1123,7 @@ def finish_file_generation(generation_id, error) # @param chat_id [Integer] Identifier of the chat to which to forward messages. # @param from_chat_id [Integer] Identifier of the chat from which to forward messages. # @param message_ids [Array] Identifiers of the messages to forward. - # @param disable_notification [Boolean] Pass true to disable notification for the message, doesn't work if messages - # are forwarded to a secret chat. - # @param from_background [Boolean] Pass true if the messages are sent from the background. + # @param options [TD::Types::SendMessageOptions] Options to be used to send the messages. # @param as_album [Boolean] True, if the messages should be grouped into an album after forwarding. # For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages. # @param send_copy [Boolean] True, if content of the messages needs to be copied without links to the original @@ -1086,17 +1132,15 @@ def finish_file_generation(generation_id, error) # @param remove_caption [Boolean] True, if media captions of message copies needs to be removed. # Ignored if send_copy is false. # @return [TD::Types::Messages] - def forward_messages(chat_id, from_chat_id, message_ids, disable_notification, from_background, as_album, send_copy, - remove_caption) - broadcast('@type' => 'forwardMessages', - 'chat_id' => chat_id, - 'from_chat_id' => from_chat_id, - 'message_ids' => message_ids, - 'disable_notification' => disable_notification, - 'from_background' => from_background, - 'as_album' => as_album, - 'send_copy' => send_copy, - 'remove_caption' => remove_caption) + def forward_messages(chat_id, from_chat_id, message_ids, options, as_album, send_copy, remove_caption) + broadcast('@type' => 'forwardMessages', + 'chat_id' => chat_id, + 'from_chat_id' => from_chat_id, + 'message_ids' => message_ids, + 'options' => options, + 'as_album' => as_album, + 'send_copy' => send_copy, + 'remove_caption' => remove_caption) end # Generates a new invite link for a chat; the previously generated link is revoked. @@ -1153,7 +1197,7 @@ def get_application_config # # @param is_masks [Boolean] Pass true to return mask stickers sets; pass false to return ordinary sticker sets. # @param offset_sticker_set_id [Integer] Identifier of the sticker set from which to return the result. - # @param limit [Integer] Maximum number of sticker sets to return. + # @param limit [Integer] The maximum number of sticker sets to return. # @return [TD::Types::StickerSets] def get_archived_sticker_sets(is_masks, offset_sticker_set_id, limit) broadcast('@type' => 'getArchivedStickerSets', @@ -1230,7 +1274,7 @@ def get_basic_group_full_info(basic_group_id) # Returns users that were blocked by the current user. # # @param offset [Integer] Number of users to skip in the result; must be non-negative. - # @param limit [Integer] Maximum number of users to return; up to 100. + # @param limit [Integer] The maximum number of users to return; up to 100. # @return [TD::Types::Users] def get_blocked_users(offset, limit) broadcast('@type' => 'getBlockedUsers', @@ -1261,17 +1305,17 @@ def get_chat(chat_id) 'chat_id' => chat_id) end - # Returns a list of users who are administrators of the chat. + # Returns a list of administrators of the chat with their custom titles. # # @param chat_id [Integer] Chat identifier. - # @return [TD::Types::Users] + # @return [TD::Types::ChatAdministrators] def get_chat_administrators(chat_id) broadcast('@type' => 'getChatAdministrators', 'chat_id' => chat_id) end # Returns a list of service actions taken by chat members and administrators in the last 48 hours. - # Available only in supergroups and channels. + # Available only for supergroups and channels. # Requires administrator rights. # Returns results in reverse chronological order (i. # e., in order of decreasing event_id). @@ -1280,7 +1324,7 @@ def get_chat_administrators(chat_id) # @param query [String] Search query by which to filter events. # @param from_event_id [Integer] Identifier of an event from which to return results. # Use 0 to get results from the latest events. - # @param limit [Integer] Maximum number of events to return; up to 100. + # @param limit [Integer] The maximum number of events to return; up to 100. # @param filters [TD::Types::ChatEventLogFilters] The types of events to return. # By default, all types will be returned. # @param user_ids [Array] User identifiers by which to filter events. @@ -1381,17 +1425,19 @@ def get_chat_pinned_message(chat_id) 'chat_id' => chat_id) end - # Returns information on whether the current chat can be reported as spam. + # Returns all scheduled messages in a chat. + # The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). # # @param chat_id [Integer] Chat identifier. - # @return [TD::Types::ChatReportSpamState] - def get_chat_report_spam_state(chat_id) - broadcast('@type' => 'getChatReportSpamState', + # @return [TD::Types::Messages] + def get_chat_scheduled_messages(chat_id) + broadcast('@type' => 'getChatScheduledMessages', 'chat_id' => chat_id) end # Returns an HTTP URL with the chat statistics. # Currently this method can be used only for channels. + # Can be used only if SupergroupFullInfo.can_view_statistics == true. # # @param chat_id [Integer] Chat identifier. # @param parameters [String] Parameters from "tg://statsrefresh?params=******" link. @@ -1404,19 +1450,21 @@ def get_chat_statistics_url(chat_id, parameters, is_dark) 'is_dark' => is_dark) end - # Returns an ordered list of chats. + # Returns an ordered list of chats in a chat list. # Chats are sorted by the pair (order, chat_id) in decreasing order. # (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed # 64-bit number 9223372036854775807 == 2^63 - 1). # For optimal performance the number of returned chats is chosen by the library. # + # @param chat_list [TD::Types::ChatList] The chat list in which to return chats. # @param offset_order [Integer] Chat order to return chats from. # @param offset_chat_id [Integer] Chat identifier to return chats from. # @param limit [Integer] The maximum number of chats to be returned. # It is possible that fewer chats than the limit are returned even if the end of the list is not reached. # @return [TD::Types::Chats] - def get_chats(offset_order, offset_chat_id, limit) + def get_chats(chat_list, offset_order, offset_chat_id, limit) broadcast('@type' => 'getChats', + 'chat_list' => chat_list, 'offset_order' => offset_order, 'offset_chat_id' => offset_chat_id, 'limit' => limit) @@ -1445,11 +1493,13 @@ def get_country_code broadcast('@type' => 'getCountryCode') end - # Returns a list of public chats with username created by the user. + # Returns a list of public chats of the specified type, owned by the user. # + # @param type [TD::Types::PublicChatType] Type of the public chats to return. # @return [TD::Types::Chats] - def get_created_public_chats - broadcast('@type' => 'getCreatedPublicChats') + def get_created_public_chats(type) + broadcast('@type' => 'getCreatedPublicChats', + 'type' => type) end # Returns all updates needed to restore current TDLib state, i.e. @@ -1565,7 +1615,7 @@ def get_game_high_scores(chat_id, message_id, user_id) # # @param user_id [Integer] User identifier. # @param offset_chat_id [Integer] Chat identifier starting from which to return chats; use 0 for the first request. - # @param limit [Integer] Maximum number of chats to be returned; up to 100. + # @param limit [Integer] The maximum number of chats to be returned; up to 100. # @return [TD::Types::Chats] def get_groups_in_common(user_id, offset_chat_id, limit) broadcast('@type' => 'getGroupsInCommon', @@ -1581,6 +1631,15 @@ def get_imported_contact_count broadcast('@type' => 'getImportedContactCount') end + # Returns a list of recently inactive supergroups and channels. + # Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH + # error. + # + # @return [TD::Types::Chats] + def get_inactive_supergroup_chats + broadcast('@type' => 'getInactiveSupergroupChats') + end + # Returns game high scores and some part of the high score table in the range of the specified user; for bots only. # # @param inline_message_id [String] Inline message identifier. @@ -1596,7 +1655,7 @@ def get_inline_game_high_scores(inline_message_id, user_id) # Returns an error with code 502 if the bot fails to answer the query before the query timeout expires. # # @param bot_user_id [Integer] The identifier of the target bot. - # @param chat_id [Integer] Identifier of the chat, where the query was sent. + # @param chat_id [Integer] Identifier of the chat where the query was sent. # @param user_location [TD::Types::Location] Location of the user, only if needed. # @param query [String] Text of the query. # @param offset [String] Offset of the first entry to return. @@ -1748,6 +1807,38 @@ def get_log_verbosity_level broadcast('@type' => 'getLogVerbosityLevel') end + # Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline + # button of type inlineKeyboardButtonTypeLoginUrl. + # Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. + # If an error is returned, then the button must be handled as an ordinary URL button. + # + # @param chat_id [Integer] Chat identifier of the message with the button. + # @param message_id [Integer] Message identifier of the message with the button. + # @param button_id [Integer] Button identifier. + # @param allow_write_access [Boolean] True, if the user allowed the bot to send them messages. + # @return [TD::Types::HttpUrl] + def get_login_url(chat_id, message_id, button_id, allow_write_access) + broadcast('@type' => 'getLoginUrl', + 'chat_id' => chat_id, + 'message_id' => message_id, + 'button_id' => button_id, + 'allow_write_access' => allow_write_access) + end + + # Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. + # The method needs to be called when the user presses the button. + # + # @param chat_id [Integer] Chat identifier of the message with the button. + # @param message_id [Integer] Message identifier of the message with the button. + # @param button_id [Integer] Button identifier. + # @return [TD::Types::LoginUrlInfo] + def get_login_url_info(chat_id, message_id, button_id) + broadcast('@type' => 'getLoginUrlInfo', + 'chat_id' => chat_id, + 'message_id' => message_id, + 'button_id' => button_id) + end + # Returns information about a file with a map thumbnail in PNG format. # Only map thumbnail files with size less than 1MB can be downloaded. # @@ -1955,7 +2046,7 @@ def get_proxy_link(proxy_id) end # Returns a public HTTPS link to a message. - # Available only for messages in supergroups and channels with username. + # Available only for messages in supergroups and channels with a username. # # @param chat_id [Integer] Identifier of the chat to which the message belongs. # @param message_id [Integer] Identifier of the message. @@ -2019,6 +2110,9 @@ def get_recovery_email_address(password) # Returns information about a file by its remote ID; this is an offline request. # Can be used to register a URL as a file for further uploading, or sending as a message. + # Even the request succeeds, the file can be used only if it is still accessible to the user. + # For example, if the file is from a message, then the message must be not deleted and accessible to the user. + # If the file database is disabled, then the corresponding object with the file must be preloaded by the client. # # @param remote_file_id [String] Remote identifier of the file to get. # @param file_type [TD::Types::FileType] File type, if known. @@ -2099,7 +2193,7 @@ def get_sticker_set(set_id) # # @param emoji [String] String representation of emoji. # If empty, returns all known installed stickers. - # @param limit [Integer] Maximum number of stickers to be returned. + # @param limit [Integer] The maximum number of stickers to be returned. # @return [TD::Types::Stickers] def get_stickers(emoji, limit) broadcast('@type' => 'getStickers', @@ -2110,8 +2204,8 @@ def get_stickers(emoji, limit) # Returns storage usage statistics. # Can be called before authorization. # - # @param chat_limit [Integer] Maximum number of chats with the largest storage usage for which separate statistics - # should be returned. + # @param chat_limit [Integer] The maximum number of chats with the largest storage usage for which separate + # statistics should be returned. # All other chats will be grouped in entries with chat_id == 0. # If the chat info database is not used, the chat_limit is ignored and is always set to 0. # @return [TD::Types::StorageStatistics] @@ -2128,7 +2222,15 @@ def get_storage_statistics_fast broadcast('@type' => 'getStorageStatisticsFast') end - # Returns information about a supergroup or channel by its identifier. + # Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. + # Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group. + # + # @return [TD::Types::Chats] + def get_suitable_discussion_chats + broadcast('@type' => 'getSuitableDiscussionChats') + end + + # Returns information about a supergroup or a channel by its identifier. # This is an offline request if the current user is not a bot. # # @param supergroup_id [Integer] Supergroup or channel identifier. @@ -2138,7 +2240,7 @@ def get_supergroup(supergroup_id) 'supergroup_id' => supergroup_id) end - # Returns full information about a supergroup or channel by its identifier, cached for up to 1 minute. + # Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute. # # @param supergroup_id [Integer] Supergroup or channel identifier. # @return [TD::Types::SupergroupFullInfo] @@ -2191,11 +2293,18 @@ def get_text_entities(text) 'text' => text) end + # Returns a salt to be used with locally stored password to access a local TON-based wallet. + # + # @return [TD::Types::TonWalletPasswordSalt] + def get_ton_wallet_password_salt + broadcast('@type' => 'getTonWalletPasswordSalt') + end + # Returns a list of frequently used chats. # Supported only if the chat info database is enabled. # # @param category [TD::Types::TopChatCategory] Category of chats to be returned. - # @param limit [Integer] Maximum number of chats to be returned; up to 30. + # @param limit [Integer] The maximum number of chats to be returned; up to 30. # @return [TD::Types::Chats] def get_top_chats(category, limit) broadcast('@type' => 'getTopChats', @@ -2243,7 +2352,7 @@ def get_user_privacy_setting_rules(setting) # # @param user_id [Integer] User identifier. # @param offset [Integer] The number of photos to skip; must be non-negative. - # @param limit [Integer] Maximum number of photos to be returned; up to 100. + # @param limit [Integer] The maximum number of photos to be returned; up to 100. # @return [TD::Types::UserProfilePhotos] def get_user_profile_photos(user_id, offset, limit) broadcast('@type' => 'getUserProfilePhotos', @@ -2275,9 +2384,9 @@ def get_web_page_preview(text) 'text' => text) end - # Adds new contacts or edits existing contacts; contacts' user identifiers are ignored. + # Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored. # - # @param contacts [Array] The list of contacts to import or edit, contact's vCard are ignored and + # @param contacts [Array] The list of contacts to import or edit; contacts' vCard are ignored and # are not imported. # @return [TD::Types::ImportedContacts] def import_contacts(contacts) @@ -2385,7 +2494,8 @@ def optimize_storage(size, ttl, count, immunity_delay, file_types, chat_ids, exc 'chat_limit' => chat_limit) end - # Parses Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text. + # Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in + # the text. # This is an offline method. # Can be called before authorization. # Can be called synchronously. @@ -2515,6 +2625,15 @@ def remove_background(background_id) 'background_id' => background_id) end + # Removes a chat action bar without any other action. + # + # @param chat_id [Integer] Chat identifier. + # @return [TD::Types::Ok] + def remove_chat_action_bar(chat_id) + broadcast('@type' => 'removeChatActionBar', + 'chat_id' => chat_id) + end + # Removes users from the contact list. # # @param user_ids [Array] Identifiers of users to be deleted. @@ -2549,7 +2668,7 @@ def remove_notification(notification_group_id, notification_id) # Needs to be called only if the notification group is removed by the current user. # # @param notification_group_id [Integer] Notification group identifier. - # @param max_notification_id [Integer] Maximum identifier of removed notifications. + # @param max_notification_id [Integer] The maximum identifier of removed notifications. # @return [TD::Types::Ok] def remove_notification_group(notification_group_id, max_notification_id) broadcast('@type' => 'removeNotificationGroup', @@ -2642,7 +2761,7 @@ def reorder_installed_sticker_sets(is_masks, sticker_set_ids) # Reports a chat to the Telegram moderators. # Supported only for supergroups, channels, or private chats with bots, since other chats can't be checked by - # moderators. + # moderators, or when the report is done from the chat action bar. # # @param chat_id [Integer] Chat identifier. # @param reason [TD::Types::ChatReportReason] The reason for reporting the chat. @@ -2684,6 +2803,16 @@ def request_password_recovery broadcast('@type' => 'requestPasswordRecovery') end + # Requests QR code authentication by scanning a QR code on another logged in device. + # Works only when the current authorization state is authorizationStateWaitPhoneNumber. + # + # @param other_user_ids [Array] List of user identifiers of other users currently using the client. + # @return [TD::Types::Ok] + def request_qr_code_authentication(other_user_ids) + broadcast('@type' => 'requestQrCodeAuthentication', + 'other_user_ids' => other_user_ids) + end + # Re-sends an authentication code to the user. # Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result # is not null. @@ -2865,7 +2994,7 @@ def search_chat_messages(chat_id, query, sender_user_id, from_message_id, offset # Returns up to 1 location message per user. # # @param chat_id [Integer] Chat identifier. - # @param limit [Integer] Maximum number of messages to be returned. + # @param limit [Integer] The maximum number of messages to be returned. # @return [TD::Types::Messages] def search_chat_recent_location_messages(chat_id, limit) broadcast('@type' => 'searchChatRecentLocationMessages', @@ -2878,7 +3007,7 @@ def search_chat_recent_location_messages(chat_id, limit) # # @param query [String] Query to search for. # If the query is empty, returns up to 20 recently found chats. - # @param limit [Integer] Maximum number of chats to be returned. + # @param limit [Integer] The maximum number of chats to be returned. # @return [TD::Types::Chats] def search_chats(query, limit) broadcast('@type' => 'searchChats', @@ -2886,11 +3015,22 @@ def search_chats(query, limit) 'limit' => limit) end + # Returns a list of users and location-based supergroups nearby. + # The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. + # The request should be sent again every 25 seconds with adjusted location to not miss new chats. + # + # @param location [TD::Types::Location] Current user location. + # @return [TD::Types::ChatsNearby] + def search_chats_nearby(location) + broadcast('@type' => 'searchChatsNearby', + 'location' => location) + end + # Searches for the specified query in the title and username of already known chats via request to the server. # Returns chats in the order seen in the chat list. # # @param query [String] Query to search for. - # @param limit [Integer] Maximum number of chats to be returned. + # @param limit [Integer] The maximum number of chats to be returned. # @return [TD::Types::Chats] def search_chats_on_server(query, limit) broadcast('@type' => 'searchChatsOnServer', @@ -2901,7 +3041,7 @@ def search_chats_on_server(query, limit) # Searches for the specified query in the first names, last names and usernames of the known user contacts. # # @param query [String, nil] Query to search for; may be empty to return all contacts. - # @param limit [Integer] Maximum number of users to be returned. + # @param limit [Integer] The maximum number of users to be returned. # @return [TD::Types::Users] def search_contacts(query = nil, limit) broadcast('@type' => 'searchContacts', @@ -2914,17 +3054,19 @@ def search_contacts(query = nil, limit) # # @param text [String] Text to search for. # @param exact_match [Boolean] True, if only emojis, which exactly match text needs to be returned. + # @param input_language_code [String, nil] IETF language tag of the user's input language; can be empty if unknown. # @return [TD::Types::Emojis] - def search_emojis(text, exact_match) - broadcast('@type' => 'searchEmojis', - 'text' => text, - 'exact_match' => exact_match) + def search_emojis(text, exact_match, input_language_code = nil) + broadcast('@type' => 'searchEmojis', + 'text' => text, + 'exact_match' => exact_match, + 'input_language_code' => input_language_code) end # Searches for recently used hashtags by their prefix. # # @param prefix [String] Hashtag prefix to search for. - # @param limit [Integer] Maximum number of hashtags to be returned. + # @param limit [Integer] The maximum number of hashtags to be returned. # @return [TD::Types::Hashtags] def search_hashtags(prefix, limit) broadcast('@type' => 'searchHashtags', @@ -2936,7 +3078,7 @@ def search_hashtags(prefix, limit) # # @param is_masks [Boolean] Pass true to return mask sticker sets; pass false to return ordinary sticker sets. # @param query [String] Query to search for. - # @param limit [Integer] Maximum number of sticker sets to return. + # @param limit [Integer] The maximum number of sticker sets to return. # @return [TD::Types::StickerSets] def search_installed_sticker_sets(is_masks, query, limit) broadcast('@type' => 'searchInstalledStickerSets', @@ -2949,6 +3091,8 @@ def search_installed_sticker_sets(is_masks, query, limit) # Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). # For optimal performance the number of returned messages is chosen by the library. # + # @param chat_list [TD::Types::ChatList] Chat list in which to search messages; pass null to search in all chats + # regardless of their chat list. # @param query [String] Query to search for. # @param offset_date [Integer] The date of the message starting from which the results should be fetched. # Use 0 or any date in the future to get results from the last message. @@ -2958,8 +3102,9 @@ def search_installed_sticker_sets(is_masks, query, limit) # Fewer messages may be returned than specified by the limit, even if the end of the message history has not been # reached. # @return [TD::Types::Messages] - def search_messages(query, offset_date, offset_chat_id, offset_message_id, limit) + def search_messages(chat_list, query, offset_date, offset_chat_id, offset_message_id, limit) broadcast('@type' => 'searchMessages', + 'chat_list' => chat_list, 'query' => query, 'offset_date' => offset_date, 'offset_chat_id' => offset_chat_id, @@ -3001,7 +3146,7 @@ def search_public_chats(query) # If empty, searchChatMessages should be used instead. # @param from_search_id [Integer] The identifier from the result of a previous request, use 0 to get results from the # last message. - # @param limit [Integer] Maximum number of messages to be returned; up to 100. + # @param limit [Integer] The maximum number of messages to be returned; up to 100. # Fewer messages may be returned than specified by the limit, even if the end of the message history has not been # reached. # @param filter [TD::Types::SearchMessagesFilter] A filter for the content of messages in the search results. @@ -3037,7 +3182,7 @@ def search_sticker_sets(query) # Searches for stickers from public sticker sets that correspond to a given emoji. # # @param emoji [String] String representation of emoji; must be non-empty. - # @param limit [Integer, nil] Maximum number of stickers to be returned. + # @param limit [Integer, nil] The maximum number of stickers to be returned. # @return [TD::Types::Stickers] def search_stickers(emoji, limit = nil) broadcast('@type' => 'searchStickers', @@ -3148,25 +3293,21 @@ def send_email_address_verification_code(email_address) # # @param chat_id [Integer] Target chat. # @param reply_to_message_id [Integer] Identifier of a message to reply to or 0. - # @param disable_notification [Boolean] Pass true to disable notification for the message. - # Not supported in secret chats. - # @param from_background [Boolean] Pass true if the message is sent from background. + # @param options [TD::Types::SendMessageOptions] Options to be used to send the message. # @param query_id [Integer] Identifier of the inline query. # @param result_id [String] Identifier of the inline result. # @param hide_via_bot [Boolean] If true, there will be no mention of a bot, via which the message is sent. # Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and # GetOption("venue_search_bot_username"). # @return [TD::Types::Message] - def send_inline_query_result_message(chat_id, reply_to_message_id, disable_notification, from_background, query_id, - result_id, hide_via_bot) - broadcast('@type' => 'sendInlineQueryResultMessage', - 'chat_id' => chat_id, - 'reply_to_message_id' => reply_to_message_id, - 'disable_notification' => disable_notification, - 'from_background' => from_background, - 'query_id' => query_id, - 'result_id' => result_id, - 'hide_via_bot' => hide_via_bot) + def send_inline_query_result_message(chat_id, reply_to_message_id, options, query_id, result_id, hide_via_bot) + broadcast('@type' => 'sendInlineQueryResultMessage', + 'chat_id' => chat_id, + 'reply_to_message_id' => reply_to_message_id, + 'options' => options, + 'query_id' => query_id, + 'result_id' => result_id, + 'hide_via_bot' => hide_via_bot) end # Sends a message. @@ -3174,19 +3315,15 @@ def send_inline_query_result_message(chat_id, reply_to_message_id, disable_notif # # @param chat_id [Integer] Target chat. # @param reply_to_message_id [Integer] Identifier of the message to reply to or 0. - # @param disable_notification [Boolean] Pass true to disable notification for the message. - # Not supported in secret chats. - # @param from_background [Boolean] Pass true if the message is sent from the background. + # @param options [TD::Types::SendMessageOptions] Options to be used to send the message. # @param reply_markup [TD::Types::ReplyMarkup] Markup for replying to the message; for bots only. # @param input_message_content [TD::Types::InputMessageContent] The content of the message to be sent. # @return [TD::Types::Message] - def send_message(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, - input_message_content) + def send_message(chat_id, reply_to_message_id, options, reply_markup, input_message_content) broadcast('@type' => 'sendMessage', 'chat_id' => chat_id, 'reply_to_message_id' => reply_to_message_id, - 'disable_notification' => disable_notification, - 'from_background' => from_background, + 'options' => options, 'reply_markup' => reply_markup, 'input_message_content' => input_message_content) end @@ -3197,17 +3334,14 @@ def send_message(chat_id, reply_to_message_id, disable_notification, from_backgr # # @param chat_id [Integer] Target chat. # @param reply_to_message_id [Integer] Identifier of a message to reply to or 0. - # @param disable_notification [Boolean] Pass true to disable notification for the messages. - # Not supported in secret chats. - # @param from_background [Boolean] Pass true if the messages are sent from the background. + # @param options [TD::Types::SendMessageOptions] Options to be used to send the messages. # @param input_message_contents [Array] Contents of messages to be sent. # @return [TD::Types::Messages] - def send_message_album(chat_id, reply_to_message_id, disable_notification, from_background, input_message_contents) + def send_message_album(chat_id, reply_to_message_id, options, input_message_contents) broadcast('@type' => 'sendMessageAlbum', 'chat_id' => chat_id, 'reply_to_message_id' => reply_to_message_id, - 'disable_notification' => disable_notification, - 'from_background' => from_background, + 'options' => options, 'input_message_contents' => input_message_contents) end @@ -3270,6 +3404,16 @@ def send_phone_number_verification_code(phone_number, settings) 'settings' => settings) end + # Sends a request to TON lite server through Telegram servers. + # Can be called before authorization. + # + # @param request [String] The request. + # @return [TD::Types::TonLiteServerResponse] + def send_ton_lite_server_request(request) + broadcast('@type' => 'sendTonLiteServerRequest', + 'request' => request) + end + # Changes the period of inactivity after which the account of the current user will automatically be deleted. # # @param ttl [TD::Types::AccountTtl] New account TTL. @@ -3318,7 +3462,7 @@ def set_auto_download_settings(settings, type) # Changes the background selected by the user; adds background to the list of installed backgrounds. # - # @param background [TD::Types::InputBackground] The input background to use, null for solid backgrounds. + # @param background [TD::Types::InputBackground] The input background to use, null for filled backgrounds. # @param type [TD::Types::BackgroundType] Background type; null for default background. # The method will return error 404 if type is null. # @param for_dark_theme [Boolean] True, if the background is chosen for dark theme. @@ -3351,6 +3495,18 @@ def set_bot_updates_status(pending_update_count, error_message) 'error_message' => error_message) end + # Moves a chat to a different chat list. + # Current chat list of the chat must ne non-null. + # + # @param chat_id [Integer] Chat identifier. + # @param chat_list [TD::Types::ChatList] New chat list of the chat. + # @return [TD::Types::Ok] + def set_chat_chat_list(chat_id, chat_list) + broadcast('@type' => 'setChatChatList', + 'chat_id' => chat_id, + 'chat_list' => chat_list) + end + # Changes client data associated with a chat. # # @param chat_id [Integer] Chat identifier. @@ -3375,6 +3531,24 @@ def set_chat_description(chat_id, description) 'description' => description) end + # Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified. + # + # @param chat_id [Integer] Identifier of the channel chat. + # Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires + # can_pin_messages rights in the supergroup). + # @param discussion_chat_id [Integer] Identifier of a new channel's discussion group. + # Use 0 to remove the discussion group. + # Use the method getSuitableDiscussionChats to find all suitable groups. + # Basic group chats needs to be first upgraded to supergroup chats. + # If new chat members don't have access to old messages in the supergroup, then + # toggleSupergroupIsAllHistoryAvailable needs to be used first to change that. + # @return [TD::Types::Ok] + def set_chat_discussion_group(chat_id, discussion_chat_id) + broadcast('@type' => 'setChatDiscussionGroup', + 'chat_id' => chat_id, + 'discussion_chat_id' => discussion_chat_id) + end + # Changes the draft message in a chat. # # @param chat_id [Integer] Chat identifier. @@ -3386,8 +3560,22 @@ def set_chat_draft_message(chat_id, draft_message = nil) 'draft_message' => draft_message) end + # Changes the location of a chat. + # Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the + # method is allowed to use. + # + # @param chat_id [Integer] Chat identifier. + # @param location [TD::Types::ChatLocation] New location for the chat; must be valid and not null. + # @return [TD::Types::Ok] + def set_chat_location(chat_id, location) + broadcast('@type' => 'setChatLocation', + 'chat_id' => chat_id, + 'location' => location) + end + # Changes the status of a chat member, needs appropriate privileges. - # This function is currently not suitable for adding new members to the chat; instead, use addChatMember. + # This function is currently not suitable for adding new members to the chat and transferring chat ownership; + # instead, use addChatMember or transferChatOwnership. # The chat member status will not be changed until it has been synchronized with the server. # # @param chat_id [Integer] Chat identifier. @@ -3402,9 +3590,11 @@ def set_chat_member_status(chat_id, user_id, status) end # Changes the notification settings of a chat. + # Notification settings of a chat with the current user (Saved Messages) can't be changed. # # @param chat_id [Integer] Chat identifier. # @param notification_settings [TD::Types::ChatNotificationSettings] New notification settings for the chat. + # If the chat is muted for more than 1 week, it is considered to be muted forever. # @return [TD::Types::Ok] def set_chat_notification_settings(chat_id, notification_settings) broadcast('@type' => 'setChatNotificationSettings', @@ -3441,6 +3631,18 @@ def set_chat_photo(chat_id, photo) 'photo' => photo) end + # Changes the slow mode delay of a chat. + # Available only for supergroups; requires can_restrict_members rights. + # + # @param chat_id [Integer] Chat identifier. + # @param slow_mode_delay [Integer] New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600. + # @return [TD::Types::Ok] + def set_chat_slow_mode_delay(chat_id, slow_mode_delay) + broadcast('@type' => 'setChatSlowModeDelay', + 'chat_id' => chat_id, + 'slow_mode_delay' => slow_mode_delay) + end + # Changes the chat title. # Supported only for basic groups, supergroups and channels. # Requires can_change_info rights. @@ -3671,11 +3873,13 @@ def set_password(old_password, new_password: nil, new_hint: nil, set_recovery_em # Changes the order of pinned chats. # + # @param chat_list [TD::Types::ChatList] Chat list in which to change the order of pinned chats. # @param chat_ids [Array] The new list of pinned chats. # @return [TD::Types::Ok] - def set_pinned_chats(chat_ids) - broadcast('@type' => 'setPinnedChats', - 'chat_ids' => chat_ids) + def set_pinned_chats(chat_list, chat_ids) + broadcast('@type' => 'setPinnedChats', + 'chat_list' => chat_list, + 'chat_ids' => chat_ids) end # Changes user answer to a poll. @@ -3754,7 +3958,7 @@ def set_supergroup_sticker_set(supergroup_id, sticker_set_id) 'sticker_set_id' => sticker_set_id) end - # Changes the username of a supergroup or channel, requires creator privileges in the supergroup or channel. + # Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel. # # @param supergroup_id [Integer] Identifier of the supergroup or channel. # @param username [String] New value of the username. @@ -3798,6 +4002,17 @@ def set_username(username) 'username' => username) end + # Shares the phone number of the current user with a mutual contact. + # Supposed to be called when the user clicks on chatActionBarSharePhoneNumber. + # + # @param user_id [Integer] Identifier of the user with whom to share the phone number. + # The user must be a mutual contact. + # @return [TD::Types::Ok] + def share_phone_number(user_id) + broadcast('@type' => 'sharePhoneNumber', + 'user_id' => user_id) + end + # Stops a poll. # A poll in a message can be stopped when the message has can_be_edited flag set. # @@ -3862,7 +4077,8 @@ def toggle_chat_is_marked_as_unread(chat_id, is_marked_as_unread) end # Changes the pinned state of a chat. - # You can pin up to GetOption("pinned_chat_count_max") non-secret chats and the same number of secret chats. + # You can pin up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") non-secret chats + # and the same number of secret chats in the main/archive chat list. # # @param chat_id [Integer] Chat identifier. # @param is_pinned [Boolean] New value of is_pinned. @@ -3895,6 +4111,23 @@ def toggle_supergroup_sign_messages(supergroup_id, sign_messages) 'sign_messages' => sign_messages) end + # Changes the owner of a chat. + # The current user must be a current owner of the chat. + # Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. + # Available only for supergroups and channel chats. + # + # @param chat_id [Integer] Chat identifier. + # @param user_id [Integer] Identifier of the user to which transfer the ownership. + # The ownership can't be transferred to a bot or to a deleted user. + # @param password [String] The password of the current user. + # @return [TD::Types::Ok] + def transfer_chat_ownership(chat_id, user_id, password) + broadcast('@type' => 'transferChatOwnership', + 'chat_id' => chat_id, + 'user_id' => user_id, + 'password' => password) + end + # Removes a user from the blacklist. # # @param user_id [Integer] User identifier. diff --git a/lib/tdlib/types.rb b/lib/tdlib/types.rb index 8543681..23b14f2 100644 --- a/lib/tdlib/types.rb +++ b/lib/tdlib/types.rb @@ -24,6 +24,7 @@ module TD::Types 'authorizationStateWaitEncryptionKey' => 'AuthorizationState::WaitEncryptionKey', 'authorizationStateWaitPhoneNumber' => 'AuthorizationState::WaitPhoneNumber', 'authorizationStateWaitCode' => 'AuthorizationState::WaitCode', + 'authorizationStateWaitOtherDeviceConfirmation' => 'AuthorizationState::WaitOtherDeviceConfirmation', 'authorizationStateWaitRegistration' => 'AuthorizationState::WaitRegistration', 'authorizationStateWaitPassword' => 'AuthorizationState::WaitPassword', 'authorizationStateReady' => 'AuthorizationState::Ready', @@ -65,10 +66,6 @@ module TD::Types 'poll' => 'Poll', 'profilePhoto' => 'ProfilePhoto', 'chatPhoto' => 'ChatPhoto', - 'LinkState' => 'LinkState', - 'linkStateNone' => 'LinkState::None', - 'linkStateKnowsPhoneNumber' => 'LinkState::KnowsPhoneNumber', - 'linkStateIsContact' => 'LinkState::IsContact', 'UserType' => 'UserType', 'userTypeRegular' => 'UserType::Regular', 'userTypeDeleted' => 'UserType::Deleted', @@ -76,11 +73,14 @@ module TD::Types 'userTypeUnknown' => 'UserType::Unknown', 'botCommand' => 'BotCommand', 'botInfo' => 'BotInfo', + 'chatLocation' => 'ChatLocation', 'user' => 'User', 'userFullInfo' => 'UserFullInfo', 'userProfilePhoto' => 'UserProfilePhoto', 'userProfilePhotos' => 'UserProfilePhotos', 'users' => 'Users', + 'chatAdministrator' => 'ChatAdministrator', + 'chatAdministrators' => 'ChatAdministrators', 'chatPermissions' => 'ChatPermissions', 'ChatMemberStatus' => 'ChatMemberStatus', 'chatMemberStatusCreator' => 'ChatMemberStatus::Creator', @@ -138,10 +138,24 @@ module TD::Types 'chatTypeBasicGroup' => 'ChatType::BasicGroup', 'chatTypeSupergroup' => 'ChatType::Supergroup', 'chatTypeSecret' => 'ChatType::Secret', + 'ChatList' => 'ChatList', + 'chatListMain' => 'ChatList::Main', + 'chatListArchive' => 'ChatList::Archive', 'chat' => 'Chat', 'chats' => 'Chats', + 'chatNearby' => 'ChatNearby', + 'chatsNearby' => 'ChatsNearby', 'chatInviteLink' => 'ChatInviteLink', 'chatInviteLinkInfo' => 'ChatInviteLinkInfo', + 'PublicChatType' => 'PublicChatType', + 'publicChatTypeHasUsername' => 'PublicChatType::HasUsername', + 'publicChatTypeIsLocationBased' => 'PublicChatType::IsLocationBased', + 'ChatActionBar' => 'ChatActionBar', + 'chatActionBarReportSpam' => 'ChatActionBar::ReportSpam', + 'chatActionBarReportUnrelatedLocation' => 'ChatActionBar::ReportUnrelatedLocation', + 'chatActionBarReportAddBlock' => 'ChatActionBar::ReportAddBlock', + 'chatActionBarAddContact' => 'ChatActionBar::AddContact', + 'chatActionBarSharePhoneNumber' => 'ChatActionBar::SharePhoneNumber', 'KeyboardButtonType' => 'KeyboardButtonType', 'keyboardButtonTypeText' => 'KeyboardButtonType::Text', 'keyboardButtonTypeRequestPhoneNumber' => 'KeyboardButtonType::RequestPhoneNumber', @@ -160,6 +174,9 @@ module TD::Types 'replyMarkupForceReply' => 'ReplyMarkup::ForceReply', 'replyMarkupShowKeyboard' => 'ReplyMarkup::ShowKeyboard', 'replyMarkupInlineKeyboard' => 'ReplyMarkup::InlineKeyboard', + 'LoginUrlInfo' => 'LoginUrlInfo', + 'loginUrlInfoOpen' => 'LoginUrlInfo::Open', + 'loginUrlInfoRequestConfirmation' => 'LoginUrlInfo::RequestConfirmation', 'RichText' => 'RichText', 'richTextPlain' => 'RichText::Plain', 'richTextBold' => 'RichText::Bold', @@ -207,6 +224,7 @@ module TD::Types 'pageBlockAudio' => 'PageBlock::Audio', 'pageBlockPhoto' => 'PageBlock::Photo', 'pageBlockVideo' => 'PageBlock::Video', + 'pageBlockVoiceNote' => 'PageBlock::VoiceNote', 'pageBlockCover' => 'PageBlock::Cover', 'pageBlockEmbedded' => 'PageBlock::Embedded', 'pageBlockEmbeddedPost' => 'PageBlock::EmbeddedPost', @@ -361,15 +379,21 @@ module TD::Types 'textEntityTypeBotCommand' => 'TextEntityType::BotCommand', 'textEntityTypeUrl' => 'TextEntityType::Url', 'textEntityTypeEmailAddress' => 'TextEntityType::EmailAddress', + 'textEntityTypePhoneNumber' => 'TextEntityType::PhoneNumber', 'textEntityTypeBold' => 'TextEntityType::Bold', 'textEntityTypeItalic' => 'TextEntityType::Italic', + 'textEntityTypeUnderline' => 'TextEntityType::Underline', + 'textEntityTypeStrikethrough' => 'TextEntityType::Strikethrough', 'textEntityTypeCode' => 'TextEntityType::Code', 'textEntityTypePre' => 'TextEntityType::Pre', 'textEntityTypePreCode' => 'TextEntityType::PreCode', 'textEntityTypeTextUrl' => 'TextEntityType::TextUrl', 'textEntityTypeMentionName' => 'TextEntityType::MentionName', - 'textEntityTypePhoneNumber' => 'TextEntityType::PhoneNumber', 'inputThumbnail' => 'InputThumbnail', + 'MessageSchedulingState' => 'MessageSchedulingState', + 'messageSchedulingStateSendAtDate' => 'MessageSchedulingState::SendAtDate', + 'messageSchedulingStateSendWhenOnline' => 'MessageSchedulingState::SendWhenOnline', + 'sendMessageOptions' => 'SendMessageOptions', 'InputMessageContent' => 'InputMessageContent', 'inputMessageText' => 'InputMessageContent::Text', 'inputMessageAnimation' => 'InputMessageContent::Animation', @@ -494,6 +518,8 @@ module TD::Types 'customRequestResult' => 'CustomRequestResult', 'gameHighScore' => 'GameHighScore', 'gameHighScores' => 'GameHighScores', + 'tonLiteServerResponse' => 'TonLiteServerResponse', + 'tonWalletPasswordSalt' => 'TonWalletPasswordSalt', 'ChatEventAction' => 'ChatEventAction', 'chatEventMessageEdited' => 'ChatEventAction::MessageEdited', 'chatEventMessageDeleted' => 'ChatEventAction::MessageDeleted', @@ -511,8 +537,11 @@ module TD::Types 'chatEventUsernameChanged' => 'ChatEventAction::UsernameChanged', 'chatEventPhotoChanged' => 'ChatEventAction::PhotoChanged', 'chatEventInvitesToggled' => 'ChatEventAction::InvitesToggled', + 'chatEventLinkedChatChanged' => 'ChatEventAction::LinkedChatChanged', + 'chatEventSlowModeDelayChanged' => 'ChatEventAction::SlowModeDelayChanged', 'chatEventSignMessagesToggled' => 'ChatEventAction::SignMessagesToggled', 'chatEventStickerSetChanged' => 'ChatEventAction::StickerSetChanged', + 'chatEventLocationChanged' => 'ChatEventAction::LocationChanged', 'chatEventIsAllHistoryAvailableToggled' => 'ChatEventAction::IsAllHistoryAvailableToggled', 'chatEvent' => 'ChatEvent', 'chatEvents' => 'ChatEvents', @@ -538,16 +567,24 @@ module TD::Types 'deviceTokenBlackBerryPush' => 'DeviceToken::BlackBerryPush', 'deviceTokenTizenPush' => 'DeviceToken::TizenPush', 'pushReceiverId' => 'PushReceiverId', + 'BackgroundFill' => 'BackgroundFill', + 'backgroundFillSolid' => 'BackgroundFill::Solid', + 'backgroundFillGradient' => 'BackgroundFill::Gradient', 'BackgroundType' => 'BackgroundType', 'backgroundTypeWallpaper' => 'BackgroundType::Wallpaper', 'backgroundTypePattern' => 'BackgroundType::Pattern', - 'backgroundTypeSolid' => 'BackgroundType::Solid', + 'backgroundTypeFill' => 'BackgroundType::Fill', 'background' => 'Background', 'backgrounds' => 'Backgrounds', 'InputBackground' => 'InputBackground', 'inputBackgroundLocal' => 'InputBackground::Local', 'inputBackgroundRemote' => 'InputBackground::Remote', 'hashtags' => 'Hashtags', + 'CanTransferOwnershipResult' => 'CanTransferOwnershipResult', + 'canTransferOwnershipResultOk' => 'CanTransferOwnershipResult::Ok', + 'canTransferOwnershipResultPasswordNeeded' => 'CanTransferOwnershipResult::PasswordNeeded', + 'canTransferOwnershipResultPasswordTooFresh' => 'CanTransferOwnershipResult::PasswordTooFresh', + 'canTransferOwnershipResultSessionTooFresh' => 'CanTransferOwnershipResult::SessionTooFresh', 'CheckChatUsernameResult' => 'CheckChatUsernameResult', 'checkChatUsernameResultOk' => 'CheckChatUsernameResult::Ok', 'checkChatUsernameResultUsernameInvalid' => 'CheckChatUsernameResult::UsernameInvalid', @@ -610,29 +647,33 @@ module TD::Types 'userPrivacySettingRuleAllowAll' => 'UserPrivacySettingRule::AllowAll', 'userPrivacySettingRuleAllowContacts' => 'UserPrivacySettingRule::AllowContacts', 'userPrivacySettingRuleAllowUsers' => 'UserPrivacySettingRule::AllowUsers', + 'userPrivacySettingRuleAllowChatMembers' => 'UserPrivacySettingRule::AllowChatMembers', 'userPrivacySettingRuleRestrictAll' => 'UserPrivacySettingRule::RestrictAll', 'userPrivacySettingRuleRestrictContacts' => 'UserPrivacySettingRule::RestrictContacts', 'userPrivacySettingRuleRestrictUsers' => 'UserPrivacySettingRule::RestrictUsers', + 'userPrivacySettingRuleRestrictChatMembers' => 'UserPrivacySettingRule::RestrictChatMembers', 'userPrivacySettingRules' => 'UserPrivacySettingRules', 'UserPrivacySetting' => 'UserPrivacySetting', 'userPrivacySettingShowStatus' => 'UserPrivacySetting::ShowStatus', 'userPrivacySettingShowProfilePhoto' => 'UserPrivacySetting::ShowProfilePhoto', 'userPrivacySettingShowLinkInForwardedMessages' => 'UserPrivacySetting::ShowLinkInForwardedMessages', + 'userPrivacySettingShowPhoneNumber' => 'UserPrivacySetting::ShowPhoneNumber', 'userPrivacySettingAllowChatInvites' => 'UserPrivacySetting::AllowChatInvites', 'userPrivacySettingAllowCalls' => 'UserPrivacySetting::AllowCalls', 'userPrivacySettingAllowPeerToPeerCalls' => 'UserPrivacySetting::AllowPeerToPeerCalls', + 'userPrivacySettingAllowFindingByPhoneNumber' => 'UserPrivacySetting::AllowFindingByPhoneNumber', 'accountTtl' => 'AccountTtl', 'session' => 'Session', 'sessions' => 'Sessions', 'connectedWebsite' => 'ConnectedWebsite', 'connectedWebsites' => 'ConnectedWebsites', - 'chatReportSpamState' => 'ChatReportSpamState', 'ChatReportReason' => 'ChatReportReason', 'chatReportReasonSpam' => 'ChatReportReason::Spam', 'chatReportReasonViolence' => 'ChatReportReason::Violence', 'chatReportReasonPornography' => 'ChatReportReason::Pornography', 'chatReportReasonChildAbuse' => 'ChatReportReason::ChildAbuse', 'chatReportReasonCopyright' => 'ChatReportReason::Copyright', + 'chatReportReasonUnrelatedLocation' => 'ChatReportReason::UnrelatedLocation', 'chatReportReasonCustom' => 'ChatReportReason::Custom', 'publicMessageLink' => 'PublicMessageLink', 'messageLinkInfo' => 'MessageLinkInfo', @@ -684,6 +725,7 @@ module TD::Types 'topChatCategoryChannels' => 'TopChatCategory::Channels', 'topChatCategoryInlineBots' => 'TopChatCategory::InlineBots', 'topChatCategoryCalls' => 'TopChatCategory::Calls', + 'topChatCategoryForwardChats' => 'TopChatCategory::ForwardChats', 'TMeUrlType' => 'TMeUrlType', 'tMeUrlTypeUser' => 'TMeUrlType::User', 'tMeUrlTypeSupergroup' => 'TMeUrlType::Supergroup', @@ -716,7 +758,9 @@ module TD::Types 'updateMessageViews' => 'Update::MessageViews', 'updateMessageContentOpened' => 'Update::MessageContentOpened', 'updateMessageMentionRead' => 'Update::MessageMentionRead', + 'updateMessageLiveLocationViewed' => 'Update::MessageLiveLocationViewed', 'updateNewChat' => 'Update::NewChat', + 'updateChatChatList' => 'Update::ChatChatList', 'updateChatTitle' => 'Update::ChatTitle', 'updateChatPhoto' => 'Update::ChatPhoto', 'updateChatPermissions' => 'Update::ChatPermissions', @@ -725,12 +769,14 @@ module TD::Types 'updateChatIsPinned' => 'Update::ChatIsPinned', 'updateChatIsMarkedAsUnread' => 'Update::ChatIsMarkedAsUnread', 'updateChatIsSponsored' => 'Update::ChatIsSponsored', + 'updateChatHasScheduledMessages' => 'Update::ChatHasScheduledMessages', 'updateChatDefaultDisableNotification' => 'Update::ChatDefaultDisableNotification', 'updateChatReadInbox' => 'Update::ChatReadInbox', 'updateChatReadOutbox' => 'Update::ChatReadOutbox', 'updateChatUnreadMentionCount' => 'Update::ChatUnreadMentionCount', 'updateChatNotificationSettings' => 'Update::ChatNotificationSettings', 'updateScopeNotificationSettings' => 'Update::ScopeNotificationSettings', + 'updateChatActionBar' => 'Update::ChatActionBar', 'updateChatPinnedMessage' => 'Update::ChatPinnedMessage', 'updateChatReplyMarkup' => 'Update::ChatReplyMarkup', 'updateChatDraftMessage' => 'Update::ChatDraftMessage', @@ -767,6 +813,7 @@ module TD::Types 'updateLanguagePackStrings' => 'Update::LanguagePackStrings', 'updateConnectionState' => 'Update::ConnectionState', 'updateTermsOfService' => 'Update::TermsOfService', + 'updateUsersNearby' => 'Update::UsersNearby', 'updateNewInlineQuery' => 'Update::NewInlineQuery', 'updateNewChosenInlineResult' => 'Update::NewChosenInlineResult', 'updateNewCallbackQuery' => 'Update::NewCallbackQuery', @@ -832,6 +879,7 @@ def camelize(str) auto_download_settings auto_download_settings_presets background + background_fill background_type backgrounds base @@ -848,25 +896,32 @@ def camelize(str) call_state callback_query_answer callback_query_payload + can_transfer_ownership_result chat chat_action + chat_action_bar + chat_administrator + chat_administrators chat_event chat_event_action chat_event_log_filters chat_events chat_invite_link chat_invite_link_info + chat_list + chat_location chat_member chat_member_status chat_members chat_members_filter + chat_nearby chat_notification_settings chat_permissions chat_photo chat_report_reason - chat_report_spam_state chat_type chats + chats_nearby check_chat_username_result connected_website connected_websites @@ -924,13 +979,13 @@ def camelize(str) language_pack_string language_pack_string_value language_pack_strings - link_state local_file localization_target_info location log_stream log_tags log_verbosity_level + login_url_info mask_point mask_position message @@ -938,6 +993,7 @@ def camelize(str) message_forward_info message_forward_origin message_link_info + message_scheduling_state message_sending_state messages minithumbnail @@ -984,6 +1040,7 @@ def camelize(str) proxies proxy proxy_type + public_chat_type public_message_link push_message_content push_receiver_id @@ -997,6 +1054,7 @@ def camelize(str) seconds secret_chat secret_chat_state + send_message_options session sessions shipping_option @@ -1023,6 +1081,8 @@ def camelize(str) text_entity text_entity_type text_parse_mode + ton_lite_server_response + ton_wallet_password_salt top_chat_category update updates diff --git a/lib/tdlib/types/audio.rb b/lib/tdlib/types/audio.rb index 9713060..a04a3d2 100644 --- a/lib/tdlib/types/audio.rb +++ b/lib/tdlib/types/audio.rb @@ -1,6 +1,6 @@ module TD::Types # Describes an audio file. - # Audio is usually in MP3 format. + # Audio is usually in MP3 or M4A format. # # @attr duration [Integer] Duration of the audio, in seconds; as defined by the sender. # @attr title [String] Title of the audio; as defined by the sender. diff --git a/lib/tdlib/types/authorization_state.rb b/lib/tdlib/types/authorization_state.rb index 0ef2bcd..d6fd12e 100644 --- a/lib/tdlib/types/authorization_state.rb +++ b/lib/tdlib/types/authorization_state.rb @@ -6,6 +6,7 @@ class AuthorizationState < Base wait_encryption_key wait_phone_number wait_code + wait_other_device_confirmation wait_registration wait_password ready diff --git a/lib/tdlib/types/authorization_state/wait_other_device_confirmation.rb b/lib/tdlib/types/authorization_state/wait_other_device_confirmation.rb new file mode 100644 index 0000000..43db423 --- /dev/null +++ b/lib/tdlib/types/authorization_state/wait_other_device_confirmation.rb @@ -0,0 +1,9 @@ +module TD::Types + # The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link. + # + # @attr link [String] A tg:// URL for the QR code. + # The link will be updated frequently. + class AuthorizationState::WaitOtherDeviceConfirmation < AuthorizationState + attribute :link, TD::Types::String + end +end diff --git a/lib/tdlib/types/authorization_state/wait_phone_number.rb b/lib/tdlib/types/authorization_state/wait_phone_number.rb index 5de3cc5..962ede3 100644 --- a/lib/tdlib/types/authorization_state/wait_phone_number.rb +++ b/lib/tdlib/types/authorization_state/wait_phone_number.rb @@ -1,5 +1,7 @@ module TD::Types # TDLib needs the user's phone number to authorize. + # Call `setAuthenticationPhoneNumber` to provide the phone number, or use `requestQrCodeAuthentication`, or + # `checkAuthenticationBotToken` for other authentication options. class AuthorizationState::WaitPhoneNumber < AuthorizationState end end diff --git a/lib/tdlib/types/auto_download_settings.rb b/lib/tdlib/types/auto_download_settings.rb index b7f2131..e0fc7be 100644 --- a/lib/tdlib/types/auto_download_settings.rb +++ b/lib/tdlib/types/auto_download_settings.rb @@ -2,9 +2,10 @@ module TD::Types # Contains auto-download settings. # # @attr is_auto_download_enabled [Boolean] True, if the auto-download is enabled. - # @attr max_photo_file_size [Integer] Maximum size of a photo file to be auto-downloaded. - # @attr max_video_file_size [Integer] Maximum size of a video file to be auto-downloaded. - # @attr max_other_file_size [Integer] Maximum size of other file types to be auto-downloaded. + # @attr max_photo_file_size [Integer] The maximum size of a photo file to be auto-downloaded. + # @attr max_video_file_size [Integer] The maximum size of a video file to be auto-downloaded. + # @attr max_other_file_size [Integer] The maximum size of other file types to be auto-downloaded. + # @attr video_upload_bitrate [Integer] The maximum suggested bitrate for uploaded videos. # @attr preload_large_videos [Boolean] True, if the beginning of videos needs to be preloaded for instant playback. # @attr preload_next_audio [Boolean] True, if the next audio track needs to be preloaded while the user is listening # to an audio file. @@ -14,6 +15,7 @@ class AutoDownloadSettings < Base attribute :max_photo_file_size, TD::Types::Integer attribute :max_video_file_size, TD::Types::Integer attribute :max_other_file_size, TD::Types::Integer + attribute :video_upload_bitrate, TD::Types::Integer attribute :preload_large_videos, TD::Types::Bool attribute :preload_next_audio, TD::Types::Bool attribute :use_less_data_for_calls, TD::Types::Bool diff --git a/lib/tdlib/types/background.rb b/lib/tdlib/types/background.rb index ae84b7c..6ce5fe3 100644 --- a/lib/tdlib/types/background.rb +++ b/lib/tdlib/types/background.rb @@ -6,7 +6,7 @@ module TD::Types # @attr is_dark [Boolean] True, if the background is dark and is recommended to be used with dark theme. # @attr name [String] Unique background name. # @attr document [TD::Types::Document, nil] Document with the background; may be null. - # Null only for solid backgrounds. + # Null only for filled backgrounds. # @attr type [TD::Types::BackgroundType] Type of the background. class Background < Base attribute :id, TD::Types::Integer diff --git a/lib/tdlib/types/background_fill.rb b/lib/tdlib/types/background_fill.rb new file mode 100644 index 0000000..2c47d37 --- /dev/null +++ b/lib/tdlib/types/background_fill.rb @@ -0,0 +1,11 @@ +module TD::Types + # Describes a fill of a background. + class BackgroundFill < Base + %w[ + solid + gradient + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/background_fill/#{type}" + end + end +end diff --git a/lib/tdlib/types/background_fill/gradient.rb b/lib/tdlib/types/background_fill/gradient.rb new file mode 100644 index 0000000..4e5e2f6 --- /dev/null +++ b/lib/tdlib/types/background_fill/gradient.rb @@ -0,0 +1,13 @@ +module TD::Types + # Describes a gradient fill of a background. + # + # @attr top_color [Integer] A top color of the background in the RGB24 format. + # @attr bottom_color [Integer] A bottom color of the background in the RGB24 format. + # @attr rotation_angle [Integer] Clockwise rotation angle of the gradient, in degrees; 0-359. + # Should be always divisible by 45. + class BackgroundFill::Gradient < BackgroundFill + attribute :top_color, TD::Types::Integer + attribute :bottom_color, TD::Types::Integer + attribute :rotation_angle, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/background_fill/solid.rb b/lib/tdlib/types/background_fill/solid.rb new file mode 100644 index 0000000..6cc53a2 --- /dev/null +++ b/lib/tdlib/types/background_fill/solid.rb @@ -0,0 +1,8 @@ +module TD::Types + # Describes a solid fill of a background. + # + # @attr color [Integer] A color of the background in the RGB24 format. + class BackgroundFill::Solid < BackgroundFill + attribute :color, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/background_type.rb b/lib/tdlib/types/background_type.rb index af76086..79e6930 100644 --- a/lib/tdlib/types/background_type.rb +++ b/lib/tdlib/types/background_type.rb @@ -4,7 +4,7 @@ class BackgroundType < Base %w[ wallpaper pattern - solid + fill ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/background_type/#{type}" end diff --git a/lib/tdlib/types/background_type/fill.rb b/lib/tdlib/types/background_type/fill.rb new file mode 100644 index 0000000..0c0644a --- /dev/null +++ b/lib/tdlib/types/background_type/fill.rb @@ -0,0 +1,8 @@ +module TD::Types + # A filled background. + # + # @attr fill [TD::Types::BackgroundFill] Description of the background fill. + class BackgroundType::Fill < BackgroundType + attribute :fill, TD::Types::BackgroundFill + end +end diff --git a/lib/tdlib/types/background_type/pattern.rb b/lib/tdlib/types/background_type/pattern.rb index 18fb32a..cb64447 100644 --- a/lib/tdlib/types/background_type/pattern.rb +++ b/lib/tdlib/types/background_type/pattern.rb @@ -1,12 +1,13 @@ module TD::Types - # A PNG pattern to be combined with the color chosen by the user. + # A PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the + # background fill chosen by the user. # - # @attr is_moving [Boolean] True, if the background needs to be slightly moved when device is rotated. - # @attr color [Integer] Main color of the background in RGB24 format. - # @attr intensity [Integer] Intensity of the pattern when it is shown above the main background color, 0-100. + # @attr fill [TD::Types::BackgroundFill] Description of the background fill. + # @attr intensity [Integer] Intensity of the pattern when it is shown above the filled background, 0-100. + # @attr is_moving [Boolean] True, if the background needs to be slightly moved when device is tilted. class BackgroundType::Pattern < BackgroundType - attribute :is_moving, TD::Types::Bool - attribute :color, TD::Types::Integer + attribute :fill, TD::Types::BackgroundFill attribute :intensity, TD::Types::Integer + attribute :is_moving, TD::Types::Bool end end diff --git a/lib/tdlib/types/background_type/solid.rb b/lib/tdlib/types/background_type/solid.rb deleted file mode 100644 index fa64a83..0000000 --- a/lib/tdlib/types/background_type/solid.rb +++ /dev/null @@ -1,8 +0,0 @@ -module TD::Types - # A solid background. - # - # @attr color [Integer] A color of the background in RGB24 format. - class BackgroundType::Solid < BackgroundType - attribute :color, TD::Types::Integer - end -end diff --git a/lib/tdlib/types/background_type/wallpaper.rb b/lib/tdlib/types/background_type/wallpaper.rb index a841cfb..3105459 100644 --- a/lib/tdlib/types/background_type/wallpaper.rb +++ b/lib/tdlib/types/background_type/wallpaper.rb @@ -3,7 +3,7 @@ module TD::Types # # @attr is_blurred [Boolean] True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred # with radius 12. - # @attr is_moving [Boolean] True, if the background needs to be slightly moved when device is rotated. + # @attr is_moving [Boolean] True, if the background needs to be slightly moved when device is tilted. class BackgroundType::Wallpaper < BackgroundType attribute :is_blurred, TD::Types::Bool attribute :is_moving, TD::Types::Bool diff --git a/lib/tdlib/types/base.rb b/lib/tdlib/types/base.rb index 16f29b6..0f86d62 100644 --- a/lib/tdlib/types/base.rb +++ b/lib/tdlib/types/base.rb @@ -1,7 +1,7 @@ module TD::Types class Base < Dry::Struct # throw an error when unknown keys provided - input input.strict + schema schema.strict # convert string keys to symbols transform_keys(&:to_sym) diff --git a/lib/tdlib/types/basic_group_full_info.rb b/lib/tdlib/types/basic_group_full_info.rb index b2c7c8a..829cf3f 100644 --- a/lib/tdlib/types/basic_group_full_info.rb +++ b/lib/tdlib/types/basic_group_full_info.rb @@ -4,8 +4,8 @@ module TD::Types # @attr description [String] Group description. # @attr creator_user_id [Integer] User identifier of the creator of the group; 0 if unknown. # @attr members [Array] Group members. - # @attr invite_link [String] Invite link for this group; available only for the group creator and only after it has - # been generated at least once. + # @attr invite_link [String] Invite link for this group; available only after it has been generated at least once and + # only for the group creator. class BasicGroupFullInfo < Base attribute :description, TD::Types::String attribute :creator_user_id, TD::Types::Integer diff --git a/lib/tdlib/types/call_protocol.rb b/lib/tdlib/types/call_protocol.rb index ecec057..0a6fca0 100644 --- a/lib/tdlib/types/call_protocol.rb +++ b/lib/tdlib/types/call_protocol.rb @@ -3,8 +3,8 @@ module TD::Types # # @attr udp_p2p [Boolean] True, if UDP peer-to-peer connections are supported. # @attr udp_reflector [Boolean] True, if connection through UDP reflectors is supported. - # @attr min_layer [Integer] Minimum supported API layer; use 65. - # @attr max_layer [Integer] Maximum supported API layer; use 65. + # @attr min_layer [Integer] The minimum supported API layer; use 65. + # @attr max_layer [Integer] The maximum supported API layer; use 65. class CallProtocol < Base attribute :udp_p2p, TD::Types::Bool attribute :udp_reflector, TD::Types::Bool diff --git a/lib/tdlib/types/can_transfer_ownership_result.rb b/lib/tdlib/types/can_transfer_ownership_result.rb new file mode 100644 index 0000000..0ea5330 --- /dev/null +++ b/lib/tdlib/types/can_transfer_ownership_result.rb @@ -0,0 +1,13 @@ +module TD::Types + # Represents result of checking whether the current session can be used to transfer a chat ownership to another user. + class CanTransferOwnershipResult < Base + %w[ + ok + password_needed + password_too_fresh + session_too_fresh + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/can_transfer_ownership_result/#{type}" + end + end +end diff --git a/lib/tdlib/types/can_transfer_ownership_result/ok.rb b/lib/tdlib/types/can_transfer_ownership_result/ok.rb new file mode 100644 index 0000000..a9bc64e --- /dev/null +++ b/lib/tdlib/types/can_transfer_ownership_result/ok.rb @@ -0,0 +1,5 @@ +module TD::Types + # The session can be used. + class CanTransferOwnershipResult::Ok < CanTransferOwnershipResult + end +end diff --git a/lib/tdlib/types/can_transfer_ownership_result/password_needed.rb b/lib/tdlib/types/can_transfer_ownership_result/password_needed.rb new file mode 100644 index 0000000..039872a --- /dev/null +++ b/lib/tdlib/types/can_transfer_ownership_result/password_needed.rb @@ -0,0 +1,5 @@ +module TD::Types + # The 2-step verification needs to be enabled first. + class CanTransferOwnershipResult::PasswordNeeded < CanTransferOwnershipResult + end +end diff --git a/lib/tdlib/types/can_transfer_ownership_result/password_too_fresh.rb b/lib/tdlib/types/can_transfer_ownership_result/password_too_fresh.rb new file mode 100644 index 0000000..941cf50 --- /dev/null +++ b/lib/tdlib/types/can_transfer_ownership_result/password_too_fresh.rb @@ -0,0 +1,8 @@ +module TD::Types + # The 2-step verification was enabled recently, user needs to wait. + # + # @attr retry_after [Integer] Time left before the session can be used to transfer ownership of a chat, in seconds. + class CanTransferOwnershipResult::PasswordTooFresh < CanTransferOwnershipResult + attribute :retry_after, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/can_transfer_ownership_result/session_too_fresh.rb b/lib/tdlib/types/can_transfer_ownership_result/session_too_fresh.rb new file mode 100644 index 0000000..d099602 --- /dev/null +++ b/lib/tdlib/types/can_transfer_ownership_result/session_too_fresh.rb @@ -0,0 +1,8 @@ +module TD::Types + # The session was created recently, user needs to wait. + # + # @attr retry_after [Integer] Time left before the session can be used to transfer ownership of a chat, in seconds. + class CanTransferOwnershipResult::SessionTooFresh < CanTransferOwnershipResult + attribute :retry_after, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/chat.rb b/lib/tdlib/types/chat.rb index cb85ccb..df00505 100644 --- a/lib/tdlib/types/chat.rb +++ b/lib/tdlib/types/chat.rb @@ -4,6 +4,7 @@ module TD::Types # # @attr id [Integer] Chat unique identifier. # @attr type [TD::Types::ChatType] Type of the chat. + # @attr chat_list [TD::Types::ChatList, nil] A chat list to which the chat belongs; may be null. # @attr title [String] Chat title. # @attr photo [TD::Types::ChatPhoto, nil] Chat photo; may be null. # @attr permissions [TD::Types::ChatPermissions] Actions that non-administrator chat members are allowed to take in @@ -15,6 +16,7 @@ module TD::Types # @attr is_pinned [Boolean] True, if the chat is pinned. # @attr is_marked_as_unread [Boolean] True, if the chat is marked as unread. # @attr is_sponsored [Boolean] True, if the chat is sponsored by the user's MTProxy server. + # @attr has_scheduled_messages [Boolean] True, if the chat has scheduled messages. # @attr can_be_deleted_only_for_self [Boolean] True, if the chat messages can be deleted only for the current user # while other users will continue to see the messages. # @attr can_be_deleted_for_all_users [Boolean] True, if the chat messages can be deleted for all users. @@ -26,16 +28,19 @@ module TD::Types # @attr last_read_outbox_message_id [Integer] Identifier of the last read outgoing message. # @attr unread_mention_count [Integer] Number of unread messages with a mention/reply in the chat. # @attr notification_settings [TD::Types::ChatNotificationSettings] Notification settings for this chat. + # @attr action_bar [TD::Types::ChatActionBar, nil] Describes actions which should be possible to do through a chat + # action bar; may be null. # @attr pinned_message_id [Integer] Identifier of the pinned message in the chat; 0 if none. # @attr reply_markup_message_id [Integer] Identifier of the message from which reply markup needs to be used; 0 if # there is no default custom reply markup in the chat. # @attr draft_message [TD::Types::DraftMessage, nil] A draft of a message in the chat; may be null. # @attr client_data [String] Contains client-specific data associated with the chat. - # (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message - # database is used. + # (For example, the chat position or local chat notification settings can be stored here.) Persistent if the + # message database is used. class Chat < Base attribute :id, TD::Types::Integer attribute :type, TD::Types::ChatType + attribute :chat_list, TD::Types::ChatList.optional.default(nil) attribute :title, TD::Types::String attribute :photo, TD::Types::ChatPhoto.optional.default(nil) attribute :permissions, TD::Types::ChatPermissions @@ -44,6 +49,7 @@ class Chat < Base attribute :is_pinned, TD::Types::Bool attribute :is_marked_as_unread, TD::Types::Bool attribute :is_sponsored, TD::Types::Bool + attribute :has_scheduled_messages, TD::Types::Bool attribute :can_be_deleted_only_for_self, TD::Types::Bool attribute :can_be_deleted_for_all_users, TD::Types::Bool attribute :can_be_reported, TD::Types::Bool @@ -53,6 +59,7 @@ class Chat < Base attribute :last_read_outbox_message_id, TD::Types::Integer attribute :unread_mention_count, TD::Types::Integer attribute :notification_settings, TD::Types::ChatNotificationSettings + attribute :action_bar, TD::Types::ChatActionBar.optional.default(nil) attribute :pinned_message_id, TD::Types::Integer attribute :reply_markup_message_id, TD::Types::Integer attribute :draft_message, TD::Types::DraftMessage.optional.default(nil) diff --git a/lib/tdlib/types/chat_action_bar.rb b/lib/tdlib/types/chat_action_bar.rb new file mode 100644 index 0000000..0460f4b --- /dev/null +++ b/lib/tdlib/types/chat_action_bar.rb @@ -0,0 +1,14 @@ +module TD::Types + # Describes actions which should be possible to do through a chat action bar. + class ChatActionBar < Base + %w[ + report_spam + report_unrelated_location + report_add_block + add_contact + share_phone_number + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/chat_action_bar/#{type}" + end + end +end diff --git a/lib/tdlib/types/chat_action_bar/add_contact.rb b/lib/tdlib/types/chat_action_bar/add_contact.rb new file mode 100644 index 0000000..ce72487 --- /dev/null +++ b/lib/tdlib/types/chat_action_bar/add_contact.rb @@ -0,0 +1,6 @@ +module TD::Types + # The chat is a private or secret chat and the other user can be added to the contact list using the method + # addContact. + class ChatActionBar::AddContact < ChatActionBar + end +end diff --git a/lib/tdlib/types/chat_action_bar/report_add_block.rb b/lib/tdlib/types/chat_action_bar/report_add_block.rb new file mode 100644 index 0000000..ae64a71 --- /dev/null +++ b/lib/tdlib/types/chat_action_bar/report_add_block.rb @@ -0,0 +1,6 @@ +module TD::Types + # The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be + # added to the contact list using the method addContact, or the other user can be blocked using the method blockUser. + class ChatActionBar::ReportAddBlock < ChatActionBar + end +end diff --git a/lib/tdlib/types/chat_action_bar/report_spam.rb b/lib/tdlib/types/chat_action_bar/report_spam.rb new file mode 100644 index 0000000..6e9521c --- /dev/null +++ b/lib/tdlib/types/chat_action_bar/report_spam.rb @@ -0,0 +1,5 @@ +module TD::Types + # The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam. + class ChatActionBar::ReportSpam < ChatActionBar + end +end diff --git a/lib/tdlib/types/chat_action_bar/report_unrelated_location.rb b/lib/tdlib/types/chat_action_bar/report_unrelated_location.rb new file mode 100644 index 0000000..dc6f57a --- /dev/null +++ b/lib/tdlib/types/chat_action_bar/report_unrelated_location.rb @@ -0,0 +1,6 @@ +module TD::Types + # The chat is a location-based supergroup, which can be reported as having unrelated location using the method + # reportChat with the reason chatReportReasonUnrelatedLocation. + class ChatActionBar::ReportUnrelatedLocation < ChatActionBar + end +end diff --git a/lib/tdlib/types/chat_action_bar/share_phone_number.rb b/lib/tdlib/types/chat_action_bar/share_phone_number.rb new file mode 100644 index 0000000..b9a8015 --- /dev/null +++ b/lib/tdlib/types/chat_action_bar/share_phone_number.rb @@ -0,0 +1,6 @@ +module TD::Types + # The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other + # user using the method sharePhoneNumber. + class ChatActionBar::SharePhoneNumber < ChatActionBar + end +end diff --git a/lib/tdlib/types/chat_administrator.rb b/lib/tdlib/types/chat_administrator.rb new file mode 100644 index 0000000..1b6d82e --- /dev/null +++ b/lib/tdlib/types/chat_administrator.rb @@ -0,0 +1,12 @@ +module TD::Types + # Contains information about a chat administrator. + # + # @attr user_id [Integer] User identifier of the administrator. + # @attr custom_title [String] Custom title of the administrator. + # @attr is_owner [Boolean] True, if the user is the owner of the chat. + class ChatAdministrator < Base + attribute :user_id, TD::Types::Integer + attribute :custom_title, TD::Types::String + attribute :is_owner, TD::Types::Bool + end +end diff --git a/lib/tdlib/types/chat_administrators.rb b/lib/tdlib/types/chat_administrators.rb new file mode 100644 index 0000000..5ad2cce --- /dev/null +++ b/lib/tdlib/types/chat_administrators.rb @@ -0,0 +1,8 @@ +module TD::Types + # Represents a list of chat administrators. + # + # @attr administrators [Array] A list of chat administrators. + class ChatAdministrators < Base + attribute :administrators, TD::Types::Array.of(TD::Types::ChatAdministrator) + end +end diff --git a/lib/tdlib/types/chat_event_action.rb b/lib/tdlib/types/chat_event_action.rb index 7022e29..ef10dbb 100644 --- a/lib/tdlib/types/chat_event_action.rb +++ b/lib/tdlib/types/chat_event_action.rb @@ -18,8 +18,11 @@ class ChatEventAction < Base username_changed photo_changed invites_toggled + linked_chat_changed + slow_mode_delay_changed sign_messages_toggled sticker_set_changed + location_changed is_all_history_available_toggled ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/chat_event_action/#{type}" diff --git a/lib/tdlib/types/chat_event_action/linked_chat_changed.rb b/lib/tdlib/types/chat_event_action/linked_chat_changed.rb new file mode 100644 index 0000000..0c46533 --- /dev/null +++ b/lib/tdlib/types/chat_event_action/linked_chat_changed.rb @@ -0,0 +1,10 @@ +module TD::Types + # The linked chat of a supergroup was changed. + # + # @attr old_linked_chat_id [Integer] Previous supergroup linked chat identifier. + # @attr new_linked_chat_id [Integer] New supergroup linked chat identifier. + class ChatEventAction::LinkedChatChanged < ChatEventAction + attribute :old_linked_chat_id, TD::Types::Integer + attribute :new_linked_chat_id, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/chat_event_action/location_changed.rb b/lib/tdlib/types/chat_event_action/location_changed.rb new file mode 100644 index 0000000..6022bb3 --- /dev/null +++ b/lib/tdlib/types/chat_event_action/location_changed.rb @@ -0,0 +1,10 @@ +module TD::Types + # The supergroup location was changed. + # + # @attr old_location [TD::Types::ChatLocation, nil] Previous location; may be null. + # @attr new_location [TD::Types::ChatLocation, nil] New location; may be null. + class ChatEventAction::LocationChanged < ChatEventAction + attribute :old_location, TD::Types::ChatLocation.optional.default(nil) + attribute :new_location, TD::Types::ChatLocation.optional.default(nil) + end +end diff --git a/lib/tdlib/types/chat_event_action/slow_mode_delay_changed.rb b/lib/tdlib/types/chat_event_action/slow_mode_delay_changed.rb new file mode 100644 index 0000000..7a1ed29 --- /dev/null +++ b/lib/tdlib/types/chat_event_action/slow_mode_delay_changed.rb @@ -0,0 +1,10 @@ +module TD::Types + # The slow_mode_delay setting of a supergroup was changed. + # + # @attr old_slow_mode_delay [Integer] Previous value of slow_mode_delay. + # @attr new_slow_mode_delay [Integer] New value of slow_mode_delay. + class ChatEventAction::SlowModeDelayChanged < ChatEventAction + attribute :old_slow_mode_delay, TD::Types::Integer + attribute :new_slow_mode_delay, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/chat_invite_link_info.rb b/lib/tdlib/types/chat_invite_link_info.rb index 8933757..5dae12c 100644 --- a/lib/tdlib/types/chat_invite_link_info.rb +++ b/lib/tdlib/types/chat_invite_link_info.rb @@ -7,7 +7,8 @@ module TD::Types # @attr photo [TD::Types::ChatPhoto, nil] Chat photo; may be null. # @attr member_count [Integer] Number of members. # @attr member_user_ids [Array] User identifiers of some chat members that may be known to the current user. - # @attr is_public [Boolean] True, if the chat is a public supergroup or a channel with a username. + # @attr is_public [Boolean] True, if the chat is a public supergroup or channel, i.e. + # it has a username or it is a location-based supergroup. class ChatInviteLinkInfo < Base attribute :chat_id, TD::Types::Integer attribute :type, TD::Types::ChatType diff --git a/lib/tdlib/types/chat_list.rb b/lib/tdlib/types/chat_list.rb new file mode 100644 index 0000000..183672f --- /dev/null +++ b/lib/tdlib/types/chat_list.rb @@ -0,0 +1,11 @@ +module TD::Types + # Describes a list of chats. + class ChatList < Base + %w[ + main + archive + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/chat_list/#{type}" + end + end +end diff --git a/lib/tdlib/types/chat_list/archive.rb b/lib/tdlib/types/chat_list/archive.rb new file mode 100644 index 0000000..690f84b --- /dev/null +++ b/lib/tdlib/types/chat_list/archive.rb @@ -0,0 +1,6 @@ +module TD::Types + # A list of chats usually located at the top of the main chat list. + # Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives. + class ChatList::Archive < ChatList + end +end diff --git a/lib/tdlib/types/chat_list/main.rb b/lib/tdlib/types/chat_list/main.rb new file mode 100644 index 0000000..28700cf --- /dev/null +++ b/lib/tdlib/types/chat_list/main.rb @@ -0,0 +1,5 @@ +module TD::Types + # A main list of chats. + class ChatList::Main < ChatList + end +end diff --git a/lib/tdlib/types/chat_location.rb b/lib/tdlib/types/chat_location.rb new file mode 100644 index 0000000..0623c9d --- /dev/null +++ b/lib/tdlib/types/chat_location.rb @@ -0,0 +1,10 @@ +module TD::Types + # Represents a location to which a chat is connected. + # + # @attr location [TD::Types::Location] The location. + # @attr address [String] Location address; 1-64 characters, as defined by the chat owner. + class ChatLocation < Base + attribute :location, TD::Types::Location + attribute :address, TD::Types::String + end +end diff --git a/lib/tdlib/types/chat_member_status/administrator.rb b/lib/tdlib/types/chat_member_status/administrator.rb index 3dc3ed1..ea25f86 100644 --- a/lib/tdlib/types/chat_member_status/administrator.rb +++ b/lib/tdlib/types/chat_member_status/administrator.rb @@ -4,6 +4,8 @@ module TD::Types # members. # In supergroups and channels, there are more detailed options for administrator privileges. # + # @attr custom_title [String] A custom title of the administrator; 0-16 characters without emojis; applicable to + # supergroups only. # @attr can_be_edited [Boolean] True, if the current user can edit the administrator privileges for the called user. # @attr can_change_info [Boolean] True, if the administrator can change the chat title, photo, and other settings. # @attr can_post_messages [Boolean] True, if the administrator can create channel posts; applicable to channels only. @@ -14,8 +16,9 @@ module TD::Types # @attr can_restrict_members [Boolean] True, if the administrator can restrict, ban, or unban chat members. # @attr can_pin_messages [Boolean] True, if the administrator can pin messages; applicable to groups only. # @attr can_promote_members [Boolean] True, if the administrator can add new administrators with a subset of their - # own privileges or demote administrators that were directly or indirectly promoted by him. + # own privileges or demote administrators that were directly or indirectly promoted by them. class ChatMemberStatus::Administrator < ChatMemberStatus + attribute :custom_title, TD::Types::String attribute :can_be_edited, TD::Types::Bool attribute :can_change_info, TD::Types::Bool attribute :can_post_messages, TD::Types::Bool diff --git a/lib/tdlib/types/chat_member_status/creator.rb b/lib/tdlib/types/chat_member_status/creator.rb index fb60f03..fd8200e 100644 --- a/lib/tdlib/types/chat_member_status/creator.rb +++ b/lib/tdlib/types/chat_member_status/creator.rb @@ -1,8 +1,11 @@ module TD::Types - # The user is the creator of a chat and has all the administrator privileges. + # The user is the owner of a chat and has all the administrator privileges. # + # @attr custom_title [String] A custom title of the owner; 0-16 characters without emojis; applicable to supergroups + # only. # @attr is_member [Boolean] True, if the user is a member of the chat. class ChatMemberStatus::Creator < ChatMemberStatus + attribute :custom_title, TD::Types::String attribute :is_member, TD::Types::Bool end end diff --git a/lib/tdlib/types/chat_members_filter/administrators.rb b/lib/tdlib/types/chat_members_filter/administrators.rb index e9368e1..19f9266 100644 --- a/lib/tdlib/types/chat_members_filter/administrators.rb +++ b/lib/tdlib/types/chat_members_filter/administrators.rb @@ -1,5 +1,5 @@ module TD::Types - # Returns the creator and administrators. + # Returns the owner and administrators. class ChatMembersFilter::Administrators < ChatMembersFilter end end diff --git a/lib/tdlib/types/chat_nearby.rb b/lib/tdlib/types/chat_nearby.rb new file mode 100644 index 0000000..4dfcd89 --- /dev/null +++ b/lib/tdlib/types/chat_nearby.rb @@ -0,0 +1,10 @@ +module TD::Types + # Describes a chat located nearby. + # + # @attr chat_id [Integer] Chat identifier. + # @attr distance [Integer] Distance to the chat location in meters. + class ChatNearby < Base + attribute :chat_id, TD::Types::Integer + attribute :distance, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/chat_report_reason.rb b/lib/tdlib/types/chat_report_reason.rb index b5c2018..4eb4026 100644 --- a/lib/tdlib/types/chat_report_reason.rb +++ b/lib/tdlib/types/chat_report_reason.rb @@ -7,6 +7,7 @@ class ChatReportReason < Base pornography child_abuse copyright + unrelated_location custom ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/chat_report_reason/#{type}" diff --git a/lib/tdlib/types/chat_report_reason/unrelated_location.rb b/lib/tdlib/types/chat_report_reason/unrelated_location.rb new file mode 100644 index 0000000..addde3a --- /dev/null +++ b/lib/tdlib/types/chat_report_reason/unrelated_location.rb @@ -0,0 +1,5 @@ +module TD::Types + # The location-based chat is unrelated to its stated location. + class ChatReportReason::UnrelatedLocation < ChatReportReason + end +end diff --git a/lib/tdlib/types/chat_report_spam_state.rb b/lib/tdlib/types/chat_report_spam_state.rb deleted file mode 100644 index cf744a2..0000000 --- a/lib/tdlib/types/chat_report_spam_state.rb +++ /dev/null @@ -1,8 +0,0 @@ -module TD::Types - # Contains information about the availability of the "Report spam" action for a chat. - # - # @attr can_report_spam [Boolean] True, if a prompt with the "Report spam" action should be shown to the user. - class ChatReportSpamState < Base - attribute :can_report_spam, TD::Types::Bool - end -end diff --git a/lib/tdlib/types/chats_nearby.rb b/lib/tdlib/types/chats_nearby.rb new file mode 100644 index 0000000..a20c629 --- /dev/null +++ b/lib/tdlib/types/chats_nearby.rb @@ -0,0 +1,10 @@ +module TD::Types + # Represents a list of chats located nearby. + # + # @attr users_nearby [Array] List of users nearby. + # @attr supergroups_nearby [Array] List of location-based supergroups nearby. + class ChatsNearby < Base + attribute :users_nearby, TD::Types::Array.of(TD::Types::ChatNearby) + attribute :supergroups_nearby, TD::Types::Array.of(TD::Types::ChatNearby) + end +end diff --git a/lib/tdlib/types/formatted_text.rb b/lib/tdlib/types/formatted_text.rb index 8ed714e..53a1597 100644 --- a/lib/tdlib/types/formatted_text.rb +++ b/lib/tdlib/types/formatted_text.rb @@ -3,6 +3,10 @@ module TD::Types # # @attr text [String] The text. # @attr entities [Array] Entities contained in the text. + # Entities can be nested, but must not mutually intersect with each other. + # Pre, Code and PreCode entities can't contain other entities. + # Bold, Italic, Underline and Strikethrough entities can contain and to be contained in all other entities. + # All other entities can't contain each other. class FormattedText < Base attribute :text, TD::Types::String attribute :entities, TD::Types::Array.of(TD::Types::TextEntity) diff --git a/lib/tdlib/types/inline_keyboard_button_type/login_url.rb b/lib/tdlib/types/inline_keyboard_button_type/login_url.rb index 292c971..cc4d810 100644 --- a/lib/tdlib/types/inline_keyboard_button_type/login_url.rb +++ b/lib/tdlib/types/inline_keyboard_button_type/login_url.rb @@ -1,7 +1,7 @@ module TD::Types # A button that opens a specified URL and automatically logs in in current user if they allowed to do that. # - # @attr url [String] HTTP URL to open. + # @attr url [String] An HTTP URL to open. # @attr id [Integer] Unique button identifier. # @attr forward_text [String] If non-empty, new text of the button in forwarded messages. class InlineKeyboardButtonType::LoginUrl < InlineKeyboardButtonType diff --git a/lib/tdlib/types/input_file/remote.rb b/lib/tdlib/types/input_file/remote.rb index c36b0d7..445502e 100644 --- a/lib/tdlib/types/input_file/remote.rb +++ b/lib/tdlib/types/input_file/remote.rb @@ -1,5 +1,9 @@ module TD::Types # A file defined by its remote ID. + # The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known + # to TDLib. + # For example, if the file is from a message, then the message must be not deleted and accessible to the user. + # If the file database is disabled, then the corresponding object with the file must be preloaded by the client. # # @attr id [String] Remote file identifier. class InputFile::Remote < InputFile diff --git a/lib/tdlib/types/input_inline_query_result/sticker.rb b/lib/tdlib/types/input_inline_query_result/sticker.rb index c44402c..7362beb 100644 --- a/lib/tdlib/types/input_inline_query_result/sticker.rb +++ b/lib/tdlib/types/input_inline_query_result/sticker.rb @@ -1,9 +1,9 @@ module TD::Types - # Represents a link to a WEBP or a TGS sticker. + # Represents a link to a WEBP or TGS sticker. # # @attr id [String] Unique identifier of the query result. # @attr thumbnail_url [String] URL of the sticker thumbnail, if it exists. - # @attr sticker_url [String] The URL of the WEBP or a TGS sticker (sticker file size must not exceed 5MB). + # @attr sticker_url [String] The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB). # @attr sticker_width [Integer] Width of the sticker. # @attr sticker_height [Integer] Height of the sticker. # @attr reply_markup [TD::Types::ReplyMarkup] The message reply markup. diff --git a/lib/tdlib/types/input_message_content/text.rb b/lib/tdlib/types/input_message_content/text.rb index 7e09947..6fb1529 100644 --- a/lib/tdlib/types/input_message_content/text.rb +++ b/lib/tdlib/types/input_message_content/text.rb @@ -2,7 +2,8 @@ module TD::Types # A text message. # # @attr text [TD::Types::FormattedText] Formatted text to be sent; 1-GetOption("message_text_length_max") characters. - # Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually. + # Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to + # be specified manually. # @attr disable_web_page_preview [Boolean] True, if rich web page previews for URLs in the message text should be # disabled. # @attr clear_draft [Boolean] True, if a chat message draft should be deleted. diff --git a/lib/tdlib/types/link_state.rb b/lib/tdlib/types/link_state.rb deleted file mode 100644 index e97e859..0000000 --- a/lib/tdlib/types/link_state.rb +++ /dev/null @@ -1,13 +0,0 @@ -module TD::Types - # Represents the relationship between user A and user B. - # For incoming_link, user A is the current user; for outgoing_link, user B is the current user. - class LinkState < Base - %w[ - none - knows_phone_number - is_contact - ].each do |type| - autoload TD::Types.camelize(type), "tdlib/types/link_state/#{type}" - end - end -end diff --git a/lib/tdlib/types/link_state/is_contact.rb b/lib/tdlib/types/link_state/is_contact.rb deleted file mode 100644 index 626387e..0000000 --- a/lib/tdlib/types/link_state/is_contact.rb +++ /dev/null @@ -1,5 +0,0 @@ -module TD::Types - # The phone number of user A has been saved to the contact list of user B. - class LinkState::IsContact < LinkState - end -end diff --git a/lib/tdlib/types/link_state/knows_phone_number.rb b/lib/tdlib/types/link_state/knows_phone_number.rb deleted file mode 100644 index 7109ee4..0000000 --- a/lib/tdlib/types/link_state/knows_phone_number.rb +++ /dev/null @@ -1,5 +0,0 @@ -module TD::Types - # The phone number of user A is known but that number has not been saved to the contact list of user B. - class LinkState::KnowsPhoneNumber < LinkState - end -end diff --git a/lib/tdlib/types/link_state/none.rb b/lib/tdlib/types/link_state/none.rb deleted file mode 100644 index 2f35de0..0000000 --- a/lib/tdlib/types/link_state/none.rb +++ /dev/null @@ -1,5 +0,0 @@ -module TD::Types - # The phone number of user A is not known to user B. - class LinkState::None < LinkState - end -end diff --git a/lib/tdlib/types/log_stream/file.rb b/lib/tdlib/types/log_stream/file.rb index 79eb386..d67663d 100644 --- a/lib/tdlib/types/log_stream/file.rb +++ b/lib/tdlib/types/log_stream/file.rb @@ -2,8 +2,8 @@ module TD::Types # The log is written to a file. # # @attr path [String] Path to the file to where the internal TDLib log will be written. - # @attr max_file_size [Integer] Maximum size of the file to where the internal TDLib log is written before the file - # will be auto-rotated. + # @attr max_file_size [Integer] The maximum size of the file to where the internal TDLib log is written before the + # file will be auto-rotated. class LogStream::File < LogStream attribute :path, TD::Types::String attribute :max_file_size, TD::Types::Integer diff --git a/lib/tdlib/types/login_url_info.rb b/lib/tdlib/types/login_url_info.rb new file mode 100644 index 0000000..2ff4fe2 --- /dev/null +++ b/lib/tdlib/types/login_url_info.rb @@ -0,0 +1,11 @@ +module TD::Types + # Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl. + class LoginUrlInfo < Base + %w[ + open + request_confirmation + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/login_url_info/#{type}" + end + end +end diff --git a/lib/tdlib/types/login_url_info/open.rb b/lib/tdlib/types/login_url_info/open.rb new file mode 100644 index 0000000..f50d9c7 --- /dev/null +++ b/lib/tdlib/types/login_url_info/open.rb @@ -0,0 +1,10 @@ +module TD::Types + # An HTTP url needs to be open. + # + # @attr url [String] The URL to open. + # @attr skip_confirm [Boolean] True, if there is no need to show an ordinary open URL confirm. + class LoginUrlInfo::Open < LoginUrlInfo + attribute :url, TD::Types::String + attribute :skip_confirm, TD::Types::Bool + end +end diff --git a/lib/tdlib/types/login_url_info/request_confirmation.rb b/lib/tdlib/types/login_url_info/request_confirmation.rb new file mode 100644 index 0000000..de14dc1 --- /dev/null +++ b/lib/tdlib/types/login_url_info/request_confirmation.rb @@ -0,0 +1,15 @@ +module TD::Types + # An authorization confirmation dialog needs to be shown to the user. + # + # @attr url [String] An HTTP URL to be opened. + # @attr domain [String] A domain of the URL. + # @attr bot_user_id [Integer] User identifier of a bot linked with the website. + # @attr request_write_access [Boolean] True, if the user needs to be requested to give the permission to the bot to + # send them messages. + class LoginUrlInfo::RequestConfirmation < LoginUrlInfo + attribute :url, TD::Types::String + attribute :domain, TD::Types::String + attribute :bot_user_id, TD::Types::Integer + attribute :request_write_access, TD::Types::Bool + end +end diff --git a/lib/tdlib/types/message.rb b/lib/tdlib/types/message.rb index fbb55c2..46886f3 100644 --- a/lib/tdlib/types/message.rb +++ b/lib/tdlib/types/message.rb @@ -7,9 +7,11 @@ module TD::Types # @attr chat_id [Integer] Chat identifier. # @attr sending_state [TD::Types::MessageSendingState, nil] Information about the sending state of the message; may # be null. + # @attr scheduling_state [TD::Types::MessageSchedulingState, nil] Information about the scheduling state of the + # message; may be null. # @attr is_outgoing [Boolean] True, if the message is outgoing. # @attr can_be_edited [Boolean] True, if the message can be edited. - # For live location and poll messages this fields shows, whether editMessageLiveLocation or stopPoll can be used + # For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used # with this message by the client. # @attr can_be_forwarded [Boolean] True, if the message can be forwarded. # @attr can_be_deleted_only_for_self [Boolean] True, if the message can be deleted only for the current user while @@ -31,6 +33,8 @@ module TD::Types # @attr views [Integer] Number of times this message was viewed. # @attr media_album_id [Integer] Unique identifier of an album this message belongs to. # Only photos and videos can be grouped together in albums. + # @attr restriction_reason [String] If non-empty, contains a human-readable description of the reason why access to + # this message must be restricted. # @attr content [TD::Types::MessageContent] Content of the message. # @attr reply_markup [TD::Types::ReplyMarkup, nil] Reply markup for the message; may be null. class Message < Base @@ -38,6 +42,7 @@ class Message < Base attribute :sender_user_id, TD::Types::Integer attribute :chat_id, TD::Types::Integer attribute :sending_state, TD::Types::MessageSendingState.optional.default(nil) + attribute :scheduling_state, TD::Types::MessageSchedulingState.optional.default(nil) attribute :is_outgoing, TD::Types::Bool attribute :can_be_edited, TD::Types::Bool attribute :can_be_forwarded, TD::Types::Bool @@ -55,6 +60,7 @@ class Message < Base attribute :author_signature, TD::Types::String.optional.default(nil) attribute :views, TD::Types::Integer attribute :media_album_id, TD::Types::Integer + attribute :restriction_reason, TD::Types::String attribute :content, TD::Types::MessageContent attribute :reply_markup, TD::Types::ReplyMarkup.optional.default(nil) end diff --git a/lib/tdlib/types/message_forward_info.rb b/lib/tdlib/types/message_forward_info.rb index 6d22e5a..649498a 100644 --- a/lib/tdlib/types/message_forward_info.rb +++ b/lib/tdlib/types/message_forward_info.rb @@ -3,11 +3,11 @@ module TD::Types # # @attr origin [TD::Types::MessageForwardOrigin] Origin of a forwarded message. # @attr date [Integer] Point in time (Unix timestamp) when the message was originally sent. - # @attr from_chat_id [Integer] For messages forwarded to the chat with the current user (saved messages) or to the - # channel discussion supergroup, the identifier of the chat from which the message was forwarded last time; 0 if unknown. - # @attr from_message_id [Integer] For messages forwarded to the chat with the current user (saved messages) or to the - # channel discussion supergroup, the identifier of the original message from which the new message was forwarded last - # time; 0 if unknown. + # @attr from_chat_id [Integer] For messages forwarded to the chat with the current user (Saved Messages) or to the + # channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown. + # @attr from_message_id [Integer] For messages forwarded to the chat with the current user (Saved Messages) or to the + # channel's discussion group, the identifier of the original message from which the new message was forwarded last time; + # 0 if unknown. class MessageForwardInfo < Base attribute :origin, TD::Types::MessageForwardOrigin attribute :date, TD::Types::Integer diff --git a/lib/tdlib/types/message_scheduling_state.rb b/lib/tdlib/types/message_scheduling_state.rb new file mode 100644 index 0000000..e963f1d --- /dev/null +++ b/lib/tdlib/types/message_scheduling_state.rb @@ -0,0 +1,11 @@ +module TD::Types + # Contains information about the time when a scheduled message will be sent. + class MessageSchedulingState < Base + %w[ + send_at_date + send_when_online + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/message_scheduling_state/#{type}" + end + end +end diff --git a/lib/tdlib/types/message_scheduling_state/send_at_date.rb b/lib/tdlib/types/message_scheduling_state/send_at_date.rb new file mode 100644 index 0000000..93c0c2a --- /dev/null +++ b/lib/tdlib/types/message_scheduling_state/send_at_date.rb @@ -0,0 +1,9 @@ +module TD::Types + # The message will be sent at the specified date. + # + # @attr send_date [Integer] Date the message will be sent. + # The date must be within 367 days in the future. + class MessageSchedulingState::SendAtDate < MessageSchedulingState + attribute :send_date, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/message_scheduling_state/send_when_online.rb b/lib/tdlib/types/message_scheduling_state/send_when_online.rb new file mode 100644 index 0000000..d5d9b58 --- /dev/null +++ b/lib/tdlib/types/message_scheduling_state/send_when_online.rb @@ -0,0 +1,6 @@ +module TD::Types + # The message will be sent when the peer will be online. + # Applicable to private chats only and when the exact online status of the peer is known. + class MessageSchedulingState::SendWhenOnline < MessageSchedulingState + end +end diff --git a/lib/tdlib/types/notification.rb b/lib/tdlib/types/notification.rb index 57e6bf6..6f18875 100644 --- a/lib/tdlib/types/notification.rb +++ b/lib/tdlib/types/notification.rb @@ -3,10 +3,12 @@ module TD::Types # # @attr id [Integer] Unique persistent identifier of this notification. # @attr date [Integer] Notification date. + # @attr is_silent [Boolean] True, if the notification was initially silent. # @attr type [TD::Types::NotificationType] Notification type. class Notification < Base attribute :id, TD::Types::Integer attribute :date, TD::Types::Integer + attribute :is_silent, TD::Types::Bool attribute :type, TD::Types::NotificationType end end diff --git a/lib/tdlib/types/page_block.rb b/lib/tdlib/types/page_block.rb index 9176632..cf37c80 100644 --- a/lib/tdlib/types/page_block.rb +++ b/lib/tdlib/types/page_block.rb @@ -20,6 +20,7 @@ class PageBlock < Base audio photo video + voice_note cover embedded embedded_post diff --git a/lib/tdlib/types/page_block/voice_note.rb b/lib/tdlib/types/page_block/voice_note.rb new file mode 100644 index 0000000..2810abe --- /dev/null +++ b/lib/tdlib/types/page_block/voice_note.rb @@ -0,0 +1,10 @@ +module TD::Types + # A voice note. + # + # @attr voice_note [TD::Types::VoiceNote, nil] Voice note; may be null. + # @attr caption [TD::Types::PageBlockCaption] Voice note caption. + class PageBlock::VoiceNote < PageBlock + attribute :voice_note, TD::Types::VoiceNote.optional.default(nil) + attribute :caption, TD::Types::PageBlockCaption + end +end diff --git a/lib/tdlib/types/page_block_table_cell.rb b/lib/tdlib/types/page_block_table_cell.rb index 9b22b4f..3379e3d 100644 --- a/lib/tdlib/types/page_block_table_cell.rb +++ b/lib/tdlib/types/page_block_table_cell.rb @@ -1,14 +1,15 @@ module TD::Types # Represents a cell of a table. # - # @attr text [TD::Types::RichText] Cell text. + # @attr text [TD::Types::RichText, nil] Cell text; may be null. + # If the text is null, then the cell should be invisible. # @attr is_header [Boolean] True, if it is a header cell. # @attr colspan [Integer] The number of columns the cell should span. # @attr rowspan [Integer] The number of rows the cell should span. # @attr align [TD::Types::PageBlockHorizontalAlignment] Horizontal cell content alignment. # @attr valign [TD::Types::PageBlockVerticalAlignment] Vertical cell content alignment. class PageBlockTableCell < Base - attribute :text, TD::Types::RichText + attribute :text, TD::Types::RichText.optional.default(nil) attribute :is_header, TD::Types::Bool attribute :colspan, TD::Types::Integer attribute :rowspan, TD::Types::Integer diff --git a/lib/tdlib/types/public_chat_type.rb b/lib/tdlib/types/public_chat_type.rb new file mode 100644 index 0000000..a6d0b3f --- /dev/null +++ b/lib/tdlib/types/public_chat_type.rb @@ -0,0 +1,11 @@ +module TD::Types + # Describes a type of public chats. + class PublicChatType < Base + %w[ + has_username + is_location_based + ].each do |type| + autoload TD::Types.camelize(type), "tdlib/types/public_chat_type/#{type}" + end + end +end diff --git a/lib/tdlib/types/public_chat_type/has_username.rb b/lib/tdlib/types/public_chat_type/has_username.rb new file mode 100644 index 0000000..8c6bb75 --- /dev/null +++ b/lib/tdlib/types/public_chat_type/has_username.rb @@ -0,0 +1,5 @@ +module TD::Types + # The chat is public, because it has username. + class PublicChatType::HasUsername < PublicChatType + end +end diff --git a/lib/tdlib/types/public_chat_type/is_location_based.rb b/lib/tdlib/types/public_chat_type/is_location_based.rb new file mode 100644 index 0000000..e066b8a --- /dev/null +++ b/lib/tdlib/types/public_chat_type/is_location_based.rb @@ -0,0 +1,5 @@ +module TD::Types + # The chat is public, because it is a location-based supergroup. + class PublicChatType::IsLocationBased < PublicChatType + end +end diff --git a/lib/tdlib/types/public_message_link.rb b/lib/tdlib/types/public_message_link.rb index f23f082..f053df2 100644 --- a/lib/tdlib/types/public_message_link.rb +++ b/lib/tdlib/types/public_message_link.rb @@ -1,5 +1,5 @@ module TD::Types - # Contains a public HTTPS link to a message in a public supergroup or channel with a username. + # Contains a public HTTPS link to a message in a supergroup or channel with a username. # # @attr link [String] Message link. # @attr html [String] HTML-code for embedding the message. diff --git a/lib/tdlib/types/push_message_content/chat_add_members.rb b/lib/tdlib/types/push_message_content/chat_add_members.rb index 612d512..6b6236e 100644 --- a/lib/tdlib/types/push_message_content/chat_add_members.rb +++ b/lib/tdlib/types/push_message_content/chat_add_members.rb @@ -3,7 +3,7 @@ module TD::Types # # @attr member_name [String] Name of the added member. # @attr is_current_user [Boolean] True, if the current user was added to the group. - # @attr is_returned [Boolean] True, if the user has returned to the group himself. + # @attr is_returned [Boolean] True, if the user has returned to the group themself. class PushMessageContent::ChatAddMembers < PushMessageContent attribute :member_name, TD::Types::String attribute :is_current_user, TD::Types::Bool diff --git a/lib/tdlib/types/push_message_content/chat_delete_member.rb b/lib/tdlib/types/push_message_content/chat_delete_member.rb index a974d33..14e378c 100644 --- a/lib/tdlib/types/push_message_content/chat_delete_member.rb +++ b/lib/tdlib/types/push_message_content/chat_delete_member.rb @@ -3,7 +3,7 @@ module TD::Types # # @attr member_name [String] Name of the deleted member. # @attr is_current_user [Boolean] True, if the current user was deleted from the group. - # @attr is_left [Boolean] True, if the user has left the group himself. + # @attr is_left [Boolean] True, if the user has left the group themself. class PushMessageContent::ChatDeleteMember < PushMessageContent attribute :member_name, TD::Types::String attribute :is_current_user, TD::Types::Bool diff --git a/lib/tdlib/types/remote_file.rb b/lib/tdlib/types/remote_file.rb index 952b77a..57b0978 100644 --- a/lib/tdlib/types/remote_file.rb +++ b/lib/tdlib/types/remote_file.rb @@ -3,18 +3,23 @@ module TD::Types # # @attr id [String, nil] Remote file identifier; may be empty. # Can be used across application restarts or even from other devices for the current user. + # Uniquely identifies a file, but a file can have a lot of different valid identifiers. # If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. # TDLib is currently unable to download files if only their URL is known. # If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation # process by sending {TD::Types::Update::FileGenerationStart} to the client with the HTTP URL in the original_path and # "#url#" as the conversion string. # Clients should generate the file by downloading it to the specified location. + # @attr unique_id [String, nil] Unique file identifier; may be empty if unknown. + # The unique file identifier which is the same for the same file even for different users and is persistent over + # time. # @attr is_uploading_active [Boolean] True, if the file is currently being uploaded (or a remote copy is being # generated by some other means). # @attr is_uploading_completed [Boolean] True, if a remote copy is fully available. # @attr uploaded_size [Integer] Size of the remote available part of the file; 0 if unknown. class RemoteFile < Base attribute :id, TD::Types::String.optional.default(nil) + attribute :unique_id, TD::Types::String.optional.default(nil) attribute :is_uploading_active, TD::Types::Bool attribute :is_uploading_completed, TD::Types::Bool attribute :uploaded_size, TD::Types::Integer diff --git a/lib/tdlib/types/rich_text/strikethrough.rb b/lib/tdlib/types/rich_text/strikethrough.rb index 19474c3..0b5b8aa 100644 --- a/lib/tdlib/types/rich_text/strikethrough.rb +++ b/lib/tdlib/types/rich_text/strikethrough.rb @@ -1,5 +1,5 @@ module TD::Types - # A strike-through rich text. + # A strikethrough rich text. # # @attr text [TD::Types::RichText] Text. class RichText::Strikethrough < RichText diff --git a/lib/tdlib/types/rich_text/url.rb b/lib/tdlib/types/rich_text/url.rb index 1c02204..0d65b86 100644 --- a/lib/tdlib/types/rich_text/url.rb +++ b/lib/tdlib/types/rich_text/url.rb @@ -3,8 +3,10 @@ module TD::Types # # @attr text [TD::Types::RichText] Text. # @attr url [String] URL. + # @attr is_cached [Boolean] True, if the URL has cached instant view server-side. class RichText::Url < RichText attribute :text, TD::Types::RichText attribute :url, TD::Types::String + attribute :is_cached, TD::Types::Bool end end diff --git a/lib/tdlib/types/secret_chat.rb b/lib/tdlib/types/secret_chat.rb index bf1e40f..dc8d08d 100644 --- a/lib/tdlib/types/secret_chat.rb +++ b/lib/tdlib/types/secret_chat.rb @@ -7,13 +7,14 @@ module TD::Types # @attr is_outbound [Boolean] True, if the chat was created by the current user; otherwise false. # @attr ttl [Integer] Current message Time To Live setting (self-destruct timer) for the chat, in seconds. # @attr key_hash [String] Hash of the currently used key for comparison with the hash of the chat partner's key. - # This is a string of 36 bytes, which must be used to make a 12x12 square image with a color depth of 4. - # The first 16 bytes should be used to make a central 8x8 square, while the remaining 20 bytes should be used to - # construct a 2-pixel-wide border around that square. + # This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of + # one of 4 colors. + # The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. # Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 # 2-digit hex numbers. # @attr layer [Integer] Secret chat layer; determines features supported by the other client. - # Video notes are supported if the layer >= 66. + # Video notes are supported if the layer >= 66; nested text entities and underline and strikethrough entities are + # supported if the layer >= 101. class SecretChat < Base attribute :id, TD::Types::Integer attribute :user_id, TD::Types::Integer diff --git a/lib/tdlib/types/send_message_options.rb b/lib/tdlib/types/send_message_options.rb new file mode 100644 index 0000000..84c5c5b --- /dev/null +++ b/lib/tdlib/types/send_message_options.rb @@ -0,0 +1,14 @@ +module TD::Types + # Options to be used when a message is send. + # + # @attr disable_notification [Boolean] Pass true to disable notification for the message. + # Must be false if the message is sent to a secret chat. + # @attr from_background [Boolean] Pass true if the message is sent from the background. + # @attr scheduling_state [TD::Types::MessageSchedulingState] Message scheduling state. + # Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled. + class SendMessageOptions < Base + attribute :disable_notification, TD::Types::Bool + attribute :from_background, TD::Types::Bool + attribute :scheduling_state, TD::Types::MessageSchedulingState + end +end diff --git a/lib/tdlib/types/supergroup.rb b/lib/tdlib/types/supergroup.rb index 7e03e38..22ab96a 100644 --- a/lib/tdlib/types/supergroup.rb +++ b/lib/tdlib/types/supergroup.rb @@ -9,20 +9,21 @@ module TD::Types # @attr username [String, nil] Username of the supergroup or channel; empty for private supergroups or channels. # @attr date [Integer] Point in time (Unix timestamp) when the current user joined, or the point in time when the # supergroup or channel was created, in case the user is not a member. - # @attr status [TD::Types::ChatMemberStatus] Status of the current user in the supergroup or channel. + # @attr status [TD::Types::ChatMemberStatus] Status of the current user in the supergroup or channel; custom title + # will be always empty. # @attr member_count [Integer] Member count; 0 if unknown. # Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats. + # @attr has_linked_chat [Boolean] True, if the channel has a discussion group, or the supergroup is the designated + # discussion group for a channel. + # @attr has_location [Boolean] True, if the supergroup is connected to a location, i.e. + # the supergroup is a location-based supergroup. # @attr sign_messages [Boolean] True, if messages sent to the channel should contain information about the sender. # This field is only applicable to channels. + # @attr is_slow_mode_enabled [Boolean] True, if the slow mode is enabled in the supergroup. # @attr is_channel [Boolean] True, if the supergroup is a channel. # @attr is_verified [Boolean] True, if the supergroup or channel is verified. - # @attr restriction_reason [String] If non-empty, contains the reason why access to this supergroup or channel must - # be restricted. - # Format of the string is "{type}: {description}". - # {type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or - # "-wp", which describe the platforms on which access should be restricted. - # (For example, "terms-ios-android". - # {description} contains a human-readable description of the restriction, which can be shown to the user). + # @attr restriction_reason [String] If non-empty, contains a human-readable description of the reason why access to + # this supergroup or channel must be restricted. # @attr is_scam [Boolean] True, if many users reported this supergroup as a scam. class Supergroup < Base attribute :id, TD::Types::Integer @@ -30,7 +31,10 @@ class Supergroup < Base attribute :date, TD::Types::Integer attribute :status, TD::Types::ChatMemberStatus attribute :member_count, TD::Types::Integer + attribute :has_linked_chat, TD::Types::Bool + attribute :has_location, TD::Types::Bool attribute :sign_messages, TD::Types::Bool + attribute :is_slow_mode_enabled, TD::Types::Bool attribute :is_channel, TD::Types::Bool attribute :is_verified, TD::Types::Bool attribute :restriction_reason, TD::Types::String diff --git a/lib/tdlib/types/supergroup_full_info.rb b/lib/tdlib/types/supergroup_full_info.rb index 5a437bc..2c52402 100644 --- a/lib/tdlib/types/supergroup_full_info.rb +++ b/lib/tdlib/types/supergroup_full_info.rb @@ -6,15 +6,24 @@ module TD::Types # @attr administrator_count [Integer] Number of privileged users in the supergroup or channel; 0 if unknown. # @attr restricted_count [Integer] Number of restricted users in the supergroup; 0 if unknown. # @attr banned_count [Integer] Number of users banned from chat; 0 if unknown. + # @attr linked_chat_id [Integer] Chat identifier of a discussion group for the channel, or a channel, for which the + # supergroup is the designated discussion group; 0 if none or unknown. + # @attr slow_mode_delay [Integer] Delay between consecutive sent messages for non-administrator supergroup members, + # in seconds. + # @attr slow_mode_delay_expires_in [Float] Time left before next message can be sent in the supergroup, in seconds. + # An {TD::Types::Update::SupergroupFullInfo} update is not triggered when value of this field changes, but both new + # and old values are non-zero. # @attr can_get_members [Boolean] True, if members of the chat can be retrieved. - # @attr can_set_username [Boolean] True, if the chat can be made public. + # @attr can_set_username [Boolean] True, if the chat username can be changed. # @attr can_set_sticker_set [Boolean] True, if the supergroup sticker set can be changed. + # @attr can_set_location [Boolean] True, if the supergroup location can be changed. # @attr can_view_statistics [Boolean] True, if the channel statistics is available through getChatStatisticsUrl. # @attr is_all_history_available [Boolean] True, if new chat members will have access to old messages. - # In public supergroups and both public and private channels, old messages are always available, so this option - # affects only private supergroups. + # In public or discussion groups and both public and private channels, old messages are always available, so this + # option affects only private supergroups without a linked chat. # The value of this field is only available for chat administrators. # @attr sticker_set_id [Integer] Identifier of the supergroup sticker set; 0 if none. + # @attr location [TD::Types::ChatLocation, nil] Location to which the supergroup is connected; may be null. # @attr invite_link [String] Invite link for this chat. # @attr upgraded_from_basic_group_id [Integer] Identifier of the basic group from which supergroup was upgraded; 0 if # none. @@ -26,12 +35,17 @@ class SupergroupFullInfo < Base attribute :administrator_count, TD::Types::Integer attribute :restricted_count, TD::Types::Integer attribute :banned_count, TD::Types::Integer + attribute :linked_chat_id, TD::Types::Integer + attribute :slow_mode_delay, TD::Types::Integer + attribute :slow_mode_delay_expires_in, TD::Types::Float attribute :can_get_members, TD::Types::Bool attribute :can_set_username, TD::Types::Bool attribute :can_set_sticker_set, TD::Types::Bool + attribute :can_set_location, TD::Types::Bool attribute :can_view_statistics, TD::Types::Bool attribute :is_all_history_available, TD::Types::Bool attribute :sticker_set_id, TD::Types::Integer + attribute :location, TD::Types::ChatLocation.optional.default(nil) attribute :invite_link, TD::Types::String attribute :upgraded_from_basic_group_id, TD::Types::Integer attribute :upgraded_from_max_message_id, TD::Types::Integer diff --git a/lib/tdlib/types/supergroup_members_filter/administrators.rb b/lib/tdlib/types/supergroup_members_filter/administrators.rb index a3c381f..760ad03 100644 --- a/lib/tdlib/types/supergroup_members_filter/administrators.rb +++ b/lib/tdlib/types/supergroup_members_filter/administrators.rb @@ -1,5 +1,5 @@ module TD::Types - # Returns the creator and administrators. + # Returns the owner and administrators. class SupergroupMembersFilter::Administrators < SupergroupMembersFilter end end diff --git a/lib/tdlib/types/terms_of_service.rb b/lib/tdlib/types/terms_of_service.rb index ae79ac7..c087603 100644 --- a/lib/tdlib/types/terms_of_service.rb +++ b/lib/tdlib/types/terms_of_service.rb @@ -2,7 +2,7 @@ module TD::Types # Contains Telegram terms of service. # # @attr text [TD::Types::FormattedText] Text of the terms of service. - # @attr min_user_age [Integer] Minimum age of a user to be able to accept the terms; 0 if any. + # @attr min_user_age [Integer] The minimum age of a user to be able to accept the terms; 0 if any. # @attr show_popup [Boolean] True, if a blocking popup with terms of service must be shown to the user. class TermsOfService < Base attribute :text, TD::Types::FormattedText diff --git a/lib/tdlib/types/text_entity_type.rb b/lib/tdlib/types/text_entity_type.rb index e43ac89..74f5c13 100644 --- a/lib/tdlib/types/text_entity_type.rb +++ b/lib/tdlib/types/text_entity_type.rb @@ -8,14 +8,16 @@ class TextEntityType < Base bot_command url email_address + phone_number bold italic + underline + strikethrough code pre pre_code text_url mention_name - phone_number ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/text_entity_type/#{type}" end diff --git a/lib/tdlib/types/text_entity_type/strikethrough.rb b/lib/tdlib/types/text_entity_type/strikethrough.rb new file mode 100644 index 0000000..9ce34ea --- /dev/null +++ b/lib/tdlib/types/text_entity_type/strikethrough.rb @@ -0,0 +1,5 @@ +module TD::Types + # A strikethrough text. + class TextEntityType::Strikethrough < TextEntityType + end +end diff --git a/lib/tdlib/types/text_entity_type/underline.rb b/lib/tdlib/types/text_entity_type/underline.rb new file mode 100644 index 0000000..8798957 --- /dev/null +++ b/lib/tdlib/types/text_entity_type/underline.rb @@ -0,0 +1,5 @@ +module TD::Types + # An underlined text. + class TextEntityType::Underline < TextEntityType + end +end diff --git a/lib/tdlib/types/text_parse_mode/markdown.rb b/lib/tdlib/types/text_parse_mode/markdown.rb index 1e495fe..54e14ae 100644 --- a/lib/tdlib/types/text_parse_mode/markdown.rb +++ b/lib/tdlib/types/text_parse_mode/markdown.rb @@ -1,5 +1,9 @@ module TD::Types # The text should be parsed in markdown-style. + # + # @attr version [Integer] Version of the parser: 0 or 1 - Bot API Markdown parse mode, 2 - Bot API MarkdownV2 parse + # mode. class TextParseMode::Markdown < TextParseMode + attribute :version, TD::Types::Integer end end diff --git a/lib/tdlib/types/ton_lite_server_response.rb b/lib/tdlib/types/ton_lite_server_response.rb new file mode 100644 index 0000000..9b49925 --- /dev/null +++ b/lib/tdlib/types/ton_lite_server_response.rb @@ -0,0 +1,8 @@ +module TD::Types + # Contains the response of a request to TON lite server. + # + # @attr response [String] The response. + class TonLiteServerResponse < Base + attribute :response, TD::Types::String + end +end diff --git a/lib/tdlib/types/ton_wallet_password_salt.rb b/lib/tdlib/types/ton_wallet_password_salt.rb new file mode 100644 index 0000000..e7dfc38 --- /dev/null +++ b/lib/tdlib/types/ton_wallet_password_salt.rb @@ -0,0 +1,8 @@ +module TD::Types + # Contains the salt to be used with locally stored password to access a local TON-based wallet. + # + # @attr salt [String] The salt. + class TonWalletPasswordSalt < Base + attribute :salt, TD::Types::String + end +end diff --git a/lib/tdlib/types/top_chat_category.rb b/lib/tdlib/types/top_chat_category.rb index 77585e0..1006996 100644 --- a/lib/tdlib/types/top_chat_category.rb +++ b/lib/tdlib/types/top_chat_category.rb @@ -8,6 +8,7 @@ class TopChatCategory < Base channels inline_bots calls + forward_chats ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/top_chat_category/#{type}" end diff --git a/lib/tdlib/types/top_chat_category/forward_chats.rb b/lib/tdlib/types/top_chat_category/forward_chats.rb new file mode 100644 index 0000000..f86ad12 --- /dev/null +++ b/lib/tdlib/types/top_chat_category/forward_chats.rb @@ -0,0 +1,5 @@ +module TD::Types + # A category containing frequently used chats used to forward messages. + class TopChatCategory::ForwardChats < TopChatCategory + end +end diff --git a/lib/tdlib/types/update.rb b/lib/tdlib/types/update.rb index 5626229..80b880a 100644 --- a/lib/tdlib/types/update.rb +++ b/lib/tdlib/types/update.rb @@ -12,7 +12,9 @@ class Update < Base message_views message_content_opened message_mention_read + message_live_location_viewed new_chat + chat_chat_list chat_title chat_photo chat_permissions @@ -21,12 +23,14 @@ class Update < Base chat_is_pinned chat_is_marked_as_unread chat_is_sponsored + chat_has_scheduled_messages chat_default_disable_notification chat_read_inbox chat_read_outbox chat_unread_mention_count chat_notification_settings scope_notification_settings + chat_action_bar chat_pinned_message chat_reply_markup chat_draft_message @@ -63,6 +67,7 @@ class Update < Base language_pack_strings connection_state terms_of_service + users_nearby new_inline_query new_chosen_inline_result new_callback_query diff --git a/lib/tdlib/types/update/active_notifications.rb b/lib/tdlib/types/update/active_notifications.rb index 900a0a2..8aa7e53 100644 --- a/lib/tdlib/types/update/active_notifications.rb +++ b/lib/tdlib/types/update/active_notifications.rb @@ -1,6 +1,6 @@ module TD::Types # Contains active notifications that was shown on previous application launches. - # This update is sent only if a message database is used. + # This update is sent only if the message database is used. # In that case it comes once before any updateNotification and updateNotificationGroup update. # # @attr groups [Array] Lists of active notification groups. diff --git a/lib/tdlib/types/update/chat_action_bar.rb b/lib/tdlib/types/update/chat_action_bar.rb new file mode 100644 index 0000000..0f2ecb8 --- /dev/null +++ b/lib/tdlib/types/update/chat_action_bar.rb @@ -0,0 +1,10 @@ +module TD::Types + # The chat action bar was changed. + # + # @attr chat_id [Integer] Chat identifier. + # @attr action_bar [TD::Types::ChatActionBar, nil] The new value of the action bar; may be null. + class Update::ChatActionBar < Update + attribute :chat_id, TD::Types::Integer + attribute :action_bar, TD::Types::ChatActionBar.optional.default(nil) + end +end diff --git a/lib/tdlib/types/update/chat_chat_list.rb b/lib/tdlib/types/update/chat_chat_list.rb new file mode 100644 index 0000000..acdcdf4 --- /dev/null +++ b/lib/tdlib/types/update/chat_chat_list.rb @@ -0,0 +1,11 @@ +module TD::Types + # The list to which the chat belongs was changed. + # This update is guaranteed to be sent only when chat.order == 0 and the current or the new chat list is null. + # + # @attr chat_id [Integer] Chat identifier. + # @attr chat_list [TD::Types::ChatList, nil] The new chat's chat list; may be null. + class Update::ChatChatList < Update + attribute :chat_id, TD::Types::Integer + attribute :chat_list, TD::Types::ChatList.optional.default(nil) + end +end diff --git a/lib/tdlib/types/update/chat_has_scheduled_messages.rb b/lib/tdlib/types/update/chat_has_scheduled_messages.rb new file mode 100644 index 0000000..59915c0 --- /dev/null +++ b/lib/tdlib/types/update/chat_has_scheduled_messages.rb @@ -0,0 +1,10 @@ +module TD::Types + # A chat's has_scheduled_messages field has changed. + # + # @attr chat_id [Integer] Chat identifier. + # @attr has_scheduled_messages [Boolean] New value of has_scheduled_messages. + class Update::ChatHasScheduledMessages < Update + attribute :chat_id, TD::Types::Integer + attribute :has_scheduled_messages, TD::Types::Bool + end +end diff --git a/lib/tdlib/types/update/chat_last_message.rb b/lib/tdlib/types/update/chat_last_message.rb index 5e2c856..a15f62b 100644 --- a/lib/tdlib/types/update/chat_last_message.rb +++ b/lib/tdlib/types/update/chat_last_message.rb @@ -1,6 +1,6 @@ module TD::Types # The last message of a chat was changed. - # If last_message is null then the last message in the chat became unknown. + # If last_message is null, then the last message in the chat became unknown. # Some new unknown messages might be added to the chat in this case. # # @attr chat_id [Integer] Chat identifier. diff --git a/lib/tdlib/types/update/chat_order.rb b/lib/tdlib/types/update/chat_order.rb index ad8341d..a0490c0 100644 --- a/lib/tdlib/types/update/chat_order.rb +++ b/lib/tdlib/types/update/chat_order.rb @@ -1,6 +1,7 @@ module TD::Types # The order of the chat in the chat list has changed. - # Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent. + # Instead of this update updateChatLastMessage, updateChatIsPinned, updateChatDraftMessage, or updateChatIsSponsored + # might be sent. # # @attr chat_id [Integer] Chat identifier. # @attr order [Integer] New value of the order. diff --git a/lib/tdlib/types/update/have_pending_notifications.rb b/lib/tdlib/types/update/have_pending_notifications.rb index 3fc1d29..4d26c86 100644 --- a/lib/tdlib/types/update/have_pending_notifications.rb +++ b/lib/tdlib/types/update/have_pending_notifications.rb @@ -1,5 +1,5 @@ module TD::Types - # Describes, whether there are some pending notification updates. + # Describes whether there are some pending notification updates. # Can be used to prevent application from killing, while there are some pending notifications. # # @attr have_delayed_notifications [Boolean] True, if there are some delayed notification updates, which will be sent diff --git a/lib/tdlib/types/update/message_live_location_viewed.rb b/lib/tdlib/types/update/message_live_location_viewed.rb new file mode 100644 index 0000000..4975f94 --- /dev/null +++ b/lib/tdlib/types/update/message_live_location_viewed.rb @@ -0,0 +1,11 @@ +module TD::Types + # A message with a live location was viewed. + # When the update is received, the client is supposed to update the live location. + # + # @attr chat_id [Integer] Identifier of the chat with the live location message. + # @attr message_id [Integer] Identifier of the message with live location. + class Update::MessageLiveLocationViewed < Update + attribute :chat_id, TD::Types::Integer + attribute :message_id, TD::Types::Integer + end +end diff --git a/lib/tdlib/types/update/new_callback_query.rb b/lib/tdlib/types/update/new_callback_query.rb index eef055e..8bc0749 100644 --- a/lib/tdlib/types/update/new_callback_query.rb +++ b/lib/tdlib/types/update/new_callback_query.rb @@ -3,7 +3,7 @@ module TD::Types # # @attr id [Integer] Unique query identifier. # @attr sender_user_id [Integer] Identifier of the user who sent the query. - # @attr chat_id [Integer] Identifier of the chat, in which the query was sent. + # @attr chat_id [Integer] Identifier of the chat where the query was sent. # @attr message_id [Integer] Identifier of the message, from which the query originated. # @attr chat_instance [Integer] Identifier that uniquely corresponds to the chat to which the message was sent. # @attr payload [TD::Types::CallbackQueryPayload] Query payload. diff --git a/lib/tdlib/types/update/unread_chat_count.rb b/lib/tdlib/types/update/unread_chat_count.rb index feb9a39..92362da 100644 --- a/lib/tdlib/types/update/unread_chat_count.rb +++ b/lib/tdlib/types/update/unread_chat_count.rb @@ -1,13 +1,17 @@ module TD::Types # Number of unread chats, i.e. # with unread messages or marked as unread, has changed. - # This update is sent only if a message database is used. + # This update is sent only if the message database is used. # + # @attr chat_list [TD::Types::ChatList] The chat list with changed number of unread messages. + # @attr total_count [Integer] Approximate total number of chats in the chat list. # @attr unread_count [Integer] Total number of unread chats. # @attr unread_unmuted_count [Integer] Total number of unread unmuted chats. # @attr marked_as_unread_count [Integer] Total number of chats marked as unread. # @attr marked_as_unread_unmuted_count [Integer] Total number of unmuted chats marked as unread. class Update::UnreadChatCount < Update + attribute :chat_list, TD::Types::ChatList + attribute :total_count, TD::Types::Integer attribute :unread_count, TD::Types::Integer attribute :unread_unmuted_count, TD::Types::Integer attribute :marked_as_unread_count, TD::Types::Integer diff --git a/lib/tdlib/types/update/unread_message_count.rb b/lib/tdlib/types/update/unread_message_count.rb index 28c4a6f..fa8862e 100644 --- a/lib/tdlib/types/update/unread_message_count.rb +++ b/lib/tdlib/types/update/unread_message_count.rb @@ -1,10 +1,12 @@ module TD::Types - # Number of unread messages has changed. - # This update is sent only if a message database is used. + # Number of unread messages in a chat list has changed. + # This update is sent only if the message database is used. # + # @attr chat_list [TD::Types::ChatList] The chat list with changed number of unread messages. # @attr unread_count [Integer] Total number of unread messages. # @attr unread_unmuted_count [Integer] Total number of unread messages in unmuted chats. class Update::UnreadMessageCount < Update + attribute :chat_list, TD::Types::ChatList attribute :unread_count, TD::Types::Integer attribute :unread_unmuted_count, TD::Types::Integer end diff --git a/lib/tdlib/types/update/users_nearby.rb b/lib/tdlib/types/update/users_nearby.rb new file mode 100644 index 0000000..af9f1c8 --- /dev/null +++ b/lib/tdlib/types/update/users_nearby.rb @@ -0,0 +1,9 @@ +module TD::Types + # List of users nearby has changed. + # The update is sent only 60 seconds after a successful searchChatsNearby request. + # + # @attr users_nearby [Array] The new list of users nearby. + class Update::UsersNearby < Update + attribute :users_nearby, TD::Types::Array.of(TD::Types::ChatNearby) + end +end diff --git a/lib/tdlib/types/user.rb b/lib/tdlib/types/user.rb index 4a10d25..483f6b7 100644 --- a/lib/tdlib/types/user.rb +++ b/lib/tdlib/types/user.rb @@ -8,16 +8,13 @@ module TD::Types # @attr phone_number [String] Phone number of the user. # @attr status [TD::Types::UserStatus] Current online status of the user. # @attr profile_photo [TD::Types::ProfilePhoto, nil] Profile photo of the user; may be null. - # @attr outgoing_link [TD::Types::LinkState] Relationship from the current user to the other user. - # @attr incoming_link [TD::Types::LinkState] Relationship from the other user to the current user. + # @attr is_contact [Boolean] The user is a contact of the current user. + # @attr is_mutual_contact [Boolean] The user is a contact of the current user and the current user is a contact of + # the user. # @attr is_verified [Boolean] True, if the user is verified. # @attr is_support [Boolean] True, if the user is Telegram support account. - # @attr restriction_reason [String] If non-empty, it contains the reason why access to this user must be restricted. - # The format of the string is "{type}: {description}". - # {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or - # "-wp", which describe the platforms on which access should be restricted. - # (For example, "terms-ios-android". - # {description} contains a human-readable description of the restriction, which can be shown to the user). + # @attr restriction_reason [String] If non-empty, it contains a human-readable description of the reason why access + # to this user must be restricted. # @attr is_scam [Boolean] True, if many users reported this user as a scam. # @attr have_access [Boolean] If false, the user is inaccessible, and the only information known about the user is # inside this class. @@ -32,8 +29,8 @@ class User < Base attribute :phone_number, TD::Types::String attribute :status, TD::Types::UserStatus attribute :profile_photo, TD::Types::ProfilePhoto.optional.default(nil) - attribute :outgoing_link, TD::Types::LinkState - attribute :incoming_link, TD::Types::LinkState + attribute :is_contact, TD::Types::Bool + attribute :is_mutual_contact, TD::Types::Bool attribute :is_verified, TD::Types::Bool attribute :is_support, TD::Types::Bool attribute :restriction_reason, TD::Types::String diff --git a/lib/tdlib/types/user_full_info.rb b/lib/tdlib/types/user_full_info.rb index 9dfebcd..64806e4 100644 --- a/lib/tdlib/types/user_full_info.rb +++ b/lib/tdlib/types/user_full_info.rb @@ -4,6 +4,8 @@ module TD::Types # @attr is_blocked [Boolean] True, if the user is blacklisted by the current user. # @attr can_be_called [Boolean] True, if the user can be called. # @attr has_private_calls [Boolean] True, if the user can't be called due to their privacy settings. + # @attr need_phone_number_privacy_exception [Boolean] True, if the current user needs to explicitly allow to share + # their phone number with the user when the method addContact is used. # @attr bio [String] A short user bio. # @attr share_text [String] For bots, the text that is included with the link when users share the bot. # @attr group_in_common_count [Integer] Number of group chats where both the other user and the current user are a @@ -13,6 +15,7 @@ class UserFullInfo < Base attribute :is_blocked, TD::Types::Bool attribute :can_be_called, TD::Types::Bool attribute :has_private_calls, TD::Types::Bool + attribute :need_phone_number_privacy_exception, TD::Types::Bool attribute :bio, TD::Types::String attribute :share_text, TD::Types::String attribute :group_in_common_count, TD::Types::Integer diff --git a/lib/tdlib/types/user_privacy_setting.rb b/lib/tdlib/types/user_privacy_setting.rb index e96630e..f22d2a7 100644 --- a/lib/tdlib/types/user_privacy_setting.rb +++ b/lib/tdlib/types/user_privacy_setting.rb @@ -5,9 +5,11 @@ class UserPrivacySetting < Base show_status show_profile_photo show_link_in_forwarded_messages + show_phone_number allow_chat_invites allow_calls allow_peer_to_peer_calls + allow_finding_by_phone_number ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/user_privacy_setting/#{type}" end diff --git a/lib/tdlib/types/user_privacy_setting/allow_finding_by_phone_number.rb b/lib/tdlib/types/user_privacy_setting/allow_finding_by_phone_number.rb new file mode 100644 index 0000000..07475e2 --- /dev/null +++ b/lib/tdlib/types/user_privacy_setting/allow_finding_by_phone_number.rb @@ -0,0 +1,7 @@ +module TD::Types + # A privacy setting for managing whether the user can be found by their phone number. + # Checked only if the phone number is not known to the other user. + # Can be set only to "Allow contacts" or "Allow all". + class UserPrivacySetting::AllowFindingByPhoneNumber < UserPrivacySetting + end +end diff --git a/lib/tdlib/types/user_privacy_setting/show_phone_number.rb b/lib/tdlib/types/user_privacy_setting/show_phone_number.rb new file mode 100644 index 0000000..98087b5 --- /dev/null +++ b/lib/tdlib/types/user_privacy_setting/show_phone_number.rb @@ -0,0 +1,5 @@ +module TD::Types + # A privacy setting for managing whether the user's phone number is visible. + class UserPrivacySetting::ShowPhoneNumber < UserPrivacySetting + end +end diff --git a/lib/tdlib/types/user_privacy_setting_rule.rb b/lib/tdlib/types/user_privacy_setting_rule.rb index c400b4d..a1939c4 100644 --- a/lib/tdlib/types/user_privacy_setting_rule.rb +++ b/lib/tdlib/types/user_privacy_setting_rule.rb @@ -5,9 +5,11 @@ class UserPrivacySettingRule < Base allow_all allow_contacts allow_users + allow_chat_members restrict_all restrict_contacts restrict_users + restrict_chat_members ].each do |type| autoload TD::Types.camelize(type), "tdlib/types/user_privacy_setting_rule/#{type}" end diff --git a/lib/tdlib/types/user_privacy_setting_rule/allow_chat_members.rb b/lib/tdlib/types/user_privacy_setting_rule/allow_chat_members.rb new file mode 100644 index 0000000..8ba529e --- /dev/null +++ b/lib/tdlib/types/user_privacy_setting_rule/allow_chat_members.rb @@ -0,0 +1,8 @@ +module TD::Types + # A rule to allow all members of certain specified basic groups and supergroups to doing something. + # + # @attr chat_ids [Array] The chat identifiers, total number of chats in all rules must not exceed 20. + class UserPrivacySettingRule::AllowChatMembers < UserPrivacySettingRule + attribute :chat_ids, TD::Types::Array.of(TD::Types::Integer) + end +end diff --git a/lib/tdlib/types/user_privacy_setting_rule/allow_users.rb b/lib/tdlib/types/user_privacy_setting_rule/allow_users.rb index 562193a..c3a1cce 100644 --- a/lib/tdlib/types/user_privacy_setting_rule/allow_users.rb +++ b/lib/tdlib/types/user_privacy_setting_rule/allow_users.rb @@ -1,7 +1,7 @@ module TD::Types # A rule to allow certain specified users to do something. # - # @attr user_ids [Array] The user identifiers. + # @attr user_ids [Array] The user identifiers, total number of users in all rules must not exceed 1000. class UserPrivacySettingRule::AllowUsers < UserPrivacySettingRule attribute :user_ids, TD::Types::Array.of(TD::Types::Integer) end diff --git a/lib/tdlib/types/user_privacy_setting_rule/restrict_chat_members.rb b/lib/tdlib/types/user_privacy_setting_rule/restrict_chat_members.rb new file mode 100644 index 0000000..3a32473 --- /dev/null +++ b/lib/tdlib/types/user_privacy_setting_rule/restrict_chat_members.rb @@ -0,0 +1,8 @@ +module TD::Types + # A rule to restrict all members of specified basic groups and supergroups from doing something. + # + # @attr chat_ids [Array] The chat identifiers, total number of chats in all rules must not exceed 20. + class UserPrivacySettingRule::RestrictChatMembers < UserPrivacySettingRule + attribute :chat_ids, TD::Types::Array.of(TD::Types::Integer) + end +end diff --git a/lib/tdlib/types/user_privacy_setting_rule/restrict_users.rb b/lib/tdlib/types/user_privacy_setting_rule/restrict_users.rb index f13eede..bd67b66 100644 --- a/lib/tdlib/types/user_privacy_setting_rule/restrict_users.rb +++ b/lib/tdlib/types/user_privacy_setting_rule/restrict_users.rb @@ -1,7 +1,7 @@ module TD::Types # A rule to restrict all specified users from doing something. # - # @attr user_ids [Array] The user identifiers. + # @attr user_ids [Array] The user identifiers, total number of users in all rules must not exceed 1000. class UserPrivacySettingRule::RestrictUsers < UserPrivacySettingRule attribute :user_ids, TD::Types::Array.of(TD::Types::Integer) end diff --git a/lib/tdlib/types/user_type/deleted.rb b/lib/tdlib/types/user_type/deleted.rb index 48ad792..619f505 100644 --- a/lib/tdlib/types/user_type/deleted.rb +++ b/lib/tdlib/types/user_type/deleted.rb @@ -1,6 +1,6 @@ module TD::Types # A deleted user or deleted bot. - # No information on the user besides the user_id is available. + # No information on the user besides the user identifier is available. # It is not possible to perform any active actions on this type of user. class UserType::Deleted < UserType end diff --git a/lib/tdlib/types/user_type/unknown.rb b/lib/tdlib/types/user_type/unknown.rb index 4d0062d..8d7d03a 100644 --- a/lib/tdlib/types/user_type/unknown.rb +++ b/lib/tdlib/types/user_type/unknown.rb @@ -1,5 +1,5 @@ module TD::Types - # No information on the user besides the user_id is available, yet this user has not been deleted. + # No information on the user besides the user identifier is available, yet this user has not been deleted. # This object is extremely rare and must be handled like a deleted user. # It is not possible to perform any actions on users of this type. class UserType::Unknown < UserType diff --git a/lib/tdlib/types/video.rb b/lib/tdlib/types/video.rb index f97dd4c..e9f42fa 100644 --- a/lib/tdlib/types/video.rb +++ b/lib/tdlib/types/video.rb @@ -6,7 +6,7 @@ module TD::Types # @attr height [Integer] Video height; as defined by the sender. # @attr file_name [String] Original name of the file; as defined by the sender. # @attr mime_type [String] MIME type of the file; as defined by the sender. - # @attr has_stickers [Boolean] True, if stickers were added to the photo. + # @attr has_stickers [Boolean] True, if stickers were added to the video. # @attr supports_streaming [Boolean] True, if the video should be tried to be streamed. # @attr minithumbnail [TD::Types::Minithumbnail, nil] Video minithumbnail; may be null. # @attr thumbnail [TD::Types::PhotoSize, nil] Video thumbnail; as defined by the sender; may be null. diff --git a/lib/tdlib/version.rb b/lib/tdlib/version.rb index 1fc514a..055a0be 100644 --- a/lib/tdlib/version.rb +++ b/lib/tdlib/version.rb @@ -1,4 +1,4 @@ module TD # tdlib-ruby version - VERSION = "2.1.0" + VERSION = "2.2.0" end diff --git a/td b/td index a2429d5..fc7253e 160000 --- a/td +++ b/td @@ -1 +1 @@ -Subproject commit a2429d595ce38456240717219fe4e61c3ba8b38a +Subproject commit fc7253e774863ed343eef25d7dd2f55db5a9ede5 diff --git a/tdlib-ruby.gemspec b/tdlib-ruby.gemspec index 5c17bd2..e12b226 100644 --- a/tdlib-ruby.gemspec +++ b/tdlib-ruby.gemspec @@ -20,14 +20,14 @@ Gem::Specification.new do |gem| gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] - gem.add_runtime_dependency 'dry-configurable', '~> 0.7' - gem.add_runtime_dependency 'dry-struct', '~> 0.5.1' - gem.add_runtime_dependency 'dry-types', '~> 0.13.2' - gem.add_runtime_dependency 'concurrent-ruby', '~> 1.0' + gem.add_runtime_dependency 'dry-configurable', '~> 0.9' + gem.add_runtime_dependency 'dry-struct', '~> 1.2.0' + gem.add_runtime_dependency 'dry-types', '~> 1.2.0' + gem.add_runtime_dependency 'concurrent-ruby', '~> 1.1' gem.add_runtime_dependency 'ffi', '~> 1.0' - gem.add_development_dependency 'bundler', '~> 1.10' - gem.add_development_dependency 'rake', '~> 12.3' + gem.add_development_dependency 'bundler', '~> 2.0' + gem.add_development_dependency 'rake', '~> 13.0' gem.add_development_dependency 'rspec', '~> 3.0' gem.add_development_dependency 'rubygems-tasks', '~> 0.2' gem.add_development_dependency 'yard', '~> 0.9'