Skip to content

Commit

Permalink
version_1.8.35
Browse files Browse the repository at this point in the history
  • Loading branch information
nevrfl committed Sep 2, 2024
1 parent 90a28e3 commit c6c26f1
Show file tree
Hide file tree
Showing 1,230 changed files with 18,260 additions and 3,337 deletions.
28 changes: 18 additions & 10 deletions bin/parser
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env ruby

# Possible errors:
# bin/parser:395:in `sort_by': comparison of NilClass with String failed (ArgumentError)
# Solution:
# Fix td_api.tl. In this case there is a extra line
# "//-pass an empty string to abort verification and receive error VERIFICATION_FAILED for the request"
# just move it to the previous line on td_api.tl

require 'active_support/all'

AUTOLOAD_BASE_DIR = 'tdlib/types'
Expand Down Expand Up @@ -40,10 +48,10 @@ def parse_argument_description(argument, description)
end

{
argument => {
description: description,
optional: optional
}
argument => {
description: description,
optional: optional
}
}
end

Expand Down Expand Up @@ -186,10 +194,10 @@ end

def type_to_comment_type(type)
type.gsub('TD::Types::Array.of(', 'Array<').gsub(')', '>').
gsub('TD::Types::Coercible::Integer', 'Integer').
gsub('TD::Types::Coercible::Float', 'Float').
gsub('TD::Types::Coercible::String', 'String').
gsub('TD::Types::Bool', 'Boolean')
gsub('TD::Types::Coercible::Integer', 'Integer').
gsub('TD::Types::Coercible::Float', 'Float').
gsub('TD::Types::Coercible::String', 'String').
gsub('TD::Types::Bool', 'Boolean')
end

# Generates YARD documentation comment for each param
Expand Down Expand Up @@ -250,7 +258,7 @@ File.write 'lib/tdlib/types/base.rb', klass
puts "Parsing #{TD_API_TL_LOCATION}"

# Reading the TL file and splitting it into classes and functions
@classes, @functions = open(TD_API_TL_LOCATION).read.split("\n\n---functions---\n\n")
@classes, @functions = File.read(TD_API_TL_LOCATION).split("\n\n---functions---\n\n")

# First entry in td_api.tl is typecasting, it's worthless for us.
# Last entry before functions is a testing class, once again worthless
Expand Down Expand Up @@ -294,7 +302,7 @@ puts "Converting classes into Ruby types"
class_name = "#{super_class_name}::#{class_name.sub(super_class_name, '')} < #{super_class_name}"

puts "MKDIR 'lib/tdlib/types/#{super_class_name.underscore}'"
FileUtils.mkdir_p "lib/tdlib/types/#{super_class_name.underscore}"
FileUtils.mkdir_p "lib/tdlib/types/#{super_class_name.underscore}"
end

if attributes.blank?
Expand Down
6,778 changes: 5,741 additions & 1,037 deletions lib/tdlib/client_methods.rb

Large diffs are not rendered by default.

2,997 changes: 2,024 additions & 973 deletions lib/tdlib/types.rb

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions lib/tdlib/types/accent_color.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module TD::Types
# Contains information about supported accent color for user/chat name, background of empty chat photo, replies to
# messages and link previews.
#
# @attr id [Integer] Accent color identifier.
# @attr built_in_accent_color_id [Integer] Identifier of a built-in color to use in places, where only one color is
# needed; 0-6.
# @attr light_theme_colors [Array<Integer>] The list of 1-3 colors in RGB format, describing the accent color, as
# expected to be shown in light themes.
# @attr dark_theme_colors [Array<Integer>] The list of 1-3 colors in RGB format, describing the accent color, as
# expected to be shown in dark themes.
# @attr min_channel_chat_boost_level [Integer] The minimum chat boost level required to use the color in a channel
# chat.
class AccentColor < Base
attribute :id, TD::Types::Coercible::Integer
attribute :built_in_accent_color_id, TD::Types::Coercible::Integer
attribute :light_theme_colors, TD::Types::Array.of(TD::Types::Coercible::Integer)
attribute :dark_theme_colors, TD::Types::Array.of(TD::Types::Coercible::Integer)
attribute :min_channel_chat_boost_level, TD::Types::Coercible::Integer
end
end
3 changes: 1 addition & 2 deletions lib/tdlib/types/account_ttl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ module TD::Types
# Contains information about the period of inactivity after which the current user's account will automatically be
# deleted.
#
# @attr days [Integer] Number of days of inactivity before the account will be flagged for deletion; should range
# from 30-366 days.
# @attr days [Integer] Number of days of inactivity before the account will be flagged for deletion; 30-366 days.
class AccountTtl < Base
attribute :days, TD::Types::Coercible::Integer
end
Expand Down
14 changes: 14 additions & 0 deletions lib/tdlib/types/added_reaction.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module TD::Types
# Represents a reaction applied to a message.
#
# @attr type [TD::Types::ReactionType] Type of the reaction.
# @attr sender_id [TD::Types::MessageSender] Identifier of the chat member, applied the reaction.
# @attr is_outgoing [Boolean] True, if the reaction was added by the current user.
# @attr date [Integer] Point in time (Unix timestamp) when the reaction was added.
class AddedReaction < Base
attribute :type, TD::Types::ReactionType
attribute :sender_id, TD::Types::MessageSender
attribute :is_outgoing, TD::Types::Bool
attribute :date, TD::Types::Coercible::Integer
end
end
13 changes: 13 additions & 0 deletions lib/tdlib/types/added_reactions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module TD::Types
# Represents a list of reactions added to a message.
#
# @attr total_count [Integer] The total number of found reactions.
# @attr reactions [Array<TD::Types::AddedReaction>] The list of added reactions.
# @attr next_offset [TD::Types::String] The offset for the next request.
# If empty, then there are no more results.
class AddedReactions < Base
attribute :total_count, TD::Types::Coercible::Integer
attribute :reactions, TD::Types::Array.of(TD::Types::AddedReaction)
attribute :next_offset, TD::Types::String
end
end
18 changes: 18 additions & 0 deletions lib/tdlib/types/animated_emoji.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module TD::Types
# Describes an animated or custom representation of an emoji.
#
# @attr sticker [TD::Types::Sticker, nil] Sticker for the emoji; may be null if yet unknown for a custom emoji.
# If the sticker is a custom emoji, then it can have arbitrary format.
# @attr sticker_width [Integer] Expected width of the sticker, which can be used if the sticker is null.
# @attr sticker_height [Integer] Expected height of the sticker, which can be used if the sticker is null.
# @attr fitzpatrick_type [Integer] Emoji modifier fitzpatrick type; 0-6; 0 if none.
# @attr sound [TD::Types::File, nil] File containing the sound to be played when the sticker is clicked; may be null.
# The sound is encoded with the Opus codec, and stored inside an OGG container.
class AnimatedEmoji < Base
attribute :sticker, TD::Types::Sticker.optional.default(nil)
attribute :sticker_width, TD::Types::Coercible::Integer
attribute :sticker_height, TD::Types::Coercible::Integer
attribute :fitzpatrick_type, TD::Types::Coercible::Integer
attribute :sound, TD::Types::File.optional.default(nil)
end
end
17 changes: 17 additions & 0 deletions lib/tdlib/types/archive_chat_list_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module TD::Types
# Contains settings for automatic moving of chats to and from the Archive chat lists.
#
# @attr archive_and_mute_new_chats_from_unknown_users [Boolean] True, if new chats from non-contacts will be
# automatically archived and muted.
# Can be set to true only if the option "can_archive_and_mute_new_chats_from_unknown_users" is true.
# @attr keep_unmuted_chats_archived [Boolean] True, if unmuted chats will be kept in the Archive chat list when they
# get a new message.
# @attr keep_chats_from_folders_archived [Boolean] True, if unmuted chats, that are always included or pinned in a
# folder, will be kept in the Archive chat list when they get a new message.
# Ignored if keep_unmuted_chats_archived == true.
class ArchiveChatListSettings < Base
attribute :archive_and_mute_new_chats_from_unknown_users, TD::Types::Bool
attribute :keep_unmuted_chats_archived, TD::Types::Bool
attribute :keep_chats_from_folders_archived, TD::Types::Bool
end
end
67 changes: 67 additions & 0 deletions lib/tdlib/types/attachment_menu_bot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module TD::Types
# Represents a bot, which can be added to attachment or side menu.
#
# @attr bot_user_id [Integer] User identifier of the bot.
# @attr supports_self_chat [Boolean] True, if the bot supports opening from attachment menu in the chat with the bot.
# @attr supports_user_chats [Boolean] True, if the bot supports opening from attachment menu in private chats with
# ordinary users.
# @attr supports_bot_chats [Boolean] True, if the bot supports opening from attachment menu in private chats with
# other bots.
# @attr supports_group_chats [Boolean] True, if the bot supports opening from attachment menu in basic group and
# supergroup chats.
# @attr supports_channel_chats [Boolean] True, if the bot supports opening from attachment menu in channel chats.
# @attr request_write_access [Boolean] True, if the user must be asked for the permission to send messages to the
# bot.
# @attr is_added [Boolean] True, if the bot was explicitly added by the user.
# If the bot isn't added, then on the first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot
# must be added or removed.
# @attr show_in_attachment_menu [Boolean] True, if the bot must be shown in the attachment menu.
# @attr show_in_side_menu [Boolean] True, if the bot must be shown in the side menu.
# @attr show_disclaimer_in_side_menu [Boolean] True, if a disclaimer, why the bot is shown in the side menu, is
# needed.
# @attr name [TD::Types::String] Name for the bot in attachment menu.
# @attr name_color [TD::Types::AttachmentMenuBotColor, nil] Color to highlight selected name of the bot if
# appropriate; may be null.
# @attr default_icon [TD::Types::File, nil] Default icon for the bot in SVG format; may be null.
# @attr ios_static_icon [TD::Types::File, nil] Icon for the bot in SVG format for the official iOS app; may be null.
# @attr ios_animated_icon [TD::Types::File, nil] Icon for the bot in TGS format for the official iOS app; may be
# null.
# @attr ios_side_menu_icon [TD::Types::File, nil] Icon for the bot in PNG format for the official iOS app side menu;
# may be null.
# @attr android_icon [TD::Types::File, nil] Icon for the bot in TGS format for the official Android app; may be null.
# @attr android_side_menu_icon [TD::Types::File, nil] Icon for the bot in SVG format for the official Android app
# side menu; may be null.
# @attr macos_icon [TD::Types::File, nil] Icon for the bot in TGS format for the official native macOS app; may be
# null.
# @attr macos_side_menu_icon [TD::Types::File, nil] Icon for the bot in PNG format for the official macOS app side
# menu; may be null.
# @attr icon_color [TD::Types::AttachmentMenuBotColor, nil] Color to highlight selected icon of the bot if
# appropriate; may be null.
# @attr web_app_placeholder [TD::Types::File, nil] Default placeholder for opened Web Apps in SVG format; may be
# null.
class AttachmentMenuBot < Base
attribute :bot_user_id, TD::Types::Coercible::Integer
attribute :supports_self_chat, TD::Types::Bool
attribute :supports_user_chats, TD::Types::Bool
attribute :supports_bot_chats, TD::Types::Bool
attribute :supports_group_chats, TD::Types::Bool
attribute :supports_channel_chats, TD::Types::Bool
attribute :request_write_access, TD::Types::Bool
attribute :is_added, TD::Types::Bool
attribute :show_in_attachment_menu, TD::Types::Bool
attribute :show_in_side_menu, TD::Types::Bool
attribute :show_disclaimer_in_side_menu, TD::Types::Bool
attribute :name, TD::Types::String
attribute :name_color, TD::Types::AttachmentMenuBotColor.optional.default(nil)
attribute :default_icon, TD::Types::File.optional.default(nil)
attribute :ios_static_icon, TD::Types::File.optional.default(nil)
attribute :ios_animated_icon, TD::Types::File.optional.default(nil)
attribute :ios_side_menu_icon, TD::Types::File.optional.default(nil)
attribute :android_icon, TD::Types::File.optional.default(nil)
attribute :android_side_menu_icon, TD::Types::File.optional.default(nil)
attribute :macos_icon, TD::Types::File.optional.default(nil)
attribute :macos_side_menu_icon, TD::Types::File.optional.default(nil)
attribute :icon_color, TD::Types::AttachmentMenuBotColor.optional.default(nil)
attribute :web_app_placeholder, TD::Types::File.optional.default(nil)
end
end
10 changes: 10 additions & 0 deletions lib/tdlib/types/attachment_menu_bot_color.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module TD::Types
# Describes a color to highlight a bot added to attachment menu.
#
# @attr light_color [Integer] Color in the RGB24 format for light themes.
# @attr dark_color [Integer] Color in the RGB24 format for dark themes.
class AttachmentMenuBotColor < Base
attribute :light_color, TD::Types::Coercible::Integer
attribute :dark_color, TD::Types::Coercible::Integer
end
end
6 changes: 5 additions & 1 deletion lib/tdlib/types/audio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ module TD::Types
# @attr album_cover_minithumbnail [TD::Types::Minithumbnail, nil] The minithumbnail of the album cover; may be null.
# @attr album_cover_thumbnail [TD::Types::Thumbnail, nil] The thumbnail of the album cover in JPEG format; as defined
# by the sender.
# The full size thumbnail should be extracted from the downloaded file; may be null.
# The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null.
# @attr external_album_covers [Array<TD::Types::Thumbnail>] Album cover variants to use if the downloaded audio file
# contains no album cover.
# Provided thumbnail dimensions are approximate.
# @attr audio [TD::Types::File] File containing the audio.
class Audio < Base
attribute :duration, TD::Types::Coercible::Integer
Expand All @@ -20,6 +23,7 @@ class Audio < Base
attribute :mime_type, TD::Types::String
attribute :album_cover_minithumbnail, TD::Types::Minithumbnail.optional.default(nil)
attribute :album_cover_thumbnail, TD::Types::Thumbnail.optional.default(nil)
attribute :external_album_covers, TD::Types::Array.of(TD::Types::Thumbnail)
attribute :audio, TD::Types::File
end
end
8 changes: 4 additions & 4 deletions lib/tdlib/types/authentication_code_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module TD::Types
# Information about the authentication code that was sent.
#
# @attr phone_number [TD::Types::String] A phone number that is being authenticated.
# @attr type [TD::Types::AuthenticationCodeType] Describes the way the code was sent to the user.
# @attr next_type [TD::Types::AuthenticationCodeType, nil] Describes the way the next code will be sent to the user;
# may be null.
# @attr timeout [Integer] Timeout before the code should be re-sent, in seconds.
# @attr type [TD::Types::AuthenticationCodeType] The way the code was sent to the user.
# @attr next_type [TD::Types::AuthenticationCodeType, nil] The way the next code will be sent to the user; may be
# null.
# @attr timeout [Integer] Timeout before the code can be re-sent, in seconds.
class AuthenticationCodeInfo < Base
attribute :phone_number, TD::Types::String
attribute :type, TD::Types::AuthenticationCodeType
Expand Down
6 changes: 6 additions & 0 deletions lib/tdlib/types/authentication_code_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ class AuthenticationCodeType < Base
%w[
telegram_message
sms
sms_word
sms_phrase
call
flash_call
missed_call
fragment
firebase_android
firebase_ios
].each do |type|
autoload TD::Types.camelize(type), "tdlib/types/authentication_code_type/#{type}"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tdlib/types/authentication_code_type/call.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module TD::Types
# An authentication code is delivered via a phone call to the specified phone number.
# A digit-only authentication code is delivered via a phone call to the specified phone number.
#
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::Call < AuthenticationCodeType
Expand Down
11 changes: 11 additions & 0 deletions lib/tdlib/types/authentication_code_type/firebase_android.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module TD::Types
# A digit-only authentication code is delivered via Firebase Authentication to the official Android application.
#
# @attr device_verification_parameters [TD::Types::FirebaseDeviceVerificationParameters] Parameters to be used for
# device verification.
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::FirebaseAndroid < AuthenticationCodeType
attribute :device_verification_parameters, TD::Types::FirebaseDeviceVerificationParameters
attribute :length, TD::Types::Coercible::Integer
end
end
14 changes: 14 additions & 0 deletions lib/tdlib/types/authentication_code_type/firebase_ios.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module TD::Types
# A digit-only authentication code is delivered via Firebase Authentication to the official iOS application.
#
# @attr receipt [TD::Types::String] Receipt of successful application token validation to compare with receipt from
# push notification.
# @attr push_timeout [Integer] Time after the next authentication method is supposed to be used if verification push
# notification isn't received, in seconds.
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::FirebaseIos < AuthenticationCodeType
attribute :receipt, TD::Types::String
attribute :push_timeout, TD::Types::Coercible::Integer
attribute :length, TD::Types::Coercible::Integer
end
end
4 changes: 2 additions & 2 deletions lib/tdlib/types/authentication_code_type/flash_call.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TD::Types
# An authentication code is delivered by an immediately cancelled call to the specified phone number.
# The number from which the call was made is the code.
# An authentication code is delivered by an immediately canceled call to the specified phone number.
# The phone number that calls is the code that must be entered automatically.
#
# @attr pattern [TD::Types::String] Pattern of the phone number from which the call will be made.
class AuthenticationCodeType::FlashCall < AuthenticationCodeType
Expand Down
11 changes: 11 additions & 0 deletions lib/tdlib/types/authentication_code_type/fragment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module TD::Types
# A digit-only authentication code is delivered to https://fragment.com.
# The user must be logged in there via a wallet owning the phone number's NFT.
#
# @attr url [TD::Types::String] URL to open to receive the code.
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::Fragment < AuthenticationCodeType
attribute :url, TD::Types::String
attribute :length, TD::Types::Coercible::Integer
end
end
11 changes: 11 additions & 0 deletions lib/tdlib/types/authentication_code_type/missed_call.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module TD::Types
# An authentication code is delivered by an immediately canceled call to the specified phone number.
# The last digits of the phone number that calls are the code that must be entered manually by the user.
#
# @attr phone_number_prefix [TD::Types::String] Prefix of the phone number from which the call will be made.
# @attr length [Integer] Number of digits in the code, excluding the prefix.
class AuthenticationCodeType::MissedCall < AuthenticationCodeType
attribute :phone_number_prefix, TD::Types::String
attribute :length, TD::Types::Coercible::Integer
end
end
3 changes: 2 additions & 1 deletion lib/tdlib/types/authentication_code_type/sms.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module TD::Types
# An authentication code is delivered via an SMS message to the specified phone number.
# A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official
# applications may not receive this type of code.
#
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::Sms < AuthenticationCodeType
Expand Down
9 changes: 9 additions & 0 deletions lib/tdlib/types/authentication_code_type/sms_phrase.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module TD::Types
# An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number;
# non-official applications may not receive this type of code.
#
# @attr first_word [TD::Types::String] The first word of the phrase if known.
class AuthenticationCodeType::SmsPhrase < AuthenticationCodeType
attribute :first_word, TD::Types::String
end
end
9 changes: 9 additions & 0 deletions lib/tdlib/types/authentication_code_type/sms_word.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module TD::Types
# An authentication code is a word delivered via an SMS message to the specified phone number; non-official
# applications may not receive this type of code.
#
# @attr first_letter [TD::Types::String] The first letters of the word if known.
class AuthenticationCodeType::SmsWord < AuthenticationCodeType
attribute :first_letter, TD::Types::String
end
end
4 changes: 2 additions & 2 deletions lib/tdlib/types/authentication_code_type/telegram_message.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TD::Types
# An authentication code is delivered via a private Telegram message, which can be viewed from another active
# session.
# A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another
# active session.
#
# @attr length [Integer] Length of the code.
class AuthenticationCodeType::TelegramMessage < AuthenticationCodeType
Expand Down
Loading

0 comments on commit c6c26f1

Please sign in to comment.