tdlib-ruby 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/ChangeLog.md +5 -0
- data/README.md +9 -2
- data/bin/parser +32 -11
- data/lib/tdlib/client.rb +10 -5
- data/lib/tdlib/client_methods.rb +923 -386
- data/lib/tdlib/types.rb +176 -11
- data/lib/tdlib/types/animation.rb +2 -0
- data/lib/tdlib/types/audio.rb +2 -0
- data/lib/tdlib/types/authorization_state.rb +1 -0
- data/lib/tdlib/types/authorization_state/wait_code.rb +1 -6
- data/lib/tdlib/types/authorization_state/wait_password.rb +2 -2
- data/lib/tdlib/types/authorization_state/wait_registration.rb +9 -0
- data/lib/tdlib/types/auto_download_settings.rb +21 -0
- data/lib/tdlib/types/auto_download_settings_presets.rb +15 -0
- data/lib/tdlib/types/background.rb +19 -0
- data/lib/tdlib/types/background_type.rb +12 -0
- data/lib/tdlib/types/background_type/pattern.rb +12 -0
- data/lib/tdlib/types/background_type/solid.rb +8 -0
- data/lib/tdlib/types/background_type/wallpaper.rb +11 -0
- data/lib/tdlib/types/backgrounds.rb +8 -0
- data/lib/tdlib/types/basic_group.rb +0 -2
- data/lib/tdlib/types/basic_group_full_info.rb +2 -0
- data/lib/tdlib/types/call_problem.rb +16 -0
- data/lib/tdlib/types/call_problem/distorted_speech.rb +5 -0
- data/lib/tdlib/types/call_problem/dropped.rb +5 -0
- data/lib/tdlib/types/call_problem/echo.rb +5 -0
- data/lib/tdlib/types/call_problem/interruptions.rb +5 -0
- data/lib/tdlib/types/call_problem/noise.rb +5 -0
- data/lib/tdlib/types/call_problem/silent_local.rb +5 -0
- data/lib/tdlib/types/call_problem/silent_remote.rb +5 -0
- data/lib/tdlib/types/call_state/ready.rb +2 -0
- data/lib/tdlib/types/chat.rb +10 -0
- data/lib/tdlib/types/chat_event_action.rb +2 -0
- data/lib/tdlib/types/chat_event_action/invites_toggled.rb +3 -3
- data/lib/tdlib/types/chat_event_action/permissions_changed.rb +10 -0
- data/lib/tdlib/types/chat_event_action/photo_changed.rb +4 -4
- data/lib/tdlib/types/chat_event_action/poll_stopped.rb +8 -0
- data/lib/tdlib/types/chat_invite_link_info.rb +1 -1
- data/lib/tdlib/types/chat_member_status/administrator.rb +3 -3
- data/lib/tdlib/types/chat_member_status/restricted.rb +2 -13
- data/lib/tdlib/types/chat_members_filter.rb +1 -0
- data/lib/tdlib/types/chat_members_filter/contacts.rb +5 -0
- data/lib/tdlib/types/chat_notification_settings.rb +12 -0
- data/lib/tdlib/types/chat_permissions.rb +28 -0
- data/lib/tdlib/types/chat_photo.rb +2 -0
- data/lib/tdlib/types/chat_report_reason.rb +1 -0
- data/lib/tdlib/types/chat_report_reason/child_abuse.rb +5 -0
- data/lib/tdlib/types/check_chat_username_result/public_chats_too_much.rb +1 -1
- data/lib/tdlib/types/connection_state/waiting_for_network.rb +1 -1
- data/lib/tdlib/types/database_statistics.rb +8 -0
- data/lib/tdlib/types/device_token.rb +2 -2
- data/lib/tdlib/types/device_token/apple_push_vo_ip.rb +2 -0
- data/lib/tdlib/types/device_token/firebase_cloud_messaging.rb +10 -0
- data/lib/tdlib/types/document.rb +4 -1
- data/lib/tdlib/types/emojis.rb +8 -0
- data/lib/tdlib/types/file_part.rb +8 -0
- data/lib/tdlib/types/file_type/wallpaper.rb +1 -1
- data/lib/tdlib/types/http_url.rb +8 -0
- data/lib/tdlib/types/inline_keyboard_button_type.rb +1 -0
- data/lib/tdlib/types/inline_keyboard_button_type/login_url.rb +12 -0
- data/lib/tdlib/types/input_background.rb +11 -0
- data/lib/tdlib/types/input_background/local.rb +10 -0
- data/lib/tdlib/types/input_background/remote.rb +8 -0
- data/lib/tdlib/types/input_file/generated.rb +1 -0
- data/lib/tdlib/types/input_inline_query_result/animated_gif.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/animated_mpeg4.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/article.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/audio.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/contact.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/document.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/game.rb +2 -1
- data/lib/tdlib/types/input_inline_query_result/location.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/photo.rb +5 -3
- data/lib/tdlib/types/input_inline_query_result/sticker.rb +7 -6
- data/lib/tdlib/types/input_inline_query_result/venue.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/video.rb +5 -4
- data/lib/tdlib/types/input_inline_query_result/voice_note.rb +5 -4
- data/lib/tdlib/types/input_message_content.rb +1 -0
- data/lib/tdlib/types/input_message_content/forwarded.rb +7 -0
- data/lib/tdlib/types/input_message_content/poll.rb +11 -0
- data/lib/tdlib/types/input_thumbnail.rb +2 -2
- data/lib/tdlib/types/json_object_member.rb +10 -0
- data/lib/tdlib/types/json_value.rb +15 -0
- data/lib/tdlib/types/json_value/array.rb +8 -0
- data/lib/tdlib/types/json_value/boolean.rb +8 -0
- data/lib/tdlib/types/json_value/null.rb +5 -0
- data/lib/tdlib/types/json_value/number.rb +8 -0
- data/lib/tdlib/types/json_value/object.rb +8 -0
- data/lib/tdlib/types/json_value/string.rb +8 -0
- data/lib/tdlib/types/language_pack_info.rb +21 -0
- data/lib/tdlib/types/language_pack_string_value/pluralized.rb +1 -0
- data/lib/tdlib/types/link_state/is_contact.rb +1 -1
- data/lib/tdlib/types/link_state/knows_phone_number.rb +1 -1
- data/lib/tdlib/types/local_file.rb +5 -2
- data/lib/tdlib/types/log_stream.rb +12 -0
- data/lib/tdlib/types/log_stream/default.rb +5 -0
- data/lib/tdlib/types/log_stream/empty.rb +5 -0
- data/lib/tdlib/types/log_stream/file.rb +11 -0
- data/lib/tdlib/types/log_tags.rb +8 -0
- data/lib/tdlib/types/log_verbosity_level.rb +8 -0
- data/lib/tdlib/types/message.rb +3 -1
- data/lib/tdlib/types/message_content.rb +1 -0
- data/lib/tdlib/types/message_content/game_score.rb +1 -1
- data/lib/tdlib/types/message_content/pin_message.rb +1 -1
- data/lib/tdlib/types/message_content/poll.rb +8 -0
- data/lib/tdlib/types/message_forward_info.rb +13 -7
- data/lib/tdlib/types/message_forward_origin.rb +12 -0
- data/lib/tdlib/types/message_forward_origin/channel.rb +12 -0
- data/lib/tdlib/types/message_forward_origin/hidden_user.rb +8 -0
- data/lib/tdlib/types/message_forward_origin/user.rb +8 -0
- data/lib/tdlib/types/message_link_info.rb +14 -0
- data/lib/tdlib/types/message_sending_state/failed.rb +10 -0
- data/lib/tdlib/types/minithumbnail.rb +12 -0
- data/lib/tdlib/types/notification.rb +12 -0
- data/lib/tdlib/types/notification_group.rb +16 -0
- data/lib/tdlib/types/notification_group_type.rb +13 -0
- data/lib/tdlib/types/notification_group_type/calls.rb +5 -0
- data/lib/tdlib/types/notification_group_type/mentions.rb +6 -0
- data/lib/tdlib/types/notification_group_type/messages.rb +6 -0
- data/lib/tdlib/types/notification_group_type/secret_chat.rb +5 -0
- data/lib/tdlib/types/notification_settings_scope.rb +1 -0
- data/lib/tdlib/types/notification_settings_scope/channel_chats.rb +5 -0
- data/lib/tdlib/types/notification_settings_scope/group_chats.rb +2 -2
- data/lib/tdlib/types/notification_type.rb +13 -0
- data/lib/tdlib/types/notification_type/new_call.rb +8 -0
- data/lib/tdlib/types/notification_type/new_message.rb +8 -0
- data/lib/tdlib/types/notification_type/new_push_message.rb +15 -0
- data/lib/tdlib/types/notification_type/new_secret_chat.rb +5 -0
- data/lib/tdlib/types/option_value/boolean.rb +1 -1
- data/lib/tdlib/types/option_value/empty.rb +1 -1
- data/lib/tdlib/types/option_value/integer.rb +1 -1
- data/lib/tdlib/types/option_value/string.rb +1 -1
- data/lib/tdlib/types/page_block.rb +5 -0
- data/lib/tdlib/types/page_block/animation.rb +2 -2
- data/lib/tdlib/types/page_block/audio.rb +2 -2
- data/lib/tdlib/types/page_block/block_quote.rb +2 -2
- data/lib/tdlib/types/page_block/collage.rb +2 -2
- data/lib/tdlib/types/page_block/details.rb +12 -0
- data/lib/tdlib/types/page_block/embedded.rb +4 -4
- data/lib/tdlib/types/page_block/embedded_post.rb +4 -4
- data/lib/tdlib/types/page_block/kicker.rb +8 -0
- data/lib/tdlib/types/page_block/list.rb +3 -5
- data/lib/tdlib/types/page_block/map.rb +16 -0
- data/lib/tdlib/types/page_block/photo.rb +4 -2
- data/lib/tdlib/types/page_block/pull_quote.rb +2 -2
- data/lib/tdlib/types/page_block/related_articles.rb +10 -0
- data/lib/tdlib/types/page_block/slideshow.rb +2 -2
- data/lib/tdlib/types/page_block/table.rb +14 -0
- data/lib/tdlib/types/page_block/video.rb +2 -2
- data/lib/tdlib/types/page_block_caption.rb +10 -0
- data/lib/tdlib/types/page_block_horizontal_alignment.rb +12 -0
- data/lib/tdlib/types/page_block_horizontal_alignment/center.rb +5 -0
- data/lib/tdlib/types/page_block_horizontal_alignment/left.rb +5 -0
- data/lib/tdlib/types/page_block_horizontal_alignment/right.rb +5 -0
- data/lib/tdlib/types/page_block_list_item.rb +10 -0
- data/lib/tdlib/types/page_block_related_article.rb +18 -0
- data/lib/tdlib/types/page_block_table_cell.rb +18 -0
- data/lib/tdlib/types/page_block_vertical_alignment.rb +12 -0
- data/lib/tdlib/types/page_block_vertical_alignment/bottom.rb +5 -0
- data/lib/tdlib/types/page_block_vertical_alignment/middle.rb +5 -0
- data/lib/tdlib/types/page_block_vertical_alignment/top.rb +5 -0
- data/lib/tdlib/types/passport_authorization_form.rb +1 -5
- data/lib/tdlib/types/passport_element_error_source/file.rb +3 -0
- data/lib/tdlib/types/passport_element_error_source/translation_file.rb +3 -0
- data/lib/tdlib/types/passport_elements_with_errors.rb +10 -0
- data/lib/tdlib/types/password_state.rb +7 -7
- data/lib/tdlib/types/phone_number_authentication_settings.rb +16 -0
- data/lib/tdlib/types/photo.rb +2 -2
- data/lib/tdlib/types/poll.rb +16 -0
- data/lib/tdlib/types/poll_option.rb +16 -0
- data/lib/tdlib/types/profile_photo.rb +2 -0
- data/lib/tdlib/types/public_message_link.rb +1 -1
- data/lib/tdlib/types/push_message_content.rb +35 -0
- data/lib/tdlib/types/push_message_content/animation.rb +12 -0
- data/lib/tdlib/types/push_message_content/audio.rb +10 -0
- data/lib/tdlib/types/push_message_content/basic_group_chat_create.rb +5 -0
- data/lib/tdlib/types/push_message_content/chat_add_members.rb +12 -0
- data/lib/tdlib/types/push_message_content/chat_change_photo.rb +5 -0
- data/lib/tdlib/types/push_message_content/chat_change_title.rb +8 -0
- data/lib/tdlib/types/push_message_content/chat_delete_member.rb +12 -0
- data/lib/tdlib/types/push_message_content/chat_join_by_link.rb +5 -0
- data/lib/tdlib/types/push_message_content/contact.rb +10 -0
- data/lib/tdlib/types/push_message_content/contact_registered.rb +5 -0
- data/lib/tdlib/types/push_message_content/document.rb +10 -0
- data/lib/tdlib/types/push_message_content/game.rb +10 -0
- data/lib/tdlib/types/push_message_content/game_score.rb +12 -0
- data/lib/tdlib/types/push_message_content/hidden.rb +8 -0
- data/lib/tdlib/types/push_message_content/invoice.rb +10 -0
- data/lib/tdlib/types/push_message_content/location.rb +10 -0
- data/lib/tdlib/types/push_message_content/media_album.rb +12 -0
- data/lib/tdlib/types/push_message_content/message_forwards.rb +8 -0
- data/lib/tdlib/types/push_message_content/photo.rb +14 -0
- data/lib/tdlib/types/push_message_content/poll.rb +10 -0
- data/lib/tdlib/types/push_message_content/screenshot_taken.rb +5 -0
- data/lib/tdlib/types/push_message_content/sticker.rb +12 -0
- data/lib/tdlib/types/push_message_content/text.rb +10 -0
- data/lib/tdlib/types/push_message_content/video.rb +14 -0
- data/lib/tdlib/types/push_message_content/video_note.rb +10 -0
- data/lib/tdlib/types/push_message_content/voice_note.rb +10 -0
- data/lib/tdlib/types/push_receiver_id.rb +9 -0
- data/lib/tdlib/types/rich_text.rb +6 -0
- data/lib/tdlib/types/rich_text/anchor.rb +10 -0
- data/lib/tdlib/types/rich_text/icon.rb +13 -0
- data/lib/tdlib/types/rich_text/marked.rb +8 -0
- data/lib/tdlib/types/rich_text/phone_number.rb +10 -0
- data/lib/tdlib/types/rich_text/subscript.rb +8 -0
- data/lib/tdlib/types/rich_text/superscript.rb +8 -0
- data/lib/tdlib/types/scope_notification_settings.rb +6 -0
- data/lib/tdlib/types/search_messages_filter/unread_mention.rb +1 -1
- data/lib/tdlib/types/session.rb +3 -0
- data/lib/tdlib/types/sticker.rb +2 -0
- data/lib/tdlib/types/sticker_set.rb +10 -2
- data/lib/tdlib/types/sticker_set_info.rb +5 -0
- data/lib/tdlib/types/storage_statistics_fast.rb +4 -0
- data/lib/tdlib/types/supergroup.rb +2 -3
- data/lib/tdlib/types/supergroup_full_info.rb +2 -2
- data/lib/tdlib/types/supergroup_members_filter.rb +1 -0
- data/lib/tdlib/types/supergroup_members_filter/contacts.rb +8 -0
- data/lib/tdlib/types/terms_of_service.rb +1 -1
- data/lib/tdlib/types/update.rb +9 -0
- data/lib/tdlib/types/update/active_notifications.rb +10 -0
- data/lib/tdlib/types/update/chat_online_member_count.rb +12 -0
- data/lib/tdlib/types/update/chat_order.rb +1 -1
- data/lib/tdlib/types/update/chat_permissions.rb +10 -0
- data/lib/tdlib/types/update/chat_pinned_message.rb +11 -0
- data/lib/tdlib/types/update/delete_messages.rb +1 -1
- data/lib/tdlib/types/update/have_pending_notifications.rb +13 -0
- data/lib/tdlib/types/update/message_send_failed.rb +1 -1
- data/lib/tdlib/types/update/new_message.rb +0 -4
- data/lib/tdlib/types/update/notification.rb +10 -0
- data/lib/tdlib/types/update/notification_group.rb +26 -0
- data/lib/tdlib/types/update/poll.rb +8 -0
- data/lib/tdlib/types/update/selected_background.rb +10 -0
- data/lib/tdlib/types/updates.rb +8 -0
- data/lib/tdlib/types/user.rb +4 -0
- data/lib/tdlib/types/user_privacy_setting.rb +3 -0
- data/lib/tdlib/types/user_privacy_setting/allow_peer_to_peer_calls.rb +5 -0
- data/lib/tdlib/types/user_privacy_setting/show_link_in_forwarded_messages.rb +5 -0
- data/lib/tdlib/types/user_privacy_setting/show_profile_photo.rb +5 -0
- data/lib/tdlib/types/user_profile_photo.rb +12 -0
- data/lib/tdlib/types/user_profile_photos.rb +2 -2
- data/lib/tdlib/types/video.rb +2 -0
- data/lib/tdlib/types/video_note.rb +2 -0
- data/lib/tdlib/types/web_page.rb +3 -2
- data/lib/tdlib/types/web_page_instant_view.rb +7 -0
- data/lib/tdlib/update_manager.rb +5 -12
- data/lib/tdlib/version.rb +1 -1
- data/spec/integration/tdlib_spec.rb +8 -0
- metadata +139 -9
- data/lib/tdlib/types/device_token/google_cloud_messaging.rb +0 -8
- data/lib/tdlib/types/message_forward_info/message_forwarded_from_user.rb +0 -16
- data/lib/tdlib/types/message_forward_info/message_forwarded_post.rb +0 -21
- data/lib/tdlib/types/sticker_emojis.rb +0 -10
- data/lib/tdlib/types/wallpaper.rb +0 -14
- data/lib/tdlib/types/wallpapers.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549e36683b58bc5f2ab9ac8de4c50104f4abc1ab21a0a5a6777b130c0ebd80b9
|
4
|
+
data.tar.gz: ababc856edc0046ddefd04e5b2582de902dfb53d0e91c9e2f69967afa9250a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31fb522fba4b1e17d15d07b00856a034e0a6914fe90ca3d9c6f7e444a6ea66affb5baee25079c81d9372fc1dc01e22e27a284adf51bed49eef7c3ac7202219e9
|
7
|
+
data.tar.gz: 6fb5e7f76a41a00d55f19c4a63b8adc9fa77d0c41299995278e9ace3b317718819a8f0ccee6351b5a8bd7b4c52108bdc0c3808caec7a228e856c6d3712386d44
|
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Ruby bindings and client for TDLib (Telegram database library).
|
|
8
8
|
|
9
9
|
## Requirements
|
10
10
|
|
11
|
-
* Ruby 2.
|
11
|
+
* Ruby 2.4+
|
12
12
|
* Compiled [tdlib](https://github.com/tdlib/td)
|
13
13
|
|
14
14
|
We have precompiled versions for CentOS 6 & 7 in our repositories:
|
@@ -29,6 +29,7 @@ http://rpms.southbridge.ru/rhel6/stable/SRPMS/
|
|
29
29
|
|:-------------:|:-:| :-----------: |
|
30
30
|
| 1.x | → | 1.0 - 1.2 |
|
31
31
|
| 2.0 | → | 1.3 |
|
32
|
+
| 2.1 | → | 1.5 |
|
32
33
|
|
33
34
|
## Install
|
34
35
|
|
@@ -83,7 +84,7 @@ begin
|
|
83
84
|
when :wait_phone_number
|
84
85
|
puts 'Please, enter your phone number:'
|
85
86
|
phone = STDIN.gets.strip
|
86
|
-
client.set_authentication_phone_number(phone).wait
|
87
|
+
client.set_authentication_phone_number(phone, nil).wait
|
87
88
|
when :wait_code
|
88
89
|
puts 'Please, enter code from SMS:'
|
89
90
|
code = STDIN.gets.strip
|
@@ -154,6 +155,12 @@ TD::Client.new(database_directory: 'will override value from config',
|
|
154
155
|
files_directory: 'will override value from config')
|
155
156
|
```
|
156
157
|
|
158
|
+
If the tdlib schema changes, then `./bin/parse` can be run to
|
159
|
+
synchronize the Ruby types with the new schema. Please look through
|
160
|
+
`lib/tdlib/client_methods.rb` carefully, especially the set_password
|
161
|
+
method!
|
162
|
+
|
163
|
+
|
157
164
|
## License
|
158
165
|
|
159
166
|
[MIT](https://github.com/centosadmin/tdlib-ruby/blob/master/LICENSE.txt)
|
data/bin/parser
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
require 'open-uri'
|
3
3
|
require 'active_support/all'
|
4
4
|
|
5
5
|
AUTOLOAD_BASE_DIR = 'tdlib/types'
|
6
|
-
TD_API_TL_LOCATION =
|
6
|
+
TD_API_TL_LOCATION = "https://raw.githubusercontent.com/tdlib/td/v1.5.0/td/generate/scheme/td_api.tl"
|
7
|
+
|
7
8
|
|
8
9
|
def parse_tl_type(type)
|
9
10
|
if (vector = type.scan(/[vV]ector<(.*)>/)).length > 0
|
@@ -207,9 +208,12 @@ def attrs_to_yard_comment(attrs, key = 'attr')
|
|
207
208
|
end.join("\n")
|
208
209
|
end
|
209
210
|
|
210
|
-
puts "
|
211
|
+
puts "Removing lib/tdlib/types"
|
212
|
+
# `find lib/tdlib/types | grep -v base.rb | xargs rm -rf`
|
213
|
+
`rm -rf lib/tdlib/types`
|
211
214
|
|
212
|
-
|
215
|
+
puts "MKDIR 'lib/tdlib/types'"
|
216
|
+
FileUtils.mkdir_p "lib/tdlib/types"
|
213
217
|
|
214
218
|
puts "Writing Base class"
|
215
219
|
|
@@ -245,12 +249,13 @@ module TD::Types
|
|
245
249
|
end
|
246
250
|
RUBY
|
247
251
|
|
252
|
+
puts "Writing 'lib/tdlib/types/base.rb'"
|
248
253
|
File.write 'lib/tdlib/types/base.rb', klass
|
249
254
|
|
250
|
-
puts "Parsing
|
255
|
+
puts "Parsing #{TD_API_TL_LOCATION}"
|
251
256
|
|
252
257
|
# Reading the TL file and splitting it into classes and functions
|
253
|
-
@classes, @functions =
|
258
|
+
@classes, @functions = open(TD_API_TL_LOCATION).read.split("\n\n---functions---\n\n")
|
254
259
|
|
255
260
|
# First entry in td_api.tl is typecasting, it's worthless for us.
|
256
261
|
# Last entry before functions is a testing class, once again worthless
|
@@ -267,6 +272,7 @@ puts "Converting classes into Ruby types"
|
|
267
272
|
@lookup_table = build_lookup_table(@classes)
|
268
273
|
@lookup_regex = Regexp.union(@lookup_table.keys.select { |k| k.match?(/[a-z]+[A-Z][a-z]+/) }.map { |k| /\W#{k}\W/ })
|
269
274
|
|
275
|
+
|
270
276
|
@classes.each do |class_info|
|
271
277
|
class_name = normalize_class_name(class_info[:class], class_info[:super_class])
|
272
278
|
attributes = class_info[:arguments]
|
@@ -292,7 +298,8 @@ puts "Converting classes into Ruby types"
|
|
292
298
|
file_name = "#{super_class_name.underscore}/#{class_name.sub(super_class_name, '').underscore}"
|
293
299
|
class_name = "#{super_class_name}::#{class_name.sub(super_class_name, '')} < #{super_class_name}"
|
294
300
|
|
295
|
-
|
301
|
+
puts "MKDIR 'lib/tdlib/types/#{super_class_name.underscore}'"
|
302
|
+
FileUtils.mkdir_p "lib/tdlib/types/#{super_class_name.underscore}"
|
296
303
|
end
|
297
304
|
|
298
305
|
if attributes.blank?
|
@@ -317,6 +324,7 @@ module TD::Types#{description}#{attributes_doc}
|
|
317
324
|
end
|
318
325
|
RUBY
|
319
326
|
|
327
|
+
puts "Writing 'lib/tdlib/types/#{file_name}.rb'"
|
320
328
|
File.write "lib/tdlib/types/#{file_name}.rb", klass
|
321
329
|
end
|
322
330
|
|
@@ -384,6 +392,7 @@ module TD::Types
|
|
384
392
|
end
|
385
393
|
RUBY
|
386
394
|
|
395
|
+
puts "Writing 'lib/tdlib/types.rb'"
|
387
396
|
File.write 'lib/tdlib/types.rb', klass
|
388
397
|
|
389
398
|
puts "Converting functions"
|
@@ -407,10 +416,21 @@ puts "Converting functions"
|
|
407
416
|
else
|
408
417
|
params_doc = "\n" + attrs_to_yard_comment(params, 'param')
|
409
418
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
419
|
+
if method_name == 'set_password'
|
420
|
+
method_params = params.map do |attr, info|
|
421
|
+
#set default value to false
|
422
|
+
if attr == 'set_recovery_email_address'
|
423
|
+
"#{attr}: false"
|
424
|
+
else
|
425
|
+
# use named arguments
|
426
|
+
"#{attr}#{ ": nil" if info[:optional] }"
|
427
|
+
end
|
428
|
+
end.join(", ")
|
429
|
+
else
|
430
|
+
method_params = params.map do |attr, info|
|
431
|
+
"#{attr}#{ " = nil" if info[:optional] }"
|
432
|
+
end.join(", ")
|
433
|
+
end
|
414
434
|
|
415
435
|
method_params = "(#{wrap_params(method_params, 118 - (method_name.length + 5), method_name.length + 7)})"
|
416
436
|
|
@@ -442,6 +462,7 @@ module TD::ClientMethods
|
|
442
462
|
#{@functions.join(" \n")}end
|
443
463
|
RUBY
|
444
464
|
|
465
|
+
puts "Writing 'lib/tdlib/client_methods.rb'"
|
445
466
|
File.write 'lib/tdlib/client_methods.rb', klass
|
446
467
|
|
447
468
|
puts "Done. Please look through client_methods.rb carefully, especially the set_password method!"
|
data/lib/tdlib/client.rb
CHANGED
@@ -49,7 +49,7 @@ class TD::Client
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
@update_manager.run
|
52
|
+
@update_manager.run(callback: method(:handle_update))
|
53
53
|
ready
|
54
54
|
end
|
55
55
|
|
@@ -149,10 +149,7 @@ class TD::Client
|
|
149
149
|
# Stops update manager and destroys TDLib client
|
150
150
|
def dispose
|
151
151
|
return if dead?
|
152
|
-
|
153
|
-
@alive = false
|
154
|
-
@ready = false
|
155
|
-
TD::Api.client_destroy(@td_client)
|
152
|
+
close.then { get_authorization_state }
|
156
153
|
end
|
157
154
|
|
158
155
|
def alive?
|
@@ -169,6 +166,14 @@ class TD::Client
|
|
169
166
|
|
170
167
|
private
|
171
168
|
|
169
|
+
def handle_update(update)
|
170
|
+
return unless update.is_a?(TD::Types::AuthorizationState::Closed)
|
171
|
+
@alive = false
|
172
|
+
@ready = false
|
173
|
+
TD::Api.client_destroy(@td_client)
|
174
|
+
throw(:client_closed)
|
175
|
+
end
|
176
|
+
|
172
177
|
def send_to_td_client(query)
|
173
178
|
return unless alive?
|
174
179
|
TD::Api.client_send(@td_client, query)
|
data/lib/tdlib/client_methods.rb
CHANGED
@@ -28,10 +28,10 @@ module TD::ClientMethods
|
|
28
28
|
# @param chat_id [Integer] Chat identifier.
|
29
29
|
# @param user_id [Integer] Identifier of the user.
|
30
30
|
# @param forward_limit [Integer] The number of earlier messages from the chat to be forwarded to the new member; up
|
31
|
-
# to
|
31
|
+
# to 100.
|
32
32
|
# Ignored for supergroups and channels.
|
33
33
|
# @return [TD::Types::Ok]
|
34
|
-
def add_chat_member(chat_id, user_id, forward_limit
|
34
|
+
def add_chat_member(chat_id, user_id, forward_limit)
|
35
35
|
broadcast('@type' => 'addChatMember',
|
36
36
|
'chat_id' => chat_id,
|
37
37
|
'user_id' => user_id,
|
@@ -53,6 +53,17 @@ module TD::ClientMethods
|
|
53
53
|
'user_ids' => user_ids)
|
54
54
|
end
|
55
55
|
|
56
|
+
# Adds a custom server language pack to the list of installed language packs in current localization target.
|
57
|
+
# Can be called before authorization.
|
58
|
+
#
|
59
|
+
# @param language_pack_id [String] Identifier of a language pack to be added; may be different from a name that is
|
60
|
+
# used in an "https://t.me/setlanguage/" link.
|
61
|
+
# @return [TD::Types::Ok]
|
62
|
+
def add_custom_server_language_pack(language_pack_id)
|
63
|
+
broadcast('@type' => 'addCustomServerLanguagePack',
|
64
|
+
'language_pack_id' => language_pack_id)
|
65
|
+
end
|
66
|
+
|
56
67
|
# Adds a new sticker to the list of favorite stickers.
|
57
68
|
# The new sticker is added to the top of the list.
|
58
69
|
# If the sticker was already in the list, it is removed from the list first.
|
@@ -67,6 +78,7 @@ module TD::ClientMethods
|
|
67
78
|
|
68
79
|
# Adds a local message to a chat.
|
69
80
|
# The message is persistent across application restarts only if the message database is used.
|
81
|
+
# Returns the added message.
|
70
82
|
#
|
71
83
|
# @param chat_id [Integer] Target chat.
|
72
84
|
# @param sender_user_id [Integer] Identifier of the user who will be shown as the sender of the message; may be 0 for
|
@@ -74,9 +86,8 @@ module TD::ClientMethods
|
|
74
86
|
# @param reply_to_message_id [Integer] Identifier of the message to reply to or 0.
|
75
87
|
# @param disable_notification [Boolean] Pass true to disable notification for the message.
|
76
88
|
# @param input_message_content [TD::Types::InputMessageContent] The content of the message to be added.
|
77
|
-
# @return [TD::Types::Message]
|
78
|
-
def add_local_message(chat_id, input_message_content
|
79
|
-
sender_user_id: 0, reply_to_message_id: 0, disable_notification: false)
|
89
|
+
# @return [TD::Types::Message]
|
90
|
+
def add_local_message(chat_id, sender_user_id, reply_to_message_id, disable_notification, input_message_content)
|
80
91
|
broadcast('@type' => 'addLocalMessage',
|
81
92
|
'chat_id' => chat_id,
|
82
93
|
'sender_user_id' => sender_user_id,
|
@@ -85,6 +96,20 @@ module TD::ClientMethods
|
|
85
96
|
'input_message_content' => input_message_content)
|
86
97
|
end
|
87
98
|
|
99
|
+
# Adds a message to TDLib internal log.
|
100
|
+
# This is an offline method.
|
101
|
+
# Can be called before authorization.
|
102
|
+
# Can be called synchronously.
|
103
|
+
#
|
104
|
+
# @param verbosity_level [Integer] Minimum verbosity level needed for the message to be logged, 0-1023.
|
105
|
+
# @param text [String] Text of a message to log.
|
106
|
+
# @return [TD::Types::Ok]
|
107
|
+
def add_log_message(verbosity_level, text)
|
108
|
+
broadcast('@type' => 'addLogMessage',
|
109
|
+
'verbosity_level' => verbosity_level,
|
110
|
+
'text' => text)
|
111
|
+
end
|
112
|
+
|
88
113
|
# Adds the specified data to data usage statistics.
|
89
114
|
# Can be called before authorization.
|
90
115
|
#
|
@@ -104,7 +129,7 @@ module TD::ClientMethods
|
|
104
129
|
# @param enable [Boolean] True, if the proxy should be enabled.
|
105
130
|
# @param type [TD::Types::ProxyType] Proxy type.
|
106
131
|
# @return [TD::Types::Proxy]
|
107
|
-
def add_proxy(server, port,
|
132
|
+
def add_proxy(server, port, enable, type)
|
108
133
|
broadcast('@type' => 'addProxy',
|
109
134
|
'server' => server,
|
110
135
|
'port' => port,
|
@@ -121,7 +146,7 @@ module TD::ClientMethods
|
|
121
146
|
# video files; pass false to add the sticker to the list of recently sent stickers.
|
122
147
|
# @param sticker [TD::Types::InputFile] Sticker file to add.
|
123
148
|
# @return [TD::Types::Stickers]
|
124
|
-
def add_recent_sticker(
|
149
|
+
def add_recent_sticker(is_attached, sticker)
|
125
150
|
broadcast('@type' => 'addRecentSticker',
|
126
151
|
'is_attached' => is_attached,
|
127
152
|
'sticker' => sticker)
|
@@ -144,7 +169,8 @@ module TD::ClientMethods
|
|
144
169
|
# Only non-secret video animations with MIME type "video/mp4" can be added to the list.
|
145
170
|
#
|
146
171
|
# @param animation [TD::Types::InputFile] The animation file to be added.
|
147
|
-
# Only animations known to the server (i.e.
|
172
|
+
# Only animations known to the server (i.e.
|
173
|
+
# successfully sent via a message) can be added to the list.
|
148
174
|
# @return [TD::Types::Ok]
|
149
175
|
def add_saved_animation(animation)
|
150
176
|
broadcast('@type' => 'addSavedAnimation',
|
@@ -152,11 +178,12 @@ module TD::ClientMethods
|
|
152
178
|
end
|
153
179
|
|
154
180
|
# Adds a new sticker to a set; for bots only.
|
181
|
+
# Returns the sticker set.
|
155
182
|
#
|
156
183
|
# @param user_id [Integer] Sticker set owner.
|
157
184
|
# @param name [String] Sticker set name.
|
158
185
|
# @param sticker [TD::Types::InputSticker] Sticker to add to the set.
|
159
|
-
# @return [TD::Types::StickerSet]
|
186
|
+
# @return [TD::Types::StickerSet]
|
160
187
|
def add_sticker_to_set(user_id, name, sticker)
|
161
188
|
broadcast('@type' => 'addStickerToSet',
|
162
189
|
'user_id' => user_id,
|
@@ -218,9 +245,9 @@ module TD::ClientMethods
|
|
218
245
|
# Sets the result of a pre-checkout query; for bots only.
|
219
246
|
#
|
220
247
|
# @param pre_checkout_query_id [Integer] Identifier of the pre-checkout query.
|
221
|
-
# @param error_message [String
|
248
|
+
# @param error_message [String] An error message, empty on success.
|
222
249
|
# @return [TD::Types::Ok]
|
223
|
-
def answer_pre_checkout_query(pre_checkout_query_id, error_message
|
250
|
+
def answer_pre_checkout_query(pre_checkout_query_id, error_message)
|
224
251
|
broadcast('@type' => 'answerPreCheckoutQuery',
|
225
252
|
'pre_checkout_query_id' => pre_checkout_query_id,
|
226
253
|
'error_message' => error_message)
|
@@ -230,9 +257,9 @@ module TD::ClientMethods
|
|
230
257
|
#
|
231
258
|
# @param shipping_query_id [Integer] Identifier of the shipping query.
|
232
259
|
# @param shipping_options [Array<TD::Types::ShippingOption>] Available shipping options.
|
233
|
-
# @param error_message [String
|
260
|
+
# @param error_message [String] An error message, empty on success.
|
234
261
|
# @return [TD::Types::Ok]
|
235
|
-
def answer_shipping_query(shipping_query_id, shipping_options, error_message
|
262
|
+
def answer_shipping_query(shipping_query_id, shipping_options, error_message)
|
236
263
|
broadcast('@type' => 'answerShippingQuery',
|
237
264
|
'shipping_query_id' => shipping_query_id,
|
238
265
|
'shipping_options' => shipping_options,
|
@@ -255,14 +282,14 @@ module TD::ClientMethods
|
|
255
282
|
# @param only_if_pending [Boolean] Pass true to stop downloading only if it hasn't been started, i.e.
|
256
283
|
# request hasn't been sent to server.
|
257
284
|
# @return [TD::Types::Ok]
|
258
|
-
def cancel_download_file(file_id, only_if_pending
|
285
|
+
def cancel_download_file(file_id, only_if_pending)
|
259
286
|
broadcast('@type' => 'cancelDownloadFile',
|
260
287
|
'file_id' => file_id,
|
261
288
|
'only_if_pending' => only_if_pending)
|
262
289
|
end
|
263
290
|
|
264
291
|
# Stops the uploading of a file.
|
265
|
-
# Supported only for files uploaded by using
|
292
|
+
# Supported only for files uploaded by using uploadFile.
|
266
293
|
# For other files the behavior is undefined.
|
267
294
|
#
|
268
295
|
# @param file_id [Integer] Identifier of the file to stop uploading.
|
@@ -272,9 +299,9 @@ module TD::ClientMethods
|
|
272
299
|
'file_id' => file_id)
|
273
300
|
end
|
274
301
|
|
275
|
-
#
|
276
|
-
# Can be used only if
|
277
|
-
# After this request,
|
302
|
+
# Reports to the server whether a chat is a spam chat or not.
|
303
|
+
# Can be used only if ChatReportSpamState.can_report_spam is true.
|
304
|
+
# After this request, ChatReportSpamState.can_report_spam becomes false forever.
|
278
305
|
#
|
279
306
|
# @param chat_id [Integer] Chat identifier.
|
280
307
|
# @param is_spam_chat [Boolean] If true, the chat will be reported as spam; otherwise it will be marked as not spam.
|
@@ -298,17 +325,16 @@ module TD::ClientMethods
|
|
298
325
|
end
|
299
326
|
|
300
327
|
# Changes the phone number of the user and sends an authentication code to the user's new phone number.
|
328
|
+
# On success, returns information about the sent code.
|
301
329
|
#
|
302
330
|
# @param phone_number [String] The new phone number of the user in international format.
|
303
|
-
# @param
|
304
|
-
#
|
305
|
-
#
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
'
|
310
|
-
'allow_flash_call' => allow_flash_call,
|
311
|
-
'is_current_phone_number' => is_current_phone_number)
|
331
|
+
# @param settings [TD::Types::PhoneNumberAuthenticationSettings] Settings for the authentication of the user's phone
|
332
|
+
# number.
|
333
|
+
# @return [TD::Types::AuthenticationCodeInfo]
|
334
|
+
def change_phone_number(phone_number, settings)
|
335
|
+
broadcast('@type' => 'changePhoneNumber',
|
336
|
+
'phone_number' => phone_number,
|
337
|
+
'settings' => settings)
|
312
338
|
end
|
313
339
|
|
314
340
|
# Installs/uninstalls or activates/archives a sticker set.
|
@@ -326,8 +352,8 @@ module TD::ClientMethods
|
|
326
352
|
end
|
327
353
|
|
328
354
|
# Checks the authentication token of a bot; to log in as a bot.
|
329
|
-
# Works only when the current authorization state is
|
330
|
-
# Can be used instead of
|
355
|
+
# Works only when the current authorization state is authorizationStateWaitPhoneNumber.
|
356
|
+
# Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in.
|
331
357
|
#
|
332
358
|
# @param token [String] The bot token.
|
333
359
|
# @return [TD::Types::Ok]
|
@@ -337,22 +363,17 @@ module TD::ClientMethods
|
|
337
363
|
end
|
338
364
|
|
339
365
|
# Checks the authentication code.
|
340
|
-
# Works only when the current authorization state is
|
366
|
+
# Works only when the current authorization state is authorizationStateWaitCode.
|
341
367
|
#
|
342
368
|
# @param code [String] The verification code received via SMS, Telegram message, phone call, or flash call.
|
343
|
-
# @param first_name [String, nil] If the user is not yet registered, the first name of the user; 1-255 characters.
|
344
|
-
# @param last_name [String, nil] If the user is not yet registered; the last name of the user; optional; 0-255
|
345
|
-
# characters.
|
346
369
|
# @return [TD::Types::Ok]
|
347
|
-
def check_authentication_code(code
|
348
|
-
broadcast('@type'
|
349
|
-
'code'
|
350
|
-
'first_name' => first_name,
|
351
|
-
'last_name' => last_name)
|
370
|
+
def check_authentication_code(code)
|
371
|
+
broadcast('@type' => 'checkAuthenticationCode',
|
372
|
+
'code' => code)
|
352
373
|
end
|
353
374
|
|
354
375
|
# Checks the authentication password for correctness.
|
355
|
-
# Works only when the current authorization state is
|
376
|
+
# Works only when the current authorization state is authorizationStateWaitPassword.
|
356
377
|
#
|
357
378
|
# @param password [String] The password to check.
|
358
379
|
# @return [TD::Types::Ok]
|
@@ -393,7 +414,7 @@ module TD::ClientMethods
|
|
393
414
|
end
|
394
415
|
|
395
416
|
# Checks the database encryption key for correctness.
|
396
|
-
# Works only when the current authorization state is
|
417
|
+
# Works only when the current authorization state is authorizationStateWaitEncryptionKey.
|
397
418
|
#
|
398
419
|
# @param encryption_key [String] Encryption key to check or set up.
|
399
420
|
# @return [TD::Types::Ok]
|
@@ -429,6 +450,15 @@ module TD::ClientMethods
|
|
429
450
|
'code' => code)
|
430
451
|
end
|
431
452
|
|
453
|
+
# Checks the 2-step verification recovery email address verification code.
|
454
|
+
#
|
455
|
+
# @param code [String] Verification code.
|
456
|
+
# @return [TD::Types::PasswordState]
|
457
|
+
def check_recovery_email_address_code(code)
|
458
|
+
broadcast('@type' => 'checkRecoveryEmailAddressCode',
|
459
|
+
'code' => code)
|
460
|
+
end
|
461
|
+
|
432
462
|
# Removes potentially dangerous characters from the name of a file.
|
433
463
|
# The encoding of the file name is supposed to be UTF-8.
|
434
464
|
# Returns an empty string on failure.
|
@@ -452,7 +482,7 @@ module TD::ClientMethods
|
|
452
482
|
'exclude_secret_chats' => exclude_secret_chats)
|
453
483
|
end
|
454
484
|
|
455
|
-
# Clears all imported contacts,
|
485
|
+
# Clears all imported contacts, contact list remains unchanged.
|
456
486
|
#
|
457
487
|
# @return [TD::Types::Ok]
|
458
488
|
def clear_imported_contacts
|
@@ -464,7 +494,7 @@ module TD::ClientMethods
|
|
464
494
|
# @param is_attached [Boolean] Pass true to clear the list of stickers recently attached to photo or video files;
|
465
495
|
# pass false to clear the list of recently sent stickers.
|
466
496
|
# @return [TD::Types::Ok]
|
467
|
-
def clear_recent_stickers(is_attached
|
497
|
+
def clear_recent_stickers(is_attached)
|
468
498
|
broadcast('@type' => 'clearRecentStickers',
|
469
499
|
'is_attached' => is_attached)
|
470
500
|
end
|
@@ -478,15 +508,14 @@ module TD::ClientMethods
|
|
478
508
|
|
479
509
|
# Closes the TDLib instance.
|
480
510
|
# All databases will be flushed to disk and properly closed.
|
481
|
-
# After the close completes,
|
482
|
-
# will be sent.
|
511
|
+
# After the close completes, updateAuthorizationState with authorizationStateClosed will be sent.
|
483
512
|
#
|
484
513
|
# @return [TD::Types::Ok]
|
485
514
|
def close
|
486
515
|
broadcast('@type' => 'close')
|
487
516
|
end
|
488
517
|
|
489
|
-
#
|
518
|
+
# Informs TDLib that the chat is closed by the user.
|
490
519
|
# Many useful activities depend on the chat being opened or closed.
|
491
520
|
#
|
492
521
|
# @param chat_id [Integer] Chat identifier.
|
@@ -496,7 +525,7 @@ module TD::ClientMethods
|
|
496
525
|
'chat_id' => chat_id)
|
497
526
|
end
|
498
527
|
|
499
|
-
# Closes a secret chat, effectively transfering its state to
|
528
|
+
# Closes a secret chat, effectively transfering its state to secretChatStateClosed.
|
500
529
|
#
|
501
530
|
# @param secret_chat_id [Integer] Secret chat identifier.
|
502
531
|
# @return [TD::Types::Ok]
|
@@ -511,7 +540,7 @@ module TD::ClientMethods
|
|
511
540
|
# @param force [Boolean] If true, the chat will be created without network request.
|
512
541
|
# In this case all information about the chat except its type, title and photo can be incorrect.
|
513
542
|
# @return [TD::Types::Chat]
|
514
|
-
def create_basic_group_chat(basic_group_id, force
|
543
|
+
def create_basic_group_chat(basic_group_id, force)
|
515
544
|
broadcast('@type' => 'createBasicGroupChat',
|
516
545
|
'basic_group_id' => basic_group_id,
|
517
546
|
'force' => force)
|
@@ -528,11 +557,12 @@ module TD::ClientMethods
|
|
528
557
|
'protocol' => protocol)
|
529
558
|
end
|
530
559
|
|
531
|
-
# Creates a new basic group and sends a corresponding
|
560
|
+
# Creates a new basic group and sends a corresponding messageBasicGroupChatCreate.
|
561
|
+
# Returns the newly created chat.
|
532
562
|
#
|
533
563
|
# @param user_ids [Array<Integer>] Identifiers of users to be added to the basic group.
|
534
|
-
# @param title [String] Title of the new basic group; 1-
|
535
|
-
# @return [TD::Types::Chat]
|
564
|
+
# @param title [String] Title of the new basic group; 1-128 characters.
|
565
|
+
# @return [TD::Types::Chat]
|
536
566
|
def create_new_basic_group_chat(user_ids, title)
|
537
567
|
broadcast('@type' => 'createNewBasicGroupChat',
|
538
568
|
'user_ids' => user_ids,
|
@@ -540,15 +570,17 @@ module TD::ClientMethods
|
|
540
570
|
end
|
541
571
|
|
542
572
|
# Creates a new secret chat.
|
573
|
+
# Returns the newly created chat.
|
543
574
|
#
|
544
575
|
# @param user_id [Integer] Identifier of the target user.
|
545
|
-
# @return [TD::Types::Chat]
|
576
|
+
# @return [TD::Types::Chat]
|
546
577
|
def create_new_secret_chat(user_id)
|
547
578
|
broadcast('@type' => 'createNewSecretChat',
|
548
579
|
'user_id' => user_id)
|
549
580
|
end
|
550
581
|
|
551
582
|
# Creates a new sticker set; for bots only.
|
583
|
+
# Returns the newly created sticker set.
|
552
584
|
#
|
553
585
|
# @param user_id [Integer] Sticker set owner.
|
554
586
|
# @param title [String] Sticker set title; 1-64 characters.
|
@@ -557,8 +589,8 @@ module TD::ClientMethods
|
|
557
589
|
# Must end with *"_by_<bot username>"* (*<bot_username>* is case insensitive); 1-64 characters.
|
558
590
|
# @param is_masks [Boolean] True, if stickers are masks.
|
559
591
|
# @param stickers [Array<TD::Types::InputSticker>] List of stickers to be added to the set.
|
560
|
-
# @return [TD::Types::StickerSet]
|
561
|
-
def create_new_sticker_set(user_id, title, name,
|
592
|
+
# @return [TD::Types::StickerSet]
|
593
|
+
def create_new_sticker_set(user_id, title, name, is_masks, stickers)
|
562
594
|
broadcast('@type' => 'createNewStickerSet',
|
563
595
|
'user_id' => user_id,
|
564
596
|
'title' => title,
|
@@ -567,13 +599,14 @@ module TD::ClientMethods
|
|
567
599
|
'stickers' => stickers)
|
568
600
|
end
|
569
601
|
|
570
|
-
# Creates a new supergroup or channel and sends a corresponding
|
602
|
+
# Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate.
|
603
|
+
# Returns the newly created chat.
|
571
604
|
#
|
572
|
-
# @param title [String] Title of the new chat; 1-
|
605
|
+
# @param title [String] Title of the new chat; 1-128 characters.
|
573
606
|
# @param is_channel [Boolean] True, if a channel chat should be created.
|
574
607
|
# @param description [String] Chat description; 0-255 characters.
|
575
|
-
# @return [TD::Types::Chat]
|
576
|
-
def create_new_supergroup_chat(title,
|
608
|
+
# @return [TD::Types::Chat]
|
609
|
+
def create_new_supergroup_chat(title, is_channel, description)
|
577
610
|
broadcast('@type' => 'createNewSupergroupChat',
|
578
611
|
'title' => title,
|
579
612
|
'is_channel' => is_channel,
|
@@ -586,7 +619,7 @@ module TD::ClientMethods
|
|
586
619
|
# @param force [Boolean] If true, the chat will be created without network request.
|
587
620
|
# In this case all information about the chat except its type, title and photo can be incorrect.
|
588
621
|
# @return [TD::Types::Chat]
|
589
|
-
def create_private_chat(user_id, force
|
622
|
+
def create_private_chat(user_id, force)
|
590
623
|
broadcast('@type' => 'createPrivateChat',
|
591
624
|
'user_id' => user_id,
|
592
625
|
'force' => force)
|
@@ -607,7 +640,7 @@ module TD::ClientMethods
|
|
607
640
|
# @param force [Boolean] If true, the chat will be created without network request.
|
608
641
|
# In this case all information about the chat except its type, title and photo can be incorrect.
|
609
642
|
# @return [TD::Types::Chat]
|
610
|
-
def create_supergroup_chat(supergroup_id, force
|
643
|
+
def create_supergroup_chat(supergroup_id, force)
|
611
644
|
broadcast('@type' => 'createSupergroupChat',
|
612
645
|
'supergroup_id' => supergroup_id,
|
613
646
|
'force' => force)
|
@@ -627,8 +660,7 @@ module TD::ClientMethods
|
|
627
660
|
|
628
661
|
# Deletes the account of the current user, deleting all information associated with the user from the server.
|
629
662
|
# The phone number of the account can be used to create a new account.
|
630
|
-
# Can be called before authorization when the current authorization state is
|
631
|
-
# {TD::Types::AuthorizationState::WaitPassword}.
|
663
|
+
# Can be called before authorization when the current authorization state is authorizationStateWaitPassword.
|
632
664
|
#
|
633
665
|
# @param reason [String, nil] The reason why the account was deleted; optional.
|
634
666
|
# @return [TD::Types::Ok]
|
@@ -637,16 +669,19 @@ module TD::ClientMethods
|
|
637
669
|
'reason' => reason)
|
638
670
|
end
|
639
671
|
|
640
|
-
# Deletes all messages in the chat
|
641
|
-
#
|
672
|
+
# Deletes all messages in the chat.
|
673
|
+
# Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the
|
674
|
+
# method can be applied to the chat.
|
642
675
|
#
|
643
676
|
# @param chat_id [Integer] Chat identifier.
|
644
|
-
# @param remove_from_chat_list [Boolean] Pass true if the chat should be removed from the
|
677
|
+
# @param remove_from_chat_list [Boolean] Pass true if the chat should be removed from the chat list.
|
678
|
+
# @param revoke [Boolean] Pass true to try to delete chat history for all users.
|
645
679
|
# @return [TD::Types::Ok]
|
646
|
-
def delete_chat_history(chat_id, remove_from_chat_list
|
680
|
+
def delete_chat_history(chat_id, remove_from_chat_list, revoke)
|
647
681
|
broadcast('@type' => 'deleteChatHistory',
|
648
682
|
'chat_id' => chat_id,
|
649
|
-
'remove_from_chat_list' => remove_from_chat_list
|
683
|
+
'remove_from_chat_list' => remove_from_chat_list,
|
684
|
+
'revoke' => revoke)
|
650
685
|
end
|
651
686
|
|
652
687
|
# Deletes all messages sent by the specified user to a chat.
|
@@ -684,7 +719,9 @@ module TD::ClientMethods
|
|
684
719
|
end
|
685
720
|
|
686
721
|
# Deletes all information about a language pack in the current localization target.
|
687
|
-
# The language pack
|
722
|
+
# The language pack which is currently in use (including base language pack) or is being synchronized can't be
|
723
|
+
# deleted.
|
724
|
+
# Can be called before authorization.
|
688
725
|
#
|
689
726
|
# @param language_pack_id [String] Identifier of the language pack to delete.
|
690
727
|
# @return [TD::Types::Ok]
|
@@ -697,11 +734,10 @@ module TD::ClientMethods
|
|
697
734
|
#
|
698
735
|
# @param chat_id [Integer] Chat identifier.
|
699
736
|
# @param message_ids [Array<Integer>] Identifiers of the messages to be deleted.
|
700
|
-
# @param revoke [Boolean] Pass true to try to delete
|
701
|
-
# too old).
|
737
|
+
# @param revoke [Boolean] Pass true to try to delete messages for all chat members.
|
702
738
|
# Always true for supergroups, channels and secret chats.
|
703
739
|
# @return [TD::Types::Ok]
|
704
|
-
def delete_messages(chat_id, message_ids, revoke
|
740
|
+
def delete_messages(chat_id, message_ids, revoke)
|
705
741
|
broadcast('@type' => 'deleteMessages',
|
706
742
|
'chat_id' => chat_id,
|
707
743
|
'message_ids' => message_ids,
|
@@ -718,7 +754,7 @@ module TD::ClientMethods
|
|
718
754
|
end
|
719
755
|
|
720
756
|
# Deletes a profile photo.
|
721
|
-
# If something changes,
|
757
|
+
# If something changes, updateUser will be sent.
|
722
758
|
#
|
723
759
|
# @param profile_photo_id [Integer] Identifier of the profile photo to delete.
|
724
760
|
# @return [TD::Types::Ok]
|
@@ -756,8 +792,7 @@ module TD::ClientMethods
|
|
756
792
|
# Closes the TDLib instance, destroying all local data without a proper logout.
|
757
793
|
# The current user session will remain in the list of all active sessions.
|
758
794
|
# All local data will be destroyed.
|
759
|
-
# After the destruction completes
|
760
|
-
# will be sent.
|
795
|
+
# After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent.
|
761
796
|
#
|
762
797
|
# @return [TD::Types::Ok]
|
763
798
|
def destroy
|
@@ -779,7 +814,7 @@ module TD::ClientMethods
|
|
779
814
|
# @param duration [Integer] The call duration, in seconds.
|
780
815
|
# @param connection_id [Integer] Identifier of the connection used during the call.
|
781
816
|
# @return [TD::Types::Ok]
|
782
|
-
def discard_call(call_id, duration, connection_id
|
817
|
+
def discard_call(call_id, is_disconnected, duration, connection_id)
|
783
818
|
broadcast('@type' => 'discardCall',
|
784
819
|
'call_id' => call_id,
|
785
820
|
'is_disconnected' => is_disconnected,
|
@@ -803,26 +838,34 @@ module TD::ClientMethods
|
|
803
838
|
'website_id' => website_id)
|
804
839
|
end
|
805
840
|
|
806
|
-
#
|
807
|
-
#
|
808
|
-
# download.
|
809
|
-
# Returns file state just after the download has been started.
|
841
|
+
# Downloads a file from the cloud.
|
842
|
+
# Download progress and completion of the download will be notified through updateFile updates.
|
810
843
|
#
|
811
844
|
# @param file_id [Integer] Identifier of the file to download.
|
812
845
|
# @param priority [Integer] Priority of the download (1-32).
|
813
846
|
# The higher the priority, the earlier the file will be downloaded.
|
814
|
-
# If the priorities of two files are equal, then the last one for which
|
815
|
-
#
|
847
|
+
# If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded
|
848
|
+
# first.
|
849
|
+
# @param offset [Integer] The starting position from which the file should be downloaded.
|
850
|
+
# @param limit [Integer] Number of bytes which should be downloaded starting from the "offset" position before the
|
851
|
+
# download will be automatically cancelled; use 0 to download without a limit.
|
852
|
+
# @param synchronous [Boolean] If false, this request returns file state just after the download has been started.
|
853
|
+
# If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or
|
854
|
+
# a new downloadFile request with different offset/limit parameters was sent.
|
816
855
|
# @return [TD::Types::File]
|
817
|
-
def download_file(file_id, priority
|
818
|
-
broadcast('@type'
|
819
|
-
'file_id'
|
820
|
-
'priority'
|
856
|
+
def download_file(file_id, priority, offset, limit, synchronous)
|
857
|
+
broadcast('@type' => 'downloadFile',
|
858
|
+
'file_id' => file_id,
|
859
|
+
'priority' => priority,
|
860
|
+
'offset' => offset,
|
861
|
+
'limit' => limit,
|
862
|
+
'synchronous' => synchronous)
|
821
863
|
end
|
822
864
|
|
823
|
-
# Edits information about a custom language pack in the current localization target.
|
865
|
+
# Edits information about a custom local language pack in the current localization target.
|
866
|
+
# Can be called before authorization.
|
824
867
|
#
|
825
|
-
# @param info [TD::Types::LanguagePackInfo] New information about the custom language pack.
|
868
|
+
# @param info [TD::Types::LanguagePackInfo] New information about the custom local language pack.
|
826
869
|
# @return [TD::Types::Ok]
|
827
870
|
def edit_custom_language_pack_info(info)
|
828
871
|
broadcast('@type' => 'editCustomLanguagePackInfo',
|
@@ -847,8 +890,8 @@ module TD::ClientMethods
|
|
847
890
|
#
|
848
891
|
# @param inline_message_id [String] Inline message identifier.
|
849
892
|
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup.
|
850
|
-
# @param location [TD::Types::Location, nil] New location content of the message.
|
851
|
-
# Pass
|
893
|
+
# @param location [TD::Types::Location, nil] New location content of the message; may be null.
|
894
|
+
# Pass null to stop sharing the live location.
|
852
895
|
# @return [TD::Types::Ok]
|
853
896
|
def edit_inline_message_live_location(inline_message_id, reply_markup, location = nil)
|
854
897
|
broadcast('@type' => 'editInlineMessageLiveLocation',
|
@@ -861,12 +904,12 @@ module TD::ClientMethods
|
|
861
904
|
# sent via a bot; for bots only.
|
862
905
|
#
|
863
906
|
# @param inline_message_id [String] Inline message identifier.
|
864
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
865
|
-
# @param input_message_content [TD::Types::InputMessageContent
|
866
|
-
#
|
867
|
-
#
|
907
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
908
|
+
# @param input_message_content [TD::Types::InputMessageContent] New content of the message.
|
909
|
+
# Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument,
|
910
|
+
# InputMessagePhoto or InputMessageVideo.
|
868
911
|
# @return [TD::Types::Ok]
|
869
|
-
def edit_inline_message_media(inline_message_id,
|
912
|
+
def edit_inline_message_media(inline_message_id, reply_markup, input_message_content)
|
870
913
|
broadcast('@type' => 'editInlineMessageMedia',
|
871
914
|
'inline_message_id' => inline_message_id,
|
872
915
|
'reply_markup' => reply_markup,
|
@@ -888,9 +931,10 @@ module TD::ClientMethods
|
|
888
931
|
#
|
889
932
|
# @param inline_message_id [String] Inline message identifier.
|
890
933
|
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup.
|
891
|
-
# @param input_message_content [TD::Types::InputMessageContent
|
934
|
+
# @param input_message_content [TD::Types::InputMessageContent] New text content of the message.
|
935
|
+
# Should be of type InputMessageText.
|
892
936
|
# @return [TD::Types::Ok]
|
893
|
-
def edit_inline_message_text(inline_message_id,
|
937
|
+
def edit_inline_message_text(inline_message_id, reply_markup, input_message_content)
|
894
938
|
broadcast('@type' => 'editInlineMessageText',
|
895
939
|
'inline_message_id' => inline_message_id,
|
896
940
|
'reply_markup' => reply_markup,
|
@@ -898,14 +942,15 @@ module TD::ClientMethods
|
|
898
942
|
end
|
899
943
|
|
900
944
|
# Edits the message content caption.
|
945
|
+
# Returns the edited message after the edit is completed on the server side.
|
901
946
|
#
|
902
947
|
# @param chat_id [Integer] The chat the message belongs to.
|
903
948
|
# @param message_id [Integer] Identifier of the message.
|
904
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
949
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
905
950
|
# @param caption [TD::Types::FormattedText] New message content caption; 0-GetOption("message_caption_length_max")
|
906
951
|
# characters.
|
907
|
-
# @return [TD::Types::Message]
|
908
|
-
def edit_message_caption(chat_id, message_id,
|
952
|
+
# @return [TD::Types::Message]
|
953
|
+
def edit_message_caption(chat_id, message_id, reply_markup, caption)
|
909
954
|
broadcast('@type' => 'editMessageCaption',
|
910
955
|
'chat_id' => chat_id,
|
911
956
|
'message_id' => message_id,
|
@@ -915,14 +960,15 @@ module TD::ClientMethods
|
|
915
960
|
|
916
961
|
# Edits the message content of a live location.
|
917
962
|
# Messages can be edited for a limited period of time specified in the live location.
|
963
|
+
# Returns the edited message after the edit is completed on the server side.
|
918
964
|
#
|
919
965
|
# @param chat_id [Integer] The chat the message belongs to.
|
920
966
|
# @param message_id [Integer] Identifier of the message.
|
921
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
922
|
-
# @param location [TD::Types::Location, nil] New location content of the message.
|
923
|
-
# Pass
|
924
|
-
# @return [TD::Types::Message]
|
925
|
-
def edit_message_live_location(chat_id, message_id, location = nil
|
967
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
968
|
+
# @param location [TD::Types::Location, nil] New location content of the message; may be null.
|
969
|
+
# Pass null to stop sharing the live location.
|
970
|
+
# @return [TD::Types::Message]
|
971
|
+
def edit_message_live_location(chat_id, message_id, reply_markup, location = nil)
|
926
972
|
broadcast('@type' => 'editMessageLiveLocation',
|
927
973
|
'chat_id' => chat_id,
|
928
974
|
'message_id' => message_id,
|
@@ -934,15 +980,16 @@ module TD::ClientMethods
|
|
934
980
|
# The media in the message can't be replaced if the message was set to self-destruct.
|
935
981
|
# Media can't be replaced by self-destructing media.
|
936
982
|
# Media in an album can be edited only to contain a photo or a video.
|
983
|
+
# Returns the edited message after the edit is completed on the server side.
|
937
984
|
#
|
938
985
|
# @param chat_id [Integer] The chat the message belongs to.
|
939
986
|
# @param message_id [Integer] Identifier of the message.
|
940
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
941
|
-
# @param input_message_content [TD::Types::InputMessageContent
|
942
|
-
#
|
943
|
-
#
|
944
|
-
# @return [TD::Types::Message]
|
945
|
-
def edit_message_media(chat_id, message_id,
|
987
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
988
|
+
# @param input_message_content [TD::Types::InputMessageContent] New content of the message.
|
989
|
+
# Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument,
|
990
|
+
# InputMessagePhoto or InputMessageVideo.
|
991
|
+
# @return [TD::Types::Message]
|
992
|
+
def edit_message_media(chat_id, message_id, reply_markup, input_message_content)
|
946
993
|
broadcast('@type' => 'editMessageMedia',
|
947
994
|
'chat_id' => chat_id,
|
948
995
|
'message_id' => message_id,
|
@@ -951,11 +998,12 @@ module TD::ClientMethods
|
|
951
998
|
end
|
952
999
|
|
953
1000
|
# Edits the message reply markup; for bots only.
|
1001
|
+
# Returns the edited message after the edit is completed on the server side.
|
954
1002
|
#
|
955
1003
|
# @param chat_id [Integer] The chat the message belongs to.
|
956
1004
|
# @param message_id [Integer] Identifier of the message.
|
957
1005
|
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup.
|
958
|
-
# @return [TD::Types::Message]
|
1006
|
+
# @return [TD::Types::Message]
|
959
1007
|
def edit_message_reply_markup(chat_id, message_id, reply_markup)
|
960
1008
|
broadcast('@type' => 'editMessageReplyMarkup',
|
961
1009
|
'chat_id' => chat_id,
|
@@ -964,13 +1012,15 @@ module TD::ClientMethods
|
|
964
1012
|
end
|
965
1013
|
|
966
1014
|
# Edits the text of a message (or a text of a game message).
|
1015
|
+
# Returns the edited message after the edit is completed on the server side.
|
967
1016
|
#
|
968
1017
|
# @param chat_id [Integer] The chat the message belongs to.
|
969
1018
|
# @param message_id [Integer] Identifier of the message.
|
970
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
971
|
-
# @param input_message_content [TD::Types::InputMessageContent
|
972
|
-
#
|
973
|
-
|
1019
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
1020
|
+
# @param input_message_content [TD::Types::InputMessageContent] New text content of the message.
|
1021
|
+
# Should be of type InputMessageText.
|
1022
|
+
# @return [TD::Types::Message]
|
1023
|
+
def edit_message_text(chat_id, message_id, reply_markup, input_message_content)
|
974
1024
|
broadcast('@type' => 'editMessageText',
|
975
1025
|
'chat_id' => chat_id,
|
976
1026
|
'message_id' => message_id,
|
@@ -987,7 +1037,7 @@ module TD::ClientMethods
|
|
987
1037
|
# @param enable [Boolean] True, if the proxy should be enabled.
|
988
1038
|
# @param type [TD::Types::ProxyType] Proxy type.
|
989
1039
|
# @return [TD::Types::Proxy]
|
990
|
-
def edit_proxy(proxy_id, server, port,
|
1040
|
+
def edit_proxy(proxy_id, server, port, enable, type)
|
991
1041
|
broadcast('@type' => 'editProxy',
|
992
1042
|
'proxy_id' => proxy_id,
|
993
1043
|
'server' => server,
|
@@ -1010,42 +1060,48 @@ module TD::ClientMethods
|
|
1010
1060
|
# Finishes the file generation.
|
1011
1061
|
#
|
1012
1062
|
# @param generation_id [Integer] The identifier of the generation process.
|
1013
|
-
# @param error [TD::Types::Error
|
1063
|
+
# @param error [TD::Types::Error] If set, means that file generation has failed and should be terminated.
|
1014
1064
|
# @return [TD::Types::Ok]
|
1015
|
-
def finish_file_generation(generation_id, error
|
1065
|
+
def finish_file_generation(generation_id, error)
|
1016
1066
|
broadcast('@type' => 'finishFileGeneration',
|
1017
1067
|
'generation_id' => generation_id,
|
1018
1068
|
'error' => error)
|
1019
1069
|
end
|
1020
1070
|
|
1021
1071
|
# Forwards previously sent messages.
|
1072
|
+
# Returns the forwarded messages in the same order as the message identifiers passed in message_ids.
|
1073
|
+
# If a message can't be forwarded, null will be returned instead of the message.
|
1022
1074
|
#
|
1023
1075
|
# @param chat_id [Integer] Identifier of the chat to which to forward messages.
|
1024
1076
|
# @param from_chat_id [Integer] Identifier of the chat from which to forward messages.
|
1025
1077
|
# @param message_ids [Array<Integer>] Identifiers of the messages to forward.
|
1026
1078
|
# @param disable_notification [Boolean] Pass true to disable notification for the message, doesn't work if messages
|
1027
1079
|
# are forwarded to a secret chat.
|
1028
|
-
# @param from_background [Boolean] Pass true if the
|
1080
|
+
# @param from_background [Boolean] Pass true if the messages are sent from the background.
|
1029
1081
|
# @param as_album [Boolean] True, if the messages should be grouped into an album after forwarding.
|
1030
1082
|
# For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages.
|
1031
|
-
# @
|
1032
|
-
#
|
1033
|
-
#
|
1034
|
-
|
1035
|
-
|
1083
|
+
# @param send_copy [Boolean] True, if content of the messages needs to be copied without links to the original
|
1084
|
+
# messages.
|
1085
|
+
# Always true if the messages are forwarded to a secret chat.
|
1086
|
+
# @param remove_caption [Boolean] True, if media captions of message copies needs to be removed.
|
1087
|
+
# Ignored if send_copy is false.
|
1088
|
+
# @return [TD::Types::Messages]
|
1089
|
+
def forward_messages(chat_id, from_chat_id, message_ids, disable_notification, from_background, as_album, send_copy,
|
1090
|
+
remove_caption)
|
1036
1091
|
broadcast('@type' => 'forwardMessages',
|
1037
1092
|
'chat_id' => chat_id,
|
1038
1093
|
'from_chat_id' => from_chat_id,
|
1039
1094
|
'message_ids' => message_ids,
|
1040
1095
|
'disable_notification' => disable_notification,
|
1041
1096
|
'from_background' => from_background,
|
1042
|
-
'as_album' => as_album
|
1097
|
+
'as_album' => as_album,
|
1098
|
+
'send_copy' => send_copy,
|
1099
|
+
'remove_caption' => remove_caption)
|
1043
1100
|
end
|
1044
1101
|
|
1045
1102
|
# Generates a new invite link for a chat; the previously generated link is revoked.
|
1046
1103
|
# Available for basic groups, supergroups, and channels.
|
1047
|
-
#
|
1048
|
-
# appropriate administrator rights.
|
1104
|
+
# Requires administrator privileges and can_invite_users right.
|
1049
1105
|
#
|
1050
1106
|
# @param chat_id [Integer] Chat identifier.
|
1051
1107
|
# @return [TD::Types::ChatInviteLink]
|
@@ -1085,13 +1141,21 @@ module TD::ClientMethods
|
|
1085
1141
|
'password' => password)
|
1086
1142
|
end
|
1087
1143
|
|
1144
|
+
# Returns application config, provided by the server.
|
1145
|
+
# Can be called before authorization.
|
1146
|
+
#
|
1147
|
+
# @return [TD::Types::JsonValue]
|
1148
|
+
def get_application_config
|
1149
|
+
broadcast('@type' => 'getApplicationConfig')
|
1150
|
+
end
|
1151
|
+
|
1088
1152
|
# Returns a list of archived sticker sets.
|
1089
1153
|
#
|
1090
1154
|
# @param is_masks [Boolean] Pass true to return mask stickers sets; pass false to return ordinary sticker sets.
|
1091
1155
|
# @param offset_sticker_set_id [Integer] Identifier of the sticker set from which to return the result.
|
1092
1156
|
# @param limit [Integer] Maximum number of sticker sets to return.
|
1093
1157
|
# @return [TD::Types::StickerSets]
|
1094
|
-
def get_archived_sticker_sets(offset_sticker_set_id, limit
|
1158
|
+
def get_archived_sticker_sets(is_masks, offset_sticker_set_id, limit)
|
1095
1159
|
broadcast('@type' => 'getArchivedStickerSets',
|
1096
1160
|
'is_masks' => is_masks,
|
1097
1161
|
'offset_sticker_set_id' => offset_sticker_set_id,
|
@@ -1110,13 +1174,40 @@ module TD::ClientMethods
|
|
1110
1174
|
|
1111
1175
|
# Returns the current authorization state; this is an offline request.
|
1112
1176
|
# For informational purposes only.
|
1113
|
-
# Use
|
1177
|
+
# Use updateAuthorizationState instead to maintain the current authorization state.
|
1114
1178
|
#
|
1115
1179
|
# @return [TD::Types::AuthorizationState]
|
1116
1180
|
def get_authorization_state
|
1117
1181
|
broadcast('@type' => 'getAuthorizationState')
|
1118
1182
|
end
|
1119
1183
|
|
1184
|
+
# Returns auto-download settings presets for the currently logged in user.
|
1185
|
+
#
|
1186
|
+
# @return [TD::Types::AutoDownloadSettingsPresets]
|
1187
|
+
def get_auto_download_settings_presets
|
1188
|
+
broadcast('@type' => 'getAutoDownloadSettingsPresets')
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
# Constructs a persistent HTTP URL for a background.
|
1192
|
+
#
|
1193
|
+
# @param name [String] Background name.
|
1194
|
+
# @param type [TD::Types::BackgroundType] Background type.
|
1195
|
+
# @return [TD::Types::HttpUrl]
|
1196
|
+
def get_background_url(name, type)
|
1197
|
+
broadcast('@type' => 'getBackgroundUrl',
|
1198
|
+
'name' => name,
|
1199
|
+
'type' => type)
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
# Returns backgrounds installed by the user.
|
1203
|
+
#
|
1204
|
+
# @param for_dark_theme [Boolean] True, if the backgrounds needs to be ordered for dark theme.
|
1205
|
+
# @return [TD::Types::Backgrounds]
|
1206
|
+
def get_backgrounds(for_dark_theme)
|
1207
|
+
broadcast('@type' => 'getBackgrounds',
|
1208
|
+
'for_dark_theme' => for_dark_theme)
|
1209
|
+
end
|
1210
|
+
|
1120
1211
|
# Returns information about a basic group by its identifier.
|
1121
1212
|
# This is an offline request if the current user is not a bot.
|
1122
1213
|
#
|
@@ -1141,7 +1232,7 @@ module TD::ClientMethods
|
|
1141
1232
|
# @param offset [Integer] Number of users to skip in the result; must be non-negative.
|
1142
1233
|
# @param limit [Integer] Maximum number of users to return; up to 100.
|
1143
1234
|
# @return [TD::Types::Users]
|
1144
|
-
def get_blocked_users(offset, limit
|
1235
|
+
def get_blocked_users(offset, limit)
|
1145
1236
|
broadcast('@type' => 'getBlockedUsers',
|
1146
1237
|
'offset' => offset,
|
1147
1238
|
'limit' => limit)
|
@@ -1182,7 +1273,8 @@ module TD::ClientMethods
|
|
1182
1273
|
# Returns a list of service actions taken by chat members and administrators in the last 48 hours.
|
1183
1274
|
# Available only in supergroups and channels.
|
1184
1275
|
# Requires administrator rights.
|
1185
|
-
# Returns results in reverse chronological order (i.
|
1276
|
+
# Returns results in reverse chronological order (i.
|
1277
|
+
# e., in order of decreasing event_id).
|
1186
1278
|
#
|
1187
1279
|
# @param chat_id [Integer] Chat identifier.
|
1188
1280
|
# @param query [String] Search query by which to filter events.
|
@@ -1212,17 +1304,17 @@ module TD::ClientMethods
|
|
1212
1304
|
# @param chat_id [Integer] Chat identifier.
|
1213
1305
|
# @param from_message_id [Integer] Identifier of the message starting from which history must be fetched; use 0 to
|
1214
1306
|
# get results from the last message.
|
1215
|
-
# @param offset [Integer] Specify 0 to get results from exactly the from_message_id or a negative offset to
|
1216
|
-
#
|
1307
|
+
# @param offset [Integer] Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to
|
1308
|
+
# get additionally some newer messages.
|
1217
1309
|
# @param limit [Integer] The maximum number of messages to be returned; must be positive and can't be greater than
|
1218
1310
|
# 100.
|
1219
|
-
# If the offset is negative, the limit must be greater
|
1311
|
+
# If the offset is negative, the limit must be greater or equal to -offset.
|
1220
1312
|
# Fewer messages may be returned than specified by the limit, even if the end of the message history has not been
|
1221
1313
|
# reached.
|
1222
1314
|
# @param only_local [Boolean] If true, returns only messages that are available locally without sending network
|
1223
1315
|
# requests.
|
1224
1316
|
# @return [TD::Types::Messages]
|
1225
|
-
def get_chat_history(chat_id, from_message_id, offset
|
1317
|
+
def get_chat_history(chat_id, from_message_id, offset, limit, only_local)
|
1226
1318
|
broadcast('@type' => 'getChatHistory',
|
1227
1319
|
'chat_id' => chat_id,
|
1228
1320
|
'from_message_id' => from_message_id,
|
@@ -1256,18 +1348,30 @@ module TD::ClientMethods
|
|
1256
1348
|
# Returns approximate number of messages of the specified type in the chat.
|
1257
1349
|
#
|
1258
1350
|
# @param chat_id [Integer] Identifier of the chat in which to count messages.
|
1259
|
-
# @param filter [TD::Types::SearchMessagesFilter
|
1351
|
+
# @param filter [TD::Types::SearchMessagesFilter] Filter for message content;
|
1260
1352
|
# {TD::Types::SearchMessagesFilter::Empty} is unsupported in this function.
|
1261
1353
|
# @param return_local [Boolean] If true, returns count that is available locally without sending network requests,
|
1262
1354
|
# returning -1 if the number of messages is unknown.
|
1263
1355
|
# @return [TD::Types::Count]
|
1264
|
-
def get_chat_message_count(chat_id, filter
|
1356
|
+
def get_chat_message_count(chat_id, filter, return_local)
|
1265
1357
|
broadcast('@type' => 'getChatMessageCount',
|
1266
1358
|
'chat_id' => chat_id,
|
1267
1359
|
'filter' => filter,
|
1268
1360
|
'return_local' => return_local)
|
1269
1361
|
end
|
1270
1362
|
|
1363
|
+
# Returns list of chats with non-default notification settings.
|
1364
|
+
#
|
1365
|
+
# @param scope [TD::Types::NotificationSettingsScope] If specified, only chats from the specified scope will be
|
1366
|
+
# returned.
|
1367
|
+
# @param compare_sound [Boolean] If true, also chats with non-default sound will be returned.
|
1368
|
+
# @return [TD::Types::Chats]
|
1369
|
+
def get_chat_notification_settings_exceptions(scope, compare_sound)
|
1370
|
+
broadcast('@type' => 'getChatNotificationSettingsExceptions',
|
1371
|
+
'scope' => scope,
|
1372
|
+
'compare_sound' => compare_sound)
|
1373
|
+
end
|
1374
|
+
|
1271
1375
|
# Returns information about a pinned chat message.
|
1272
1376
|
#
|
1273
1377
|
# @param chat_id [Integer] Identifier of the chat the message belongs to.
|
@@ -1286,9 +1390,24 @@ module TD::ClientMethods
|
|
1286
1390
|
'chat_id' => chat_id)
|
1287
1391
|
end
|
1288
1392
|
|
1393
|
+
# Returns an HTTP URL with the chat statistics.
|
1394
|
+
# Currently this method can be used only for channels.
|
1395
|
+
#
|
1396
|
+
# @param chat_id [Integer] Chat identifier.
|
1397
|
+
# @param parameters [String] Parameters from "tg://statsrefresh?params=******" link.
|
1398
|
+
# @param is_dark [Boolean] Pass true if a URL with the dark theme must be returned.
|
1399
|
+
# @return [TD::Types::HttpUrl]
|
1400
|
+
def get_chat_statistics_url(chat_id, parameters, is_dark)
|
1401
|
+
broadcast('@type' => 'getChatStatisticsUrl',
|
1402
|
+
'chat_id' => chat_id,
|
1403
|
+
'parameters' => parameters,
|
1404
|
+
'is_dark' => is_dark)
|
1405
|
+
end
|
1406
|
+
|
1289
1407
|
# Returns an ordered list of chats.
|
1290
1408
|
# Chats are sorted by the pair (order, chat_id) in decreasing order.
|
1291
|
-
# (For example, to get a list of chats from the beginning, the offset_order should be equal to
|
1409
|
+
# (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed
|
1410
|
+
# 64-bit number 9223372036854775807 == 2^63 - 1).
|
1292
1411
|
# For optimal performance the number of returned chats is chosen by the library.
|
1293
1412
|
#
|
1294
1413
|
# @param offset_order [Integer] Chat order to return chats from.
|
@@ -1296,7 +1415,7 @@ module TD::ClientMethods
|
|
1296
1415
|
# @param limit [Integer] The maximum number of chats to be returned.
|
1297
1416
|
# It is possible that fewer chats than the limit are returned even if the end of the list is not reached.
|
1298
1417
|
# @return [TD::Types::Chats]
|
1299
|
-
def get_chats(offset_chat_id
|
1418
|
+
def get_chats(offset_order, offset_chat_id, limit)
|
1300
1419
|
broadcast('@type' => 'getChats',
|
1301
1420
|
'offset_order' => offset_order,
|
1302
1421
|
'offset_chat_id' => offset_chat_id,
|
@@ -1317,21 +1436,40 @@ module TD::ClientMethods
|
|
1317
1436
|
broadcast('@type' => 'getContacts')
|
1318
1437
|
end
|
1319
1438
|
|
1320
|
-
# Uses current user IP to found
|
1439
|
+
# Uses current user IP to found their country.
|
1440
|
+
# Returns two-letter ISO 3166-1 alpha-2 country code.
|
1321
1441
|
# Can be called before authorization.
|
1322
1442
|
#
|
1323
|
-
# @return [TD::Types::Text]
|
1443
|
+
# @return [TD::Types::Text]
|
1324
1444
|
def get_country_code
|
1325
1445
|
broadcast('@type' => 'getCountryCode')
|
1326
1446
|
end
|
1327
1447
|
|
1328
|
-
# Returns a list of public chats created by the user.
|
1448
|
+
# Returns a list of public chats with username created by the user.
|
1329
1449
|
#
|
1330
1450
|
# @return [TD::Types::Chats]
|
1331
1451
|
def get_created_public_chats
|
1332
1452
|
broadcast('@type' => 'getCreatedPublicChats')
|
1333
1453
|
end
|
1334
1454
|
|
1455
|
+
# Returns all updates needed to restore current TDLib state, i.e.
|
1456
|
+
# all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others.
|
1457
|
+
# This is especially usefull if TDLib is run in a separate process.
|
1458
|
+
# This is an offline method.
|
1459
|
+
# Can be called before authorization.
|
1460
|
+
#
|
1461
|
+
# @return [TD::Types::Updates]
|
1462
|
+
def get_current_state
|
1463
|
+
broadcast('@type' => 'getCurrentState')
|
1464
|
+
end
|
1465
|
+
|
1466
|
+
# Returns database statistics.
|
1467
|
+
#
|
1468
|
+
# @return [TD::Types::DatabaseStatistics]
|
1469
|
+
def get_database_statistics
|
1470
|
+
broadcast('@type' => 'getDatabaseStatistics')
|
1471
|
+
end
|
1472
|
+
|
1335
1473
|
# Returns information about a tg:// deep link.
|
1336
1474
|
# Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing.
|
1337
1475
|
# Returns a 404 error for unknown links.
|
@@ -1344,6 +1482,17 @@ module TD::ClientMethods
|
|
1344
1482
|
'link' => link)
|
1345
1483
|
end
|
1346
1484
|
|
1485
|
+
# Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji
|
1486
|
+
# replacements.
|
1487
|
+
# The URL will be valid for 30 seconds after generation.
|
1488
|
+
#
|
1489
|
+
# @param language_code [String] Language code for which the emoji replacements will be suggested.
|
1490
|
+
# @return [TD::Types::HttpUrl]
|
1491
|
+
def get_emoji_suggestions_url(language_code)
|
1492
|
+
broadcast('@type' => 'getEmojiSuggestionsUrl',
|
1493
|
+
'language_code' => language_code)
|
1494
|
+
end
|
1495
|
+
|
1347
1496
|
# Returns favorite stickers.
|
1348
1497
|
#
|
1349
1498
|
# @return [TD::Types::Stickers]
|
@@ -1360,6 +1509,17 @@ module TD::ClientMethods
|
|
1360
1509
|
'file_id' => file_id)
|
1361
1510
|
end
|
1362
1511
|
|
1512
|
+
# Returns file downloaded prefix size from a given offset.
|
1513
|
+
#
|
1514
|
+
# @param file_id [Integer] Identifier of the file.
|
1515
|
+
# @param offset [Integer] Offset from which downloaded prefix size should be calculated.
|
1516
|
+
# @return [TD::Types::Count]
|
1517
|
+
def get_file_downloaded_prefix_size(file_id, offset)
|
1518
|
+
broadcast('@type' => 'getFileDownloadedPrefixSize',
|
1519
|
+
'file_id' => file_id,
|
1520
|
+
'offset' => offset)
|
1521
|
+
end
|
1522
|
+
|
1363
1523
|
# Returns the extension of a file, guessed by its MIME type.
|
1364
1524
|
# Returns an empty string on failure.
|
1365
1525
|
# This is an offline method.
|
@@ -1400,14 +1560,14 @@ module TD::ClientMethods
|
|
1400
1560
|
'user_id' => user_id)
|
1401
1561
|
end
|
1402
1562
|
|
1403
|
-
# Returns a list of common chats with a given user.
|
1563
|
+
# Returns a list of common group chats with a given user.
|
1404
1564
|
# Chats are sorted by their type and creation date.
|
1405
1565
|
#
|
1406
1566
|
# @param user_id [Integer] User identifier.
|
1407
1567
|
# @param offset_chat_id [Integer] Chat identifier starting from which to return chats; use 0 for the first request.
|
1408
1568
|
# @param limit [Integer] Maximum number of chats to be returned; up to 100.
|
1409
1569
|
# @return [TD::Types::Chats]
|
1410
|
-
def get_groups_in_common(user_id, offset_chat_id
|
1570
|
+
def get_groups_in_common(user_id, offset_chat_id, limit)
|
1411
1571
|
broadcast('@type' => 'getGroupsInCommon',
|
1412
1572
|
'user_id' => user_id,
|
1413
1573
|
'offset_chat_id' => offset_chat_id,
|
@@ -1437,11 +1597,11 @@ module TD::ClientMethods
|
|
1437
1597
|
#
|
1438
1598
|
# @param bot_user_id [Integer] The identifier of the target bot.
|
1439
1599
|
# @param chat_id [Integer] Identifier of the chat, where the query was sent.
|
1440
|
-
# @param user_location [TD::Types::Location
|
1600
|
+
# @param user_location [TD::Types::Location] Location of the user, only if needed.
|
1441
1601
|
# @param query [String] Text of the query.
|
1442
1602
|
# @param offset [String] Offset of the first entry to return.
|
1443
1603
|
# @return [TD::Types::InlineQueryResults]
|
1444
|
-
def get_inline_query_results(bot_user_id, chat_id, query, offset
|
1604
|
+
def get_inline_query_results(bot_user_id, chat_id, user_location, query, offset)
|
1445
1605
|
broadcast('@type' => 'getInlineQueryResults',
|
1446
1606
|
'bot_user_id' => bot_user_id,
|
1447
1607
|
'chat_id' => chat_id,
|
@@ -1454,7 +1614,7 @@ module TD::ClientMethods
|
|
1454
1614
|
#
|
1455
1615
|
# @param is_masks [Boolean] Pass true to return mask sticker sets; pass false to return ordinary sticker sets.
|
1456
1616
|
# @return [TD::Types::StickerSets]
|
1457
|
-
def get_installed_sticker_sets(is_masks
|
1617
|
+
def get_installed_sticker_sets(is_masks)
|
1458
1618
|
broadcast('@type' => 'getInstalledStickerSets',
|
1459
1619
|
'is_masks' => is_masks)
|
1460
1620
|
end
|
@@ -1467,6 +1627,41 @@ module TD::ClientMethods
|
|
1467
1627
|
broadcast('@type' => 'getInviteText')
|
1468
1628
|
end
|
1469
1629
|
|
1630
|
+
# Converts a JsonValue object to corresponding JSON-serialized string.
|
1631
|
+
# This is an offline method.
|
1632
|
+
# Can be called before authorization.
|
1633
|
+
# Can be called synchronously.
|
1634
|
+
#
|
1635
|
+
# @param json_value [TD::Types::JsonValue] The {TD::Types::JsonValue} object.
|
1636
|
+
# @return [TD::Types::Text]
|
1637
|
+
def get_json_string(json_value)
|
1638
|
+
broadcast('@type' => 'getJsonString',
|
1639
|
+
'json_value' => json_value)
|
1640
|
+
end
|
1641
|
+
|
1642
|
+
# Converts a JSON-serialized string to corresponding JsonValue object.
|
1643
|
+
# This is an offline method.
|
1644
|
+
# Can be called before authorization.
|
1645
|
+
# Can be called synchronously.
|
1646
|
+
#
|
1647
|
+
# @param json [String] The JSON-serialized string.
|
1648
|
+
# @return [TD::Types::JsonValue]
|
1649
|
+
def get_json_value(json)
|
1650
|
+
broadcast('@type' => 'getJsonValue',
|
1651
|
+
'json' => json)
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
# Returns information about a language pack.
|
1655
|
+
# Returned language pack identifier may be different from a provided one.
|
1656
|
+
# Can be called before authorization.
|
1657
|
+
#
|
1658
|
+
# @param language_pack_id [String] Language pack identifier.
|
1659
|
+
# @return [TD::Types::LanguagePackInfo]
|
1660
|
+
def get_language_pack_info(language_pack_id)
|
1661
|
+
broadcast('@type' => 'getLanguagePackInfo',
|
1662
|
+
'language_pack_id' => language_pack_id)
|
1663
|
+
end
|
1664
|
+
|
1470
1665
|
# Returns a string stored in the local database from the specified localization target and language pack by its key.
|
1471
1666
|
# Returns a 404 error if the string is not found.
|
1472
1667
|
# This is an offline method.
|
@@ -1487,6 +1682,7 @@ module TD::ClientMethods
|
|
1487
1682
|
end
|
1488
1683
|
|
1489
1684
|
# Returns strings from a language pack in the current localization target by their keys.
|
1685
|
+
# Can be called before authorization.
|
1490
1686
|
#
|
1491
1687
|
# @param language_pack_id [String] Language pack identifier of the strings to be returned.
|
1492
1688
|
# @param keys [Array<String>] Language pack keys of the strings to be returned; leave empty to request all available
|
@@ -1500,14 +1696,58 @@ module TD::ClientMethods
|
|
1500
1696
|
|
1501
1697
|
# Returns information about the current localization target.
|
1502
1698
|
# This is an offline request if only_local is true.
|
1699
|
+
# Can be called before authorization.
|
1503
1700
|
#
|
1504
1701
|
# @param only_local [Boolean] If true, returns only locally available information without sending network requests.
|
1505
1702
|
# @return [TD::Types::LocalizationTargetInfo]
|
1506
|
-
def get_localization_target_info(only_local
|
1703
|
+
def get_localization_target_info(only_local)
|
1507
1704
|
broadcast('@type' => 'getLocalizationTargetInfo',
|
1508
1705
|
'only_local' => only_local)
|
1509
1706
|
end
|
1510
1707
|
|
1708
|
+
# Returns information about currently used log stream for internal logging of TDLib.
|
1709
|
+
# This is an offline method.
|
1710
|
+
# Can be called before authorization.
|
1711
|
+
# Can be called synchronously.
|
1712
|
+
#
|
1713
|
+
# @return [TD::Types::LogStream]
|
1714
|
+
def get_log_stream
|
1715
|
+
broadcast('@type' => 'getLogStream')
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
# Returns current verbosity level for a specified TDLib internal log tag.
|
1719
|
+
# This is an offline method.
|
1720
|
+
# Can be called before authorization.
|
1721
|
+
# Can be called synchronously.
|
1722
|
+
#
|
1723
|
+
# @param tag [String] Logging tag to change verbosity level.
|
1724
|
+
# @return [TD::Types::LogVerbosityLevel]
|
1725
|
+
def get_log_tag_verbosity_level(tag)
|
1726
|
+
broadcast('@type' => 'getLogTagVerbosityLevel',
|
1727
|
+
'tag' => tag)
|
1728
|
+
end
|
1729
|
+
|
1730
|
+
# Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications",
|
1731
|
+
# "proxy"].
|
1732
|
+
# This is an offline method.
|
1733
|
+
# Can be called before authorization.
|
1734
|
+
# Can be called synchronously.
|
1735
|
+
#
|
1736
|
+
# @return [TD::Types::LogTags]
|
1737
|
+
def get_log_tags
|
1738
|
+
broadcast('@type' => 'getLogTags')
|
1739
|
+
end
|
1740
|
+
|
1741
|
+
# Returns current verbosity level of the internal logging of TDLib.
|
1742
|
+
# This is an offline method.
|
1743
|
+
# Can be called before authorization.
|
1744
|
+
# Can be called synchronously.
|
1745
|
+
#
|
1746
|
+
# @return [TD::Types::LogVerbosityLevel]
|
1747
|
+
def get_log_verbosity_level
|
1748
|
+
broadcast('@type' => 'getLogVerbosityLevel')
|
1749
|
+
end
|
1750
|
+
|
1511
1751
|
# Returns information about a file with a map thumbnail in PNG format.
|
1512
1752
|
# Only map thumbnail files with size less than 1MB can be downloaded.
|
1513
1753
|
#
|
@@ -1519,7 +1759,7 @@ module TD::ClientMethods
|
|
1519
1759
|
# @param chat_id [Integer] Identifier of a chat, in which the thumbnail will be shown.
|
1520
1760
|
# Use 0 if unknown.
|
1521
1761
|
# @return [TD::Types::File]
|
1522
|
-
def get_map_thumbnail_file(location, zoom
|
1762
|
+
def get_map_thumbnail_file(location, zoom, width, height, scale, chat_id)
|
1523
1763
|
broadcast('@type' => 'getMapThumbnailFile',
|
1524
1764
|
'location' => location,
|
1525
1765
|
'zoom' => zoom,
|
@@ -1547,8 +1787,43 @@ module TD::ClientMethods
|
|
1547
1787
|
'message_id' => message_id)
|
1548
1788
|
end
|
1549
1789
|
|
1790
|
+
# Returns a private HTTPS link to a message in a chat.
|
1791
|
+
# Available only for already sent messages in supergroups and channels.
|
1792
|
+
# The link will work only for members of the chat.
|
1793
|
+
#
|
1794
|
+
# @param chat_id [Integer] Identifier of the chat to which the message belongs.
|
1795
|
+
# @param message_id [Integer] Identifier of the message.
|
1796
|
+
# @return [TD::Types::HttpUrl]
|
1797
|
+
def get_message_link(chat_id, message_id)
|
1798
|
+
broadcast('@type' => 'getMessageLink',
|
1799
|
+
'chat_id' => chat_id,
|
1800
|
+
'message_id' => message_id)
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
# Returns information about a public or private message link.
|
1804
|
+
#
|
1805
|
+
# @param url [String] The message link in the format "https://t.me/c/...", or "tg://privatepost?...", or
|
1806
|
+
# "https://t.me/username/...", or "tg://resolve?...".
|
1807
|
+
# @return [TD::Types::MessageLinkInfo]
|
1808
|
+
def get_message_link_info(url)
|
1809
|
+
broadcast('@type' => 'getMessageLinkInfo',
|
1810
|
+
'url' => url)
|
1811
|
+
end
|
1812
|
+
|
1813
|
+
# Returns information about a message, if it is available locally without sending network request.
|
1814
|
+
# This is an offline request.
|
1815
|
+
#
|
1816
|
+
# @param chat_id [Integer] Identifier of the chat the message belongs to.
|
1817
|
+
# @param message_id [Integer] Identifier of the message to get.
|
1818
|
+
# @return [TD::Types::Message]
|
1819
|
+
def get_message_locally(chat_id, message_id)
|
1820
|
+
broadcast('@type' => 'getMessageLocally',
|
1821
|
+
'chat_id' => chat_id,
|
1822
|
+
'message_id' => message_id)
|
1823
|
+
end
|
1824
|
+
|
1550
1825
|
# Returns information about messages.
|
1551
|
-
# If a message is not found, returns
|
1826
|
+
# If a message is not found, returns null on the corresponding position of the result.
|
1552
1827
|
#
|
1553
1828
|
# @param chat_id [Integer] Identifier of the chat the messages belong to.
|
1554
1829
|
# @param message_ids [Array<Integer>] Identifiers of the messages to get.
|
@@ -1564,16 +1839,16 @@ module TD::ClientMethods
|
|
1564
1839
|
#
|
1565
1840
|
# @param only_current [Boolean] If true, returns only data for the current library launch.
|
1566
1841
|
# @return [TD::Types::NetworkStatistics]
|
1567
|
-
def get_network_statistics(only_current
|
1842
|
+
def get_network_statistics(only_current)
|
1568
1843
|
broadcast('@type' => 'getNetworkStatistics',
|
1569
1844
|
'only_current' => only_current)
|
1570
1845
|
end
|
1571
1846
|
|
1572
1847
|
# Returns the value of an option by its name.
|
1573
|
-
# Can be called before
|
1848
|
+
# (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before
|
1849
|
+
# authorization.
|
1574
1850
|
#
|
1575
1851
|
# @param name [String] The name of the option.
|
1576
|
-
# @see https://core.telegram.org/tdlib/options List of available options
|
1577
1852
|
# @return [TD::Types::OptionValue]
|
1578
1853
|
def get_option(name)
|
1579
1854
|
broadcast('@type' => 'getOption',
|
@@ -1586,15 +1861,26 @@ module TD::ClientMethods
|
|
1586
1861
|
# @param scope [String] Telegram Passport element types requested by the service.
|
1587
1862
|
# @param public_key [String] Service's public_key.
|
1588
1863
|
# @param nonce [String] Authorization form nonce provided by the service.
|
1589
|
-
# @param password [String] Password of the current user.
|
1590
1864
|
# @return [TD::Types::PassportAuthorizationForm]
|
1591
|
-
def get_passport_authorization_form(bot_user_id, scope, public_key, nonce
|
1865
|
+
def get_passport_authorization_form(bot_user_id, scope, public_key, nonce)
|
1592
1866
|
broadcast('@type' => 'getPassportAuthorizationForm',
|
1593
1867
|
'bot_user_id' => bot_user_id,
|
1594
1868
|
'scope' => scope,
|
1595
1869
|
'public_key' => public_key,
|
1596
|
-
'nonce' => nonce
|
1597
|
-
|
1870
|
+
'nonce' => nonce)
|
1871
|
+
end
|
1872
|
+
|
1873
|
+
# Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization
|
1874
|
+
# form.
|
1875
|
+
# Result can be received only once for each authorization form.
|
1876
|
+
#
|
1877
|
+
# @param autorization_form_id [Integer] Authorization form identifier.
|
1878
|
+
# @param password [String] Password of the current user.
|
1879
|
+
# @return [TD::Types::PassportElementsWithErrors]
|
1880
|
+
def get_passport_authorization_form_available_elements(autorization_form_id, password)
|
1881
|
+
broadcast('@type' => 'getPassportAuthorizationFormAvailableElements',
|
1882
|
+
'autorization_form_id' => autorization_form_id,
|
1883
|
+
'password' => password)
|
1598
1884
|
end
|
1599
1885
|
|
1600
1886
|
# Returns one of the available Telegram Passport elements.
|
@@ -1616,7 +1902,7 @@ module TD::ClientMethods
|
|
1616
1902
|
end
|
1617
1903
|
|
1618
1904
|
# Returns an invoice payment form.
|
1619
|
-
# This method should be called when the user presses
|
1905
|
+
# This method should be called when the user presses inlineKeyboardButtonBuy.
|
1620
1906
|
#
|
1621
1907
|
# @param chat_id [Integer] Chat identifier of the Invoice message.
|
1622
1908
|
# @param message_id [Integer] Message identifier.
|
@@ -1669,19 +1955,32 @@ module TD::ClientMethods
|
|
1669
1955
|
end
|
1670
1956
|
|
1671
1957
|
# Returns a public HTTPS link to a message.
|
1672
|
-
# Available only for messages in
|
1958
|
+
# Available only for messages in supergroups and channels with username.
|
1673
1959
|
#
|
1674
1960
|
# @param chat_id [Integer] Identifier of the chat to which the message belongs.
|
1675
1961
|
# @param message_id [Integer] Identifier of the message.
|
1676
1962
|
# @param for_album [Boolean] Pass true if a link for a whole media album should be returned.
|
1677
1963
|
# @return [TD::Types::PublicMessageLink]
|
1678
|
-
def get_public_message_link(chat_id, message_id, for_album
|
1964
|
+
def get_public_message_link(chat_id, message_id, for_album)
|
1679
1965
|
broadcast('@type' => 'getPublicMessageLink',
|
1680
1966
|
'chat_id' => chat_id,
|
1681
1967
|
'message_id' => message_id,
|
1682
1968
|
'for_album' => for_album)
|
1683
1969
|
end
|
1684
1970
|
|
1971
|
+
# Returns a globally unique push notification subscription identifier for identification of an account, which has
|
1972
|
+
# received a push notification.
|
1973
|
+
# This is an offline method.
|
1974
|
+
# Can be called before authorization.
|
1975
|
+
# Can be called synchronously.
|
1976
|
+
#
|
1977
|
+
# @param payload [String] JSON-encoded push notification payload.
|
1978
|
+
# @return [TD::Types::PushReceiverId]
|
1979
|
+
def get_push_receiver_id(payload)
|
1980
|
+
broadcast('@type' => 'getPushReceiverId',
|
1981
|
+
'payload' => payload)
|
1982
|
+
end
|
1983
|
+
|
1685
1984
|
# Returns up to 20 recently used inline bots in the order of their last usage.
|
1686
1985
|
#
|
1687
1986
|
# @return [TD::Types::Users]
|
@@ -1694,7 +1993,7 @@ module TD::ClientMethods
|
|
1694
1993
|
# @param is_attached [Boolean] Pass true to return stickers and masks that were recently attached to photos or video
|
1695
1994
|
# files; pass false to return recently sent stickers.
|
1696
1995
|
# @return [TD::Types::Stickers]
|
1697
|
-
def get_recent_stickers(is_attached
|
1996
|
+
def get_recent_stickers(is_attached)
|
1698
1997
|
broadcast('@type' => 'getRecentStickers',
|
1699
1998
|
'is_attached' => is_attached)
|
1700
1999
|
end
|
@@ -1708,7 +2007,7 @@ module TD::ClientMethods
|
|
1708
2007
|
'referrer' => referrer)
|
1709
2008
|
end
|
1710
2009
|
|
1711
|
-
# Returns a recovery email address that was previously set up.
|
2010
|
+
# Returns a 2-step verification recovery email address that was previously set up.
|
1712
2011
|
# This method can be used to verify a password provided by the user.
|
1713
2012
|
#
|
1714
2013
|
# @param password [String] The password for the current user.
|
@@ -1722,9 +2021,9 @@ module TD::ClientMethods
|
|
1722
2021
|
# Can be used to register a URL as a file for further uploading, or sending as a message.
|
1723
2022
|
#
|
1724
2023
|
# @param remote_file_id [String] Remote identifier of the file to get.
|
1725
|
-
# @param file_type [TD::Types::FileType
|
2024
|
+
# @param file_type [TD::Types::FileType] File type, if known.
|
1726
2025
|
# @return [TD::Types::File]
|
1727
|
-
def get_remote_file(remote_file_id, file_type
|
2026
|
+
def get_remote_file(remote_file_id, file_type)
|
1728
2027
|
broadcast('@type' => 'getRemoteFile',
|
1729
2028
|
'remote_file_id' => remote_file_id,
|
1730
2029
|
'file_type' => file_type)
|
@@ -1776,9 +2075,11 @@ module TD::ClientMethods
|
|
1776
2075
|
end
|
1777
2076
|
|
1778
2077
|
# Returns emoji corresponding to a sticker.
|
2078
|
+
# The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the
|
2079
|
+
# corresponding Sticker object.
|
1779
2080
|
#
|
1780
2081
|
# @param sticker [TD::Types::InputFile] Sticker file identifier.
|
1781
|
-
# @return [TD::Types::
|
2082
|
+
# @return [TD::Types::Emojis]
|
1782
2083
|
def get_sticker_emojis(sticker)
|
1783
2084
|
broadcast('@type' => 'getStickerEmojis',
|
1784
2085
|
'sticker' => sticker)
|
@@ -1800,13 +2101,14 @@ module TD::ClientMethods
|
|
1800
2101
|
# If empty, returns all known installed stickers.
|
1801
2102
|
# @param limit [Integer] Maximum number of stickers to be returned.
|
1802
2103
|
# @return [TD::Types::Stickers]
|
1803
|
-
def get_stickers(emoji, limit
|
2104
|
+
def get_stickers(emoji, limit)
|
1804
2105
|
broadcast('@type' => 'getStickers',
|
1805
2106
|
'emoji' => emoji,
|
1806
2107
|
'limit' => limit)
|
1807
2108
|
end
|
1808
2109
|
|
1809
2110
|
# Returns storage usage statistics.
|
2111
|
+
# Can be called before authorization.
|
1810
2112
|
#
|
1811
2113
|
# @param chat_limit [Integer] Maximum number of chats with the largest storage usage for which separate statistics
|
1812
2114
|
# should be returned.
|
@@ -1819,6 +2121,7 @@ module TD::ClientMethods
|
|
1819
2121
|
end
|
1820
2122
|
|
1821
2123
|
# Quickly returns approximate storage usage statistics.
|
2124
|
+
# Can be called before authorization.
|
1822
2125
|
#
|
1823
2126
|
# @return [TD::Types::StorageStatisticsFast]
|
1824
2127
|
def get_storage_statistics_fast
|
@@ -1850,7 +2153,7 @@ module TD::ClientMethods
|
|
1850
2153
|
#
|
1851
2154
|
# @param supergroup_id [Integer] Identifier of the supergroup or channel.
|
1852
2155
|
# @param filter [TD::Types::SupergroupMembersFilter] The type of users to return.
|
1853
|
-
# By default,
|
2156
|
+
# By default, supergroupMembersRecent.
|
1854
2157
|
# @param offset [Integer] Number of users to skip.
|
1855
2158
|
# @param limit [Integer] The maximum number of users be returned; up to 200.
|
1856
2159
|
# @return [TD::Types::ChatMembers]
|
@@ -1894,7 +2197,7 @@ module TD::ClientMethods
|
|
1894
2197
|
# @param category [TD::Types::TopChatCategory] Category of chats to be returned.
|
1895
2198
|
# @param limit [Integer] Maximum number of chats to be returned; up to 30.
|
1896
2199
|
# @return [TD::Types::Chats]
|
1897
|
-
def get_top_chats(category, limit
|
2200
|
+
def get_top_chats(category, limit)
|
1898
2201
|
broadcast('@type' => 'getTopChats',
|
1899
2202
|
'category' => category,
|
1900
2203
|
'limit' => limit)
|
@@ -1942,27 +2245,20 @@ module TD::ClientMethods
|
|
1942
2245
|
# @param offset [Integer] The number of photos to skip; must be non-negative.
|
1943
2246
|
# @param limit [Integer] Maximum number of photos to be returned; up to 100.
|
1944
2247
|
# @return [TD::Types::UserProfilePhotos]
|
1945
|
-
def get_user_profile_photos(user_id, offset
|
2248
|
+
def get_user_profile_photos(user_id, offset, limit)
|
1946
2249
|
broadcast('@type' => 'getUserProfilePhotos',
|
1947
2250
|
'user_id' => user_id,
|
1948
2251
|
'offset' => offset,
|
1949
2252
|
'limit' => limit)
|
1950
2253
|
end
|
1951
2254
|
|
1952
|
-
# Returns background wallpapers.
|
1953
|
-
#
|
1954
|
-
# @return [TD::Types::Wallpapers]
|
1955
|
-
def get_wallpapers
|
1956
|
-
broadcast('@type' => 'getWallpapers')
|
1957
|
-
end
|
1958
|
-
|
1959
2255
|
# Returns an instant view version of a web page if available.
|
1960
2256
|
# Returns a 404 error if the web page has no instant view page.
|
1961
2257
|
#
|
1962
2258
|
# @param url [String] The web page URL.
|
1963
2259
|
# @param force_full [Boolean] If true, the full instant view for the web page will be returned.
|
1964
2260
|
# @return [TD::Types::WebPageInstantView]
|
1965
|
-
def get_web_page_instant_view(url, force_full
|
2261
|
+
def get_web_page_instant_view(url, force_full)
|
1966
2262
|
broadcast('@type' => 'getWebPageInstantView',
|
1967
2263
|
'url' => url,
|
1968
2264
|
'force_full' => force_full)
|
@@ -2023,15 +2319,14 @@ module TD::ClientMethods
|
|
2023
2319
|
# Closes the TDLib instance after a proper logout.
|
2024
2320
|
# Requires an available network connection.
|
2025
2321
|
# All local data will be destroyed.
|
2026
|
-
# After the logout completes,
|
2027
|
-
# will be sent.
|
2322
|
+
# After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent.
|
2028
2323
|
#
|
2029
2324
|
# @return [TD::Types::Ok]
|
2030
2325
|
def log_out
|
2031
2326
|
broadcast('@type' => 'logOut')
|
2032
2327
|
end
|
2033
2328
|
|
2034
|
-
#
|
2329
|
+
# Informs TDLib that the chat is opened by the user.
|
2035
2330
|
# Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are
|
2036
2331
|
# received only for opened chats).
|
2037
2332
|
#
|
@@ -2042,9 +2337,9 @@ module TD::ClientMethods
|
|
2042
2337
|
'chat_id' => chat_id)
|
2043
2338
|
end
|
2044
2339
|
|
2045
|
-
#
|
2046
|
-
#
|
2047
|
-
# An
|
2340
|
+
# Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document,
|
2341
|
+
# location or venue, or has listened to an audio file or voice note message).
|
2342
|
+
# An updateMessageContentOpened update will be generated if something has changed.
|
2048
2343
|
#
|
2049
2344
|
# @param chat_id [Integer] Chat identifier of the message.
|
2050
2345
|
# @param message_id [Integer] Identifier of the message with the opened content.
|
@@ -2055,7 +2350,8 @@ module TD::ClientMethods
|
|
2055
2350
|
'message_id' => message_id)
|
2056
2351
|
end
|
2057
2352
|
|
2058
|
-
# Optimizes storage usage, i.e.
|
2353
|
+
# Optimizes storage usage, i.e.
|
2354
|
+
# deletes some files and returns new storage usage statistics.
|
2059
2355
|
# Secret thumbnails can't be deleted.
|
2060
2356
|
#
|
2061
2357
|
# @param size [Integer] Limit on the total size of files after deletion.
|
@@ -2068,17 +2364,16 @@ module TD::ClientMethods
|
|
2068
2364
|
# @param immunity_delay [Integer] The amount of time after the creation of a file during which it can't be deleted,
|
2069
2365
|
# in seconds.
|
2070
2366
|
# Pass -1 to use the default value.
|
2071
|
-
# @param file_types [Array<TD::Types::FileType
|
2367
|
+
# @param file_types [Array<TD::Types::FileType>] If not empty, only files with the given type(s) are considered.
|
2072
2368
|
# By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted.
|
2073
|
-
# @param chat_ids [Array<Integer
|
2369
|
+
# @param chat_ids [Array<Integer>] If not empty, only files from the given chats are considered.
|
2074
2370
|
# Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos).
|
2075
|
-
# @param exclude_chat_ids [Array<Integer
|
2371
|
+
# @param exclude_chat_ids [Array<Integer>] If not empty, files from the given chats are excluded.
|
2076
2372
|
# Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos).
|
2077
|
-
# @param chat_limit [Integer
|
2373
|
+
# @param chat_limit [Integer] Same as in getStorageStatistics.
|
2078
2374
|
# Affects only returned statistics.
|
2079
2375
|
# @return [TD::Types::StorageStatistics]
|
2080
|
-
def optimize_storage(size
|
2081
|
-
file_types: nil, chat_ids: nil, exclude_chat_ids: nil, chat_limit: nil)
|
2376
|
+
def optimize_storage(size, ttl, count, immunity_delay, file_types, chat_ids, exclude_chat_ids, chat_limit)
|
2082
2377
|
broadcast('@type' => 'optimizeStorage',
|
2083
2378
|
'size' => size,
|
2084
2379
|
'ttl' => ttl,
|
@@ -2104,15 +2399,15 @@ module TD::ClientMethods
|
|
2104
2399
|
'parse_mode' => parse_mode)
|
2105
2400
|
end
|
2106
2401
|
|
2107
|
-
# Pins a message in a
|
2402
|
+
# Pins a message in a chat; requires can_pin_messages rights.
|
2108
2403
|
#
|
2109
|
-
# @param
|
2404
|
+
# @param chat_id [Integer] Identifier of the chat.
|
2110
2405
|
# @param message_id [Integer] Identifier of the new pinned message.
|
2111
2406
|
# @param disable_notification [Boolean] True, if there should be no notification about the pinned message.
|
2112
2407
|
# @return [TD::Types::Ok]
|
2113
|
-
def
|
2114
|
-
broadcast('@type' => '
|
2115
|
-
'
|
2408
|
+
def pin_chat_message(chat_id, message_id, disable_notification)
|
2409
|
+
broadcast('@type' => 'pinChatMessage',
|
2410
|
+
'chat_id' => chat_id,
|
2116
2411
|
'message_id' => message_id,
|
2117
2412
|
'disable_notification' => disable_notification)
|
2118
2413
|
end
|
@@ -2128,16 +2423,17 @@ module TD::ClientMethods
|
|
2128
2423
|
'proxy_id' => proxy_id)
|
2129
2424
|
end
|
2130
2425
|
|
2131
|
-
# Handles a
|
2426
|
+
# Handles a push notification.
|
2427
|
+
# Returns error with code 406 if the push notification is not supported and connection to the server is required to
|
2428
|
+
# fetch new data.
|
2132
2429
|
# Can be called before authorization.
|
2133
2430
|
#
|
2134
|
-
# @param
|
2135
|
-
#
|
2431
|
+
# @param payload [String] JSON-encoded push notification payload with all fields sent by the server, and
|
2432
|
+
# "google.sent_time" and "google.notification.sound" fields added.
|
2136
2433
|
# @return [TD::Types::Ok]
|
2137
|
-
def
|
2138
|
-
broadcast('@type'
|
2139
|
-
'
|
2140
|
-
'addr' => addr)
|
2434
|
+
def process_push_notification(payload)
|
2435
|
+
broadcast('@type' => 'processPushNotification',
|
2436
|
+
'payload' => payload)
|
2141
2437
|
end
|
2142
2438
|
|
2143
2439
|
# Marks all mentions in a chat as read.
|
@@ -2149,8 +2445,26 @@ module TD::ClientMethods
|
|
2149
2445
|
'chat_id' => chat_id)
|
2150
2446
|
end
|
2151
2447
|
|
2448
|
+
# Reads a part of a file from the TDLib file cache and returns read bytes.
|
2449
|
+
# This method is intended to be used only if the client has no direct access to TDLib's file system, because it is
|
2450
|
+
# usually slower than a direct read from the file.
|
2451
|
+
#
|
2452
|
+
# @param file_id [Integer] Identifier of the file.
|
2453
|
+
# The file must be located in the TDLib file cache.
|
2454
|
+
# @param offset [Integer] The offset from which to read the file.
|
2455
|
+
# @param count [Integer] Number of bytes to read.
|
2456
|
+
# An error will be returned if there are not enough bytes available in the file from the specified position.
|
2457
|
+
# Pass 0 to read all available data from the specified position.
|
2458
|
+
# @return [TD::Types::FilePart]
|
2459
|
+
def read_file_part(file_id, offset, count)
|
2460
|
+
broadcast('@type' => 'readFilePart',
|
2461
|
+
'file_id' => file_id,
|
2462
|
+
'offset' => offset,
|
2463
|
+
'count' => count)
|
2464
|
+
end
|
2465
|
+
|
2152
2466
|
# Recovers the password with a password recovery code sent to an email address that was previously set up.
|
2153
|
-
# Works only when the current authorization state is
|
2467
|
+
# Works only when the current authorization state is authorizationStateWaitPassword.
|
2154
2468
|
#
|
2155
2469
|
# @param recovery_code [String] Recovery code to check.
|
2156
2470
|
# @return [TD::Types::Ok]
|
@@ -2169,18 +2483,39 @@ module TD::ClientMethods
|
|
2169
2483
|
end
|
2170
2484
|
|
2171
2485
|
# Registers the currently used device for receiving push notifications.
|
2486
|
+
# Returns a globally unique identifier of the push notification subscription.
|
2172
2487
|
#
|
2173
2488
|
# @param device_token [TD::Types::DeviceToken] Device token.
|
2174
|
-
# @param other_user_ids [Array<Integer>] List of
|
2175
|
-
#
|
2176
|
-
|
2177
|
-
def register_device(device_token, other_user_ids = [])
|
2489
|
+
# @param other_user_ids [Array<Integer>] List of user identifiers of other users currently using the client.
|
2490
|
+
# @return [TD::Types::PushReceiverId]
|
2491
|
+
def register_device(device_token, other_user_ids)
|
2178
2492
|
broadcast('@type' => 'registerDevice',
|
2179
2493
|
'device_token' => device_token,
|
2180
2494
|
'other_user_ids' => other_user_ids)
|
2181
2495
|
end
|
2182
2496
|
|
2183
|
-
#
|
2497
|
+
# Finishes user registration.
|
2498
|
+
# Works only when the current authorization state is authorizationStateWaitRegistration.
|
2499
|
+
#
|
2500
|
+
# @param first_name [String] The first name of the user; 1-64 characters.
|
2501
|
+
# @param last_name [String] The last name of the user; 0-64 characters.
|
2502
|
+
# @return [TD::Types::Ok]
|
2503
|
+
def register_user(first_name, last_name)
|
2504
|
+
broadcast('@type' => 'registerUser',
|
2505
|
+
'first_name' => first_name,
|
2506
|
+
'last_name' => last_name)
|
2507
|
+
end
|
2508
|
+
|
2509
|
+
# Removes background from the list of installed backgrounds.
|
2510
|
+
#
|
2511
|
+
# @param background_id [Integer] The background indentifier.
|
2512
|
+
# @return [TD::Types::Ok]
|
2513
|
+
def remove_background(background_id)
|
2514
|
+
broadcast('@type' => 'removeBackground',
|
2515
|
+
'background_id' => background_id)
|
2516
|
+
end
|
2517
|
+
|
2518
|
+
# Removes users from the contact list.
|
2184
2519
|
#
|
2185
2520
|
# @param user_ids [Array<Integer>] Identifiers of users to be deleted.
|
2186
2521
|
# @return [TD::Types::Ok]
|
@@ -2198,6 +2533,30 @@ module TD::ClientMethods
|
|
2198
2533
|
'sticker' => sticker)
|
2199
2534
|
end
|
2200
2535
|
|
2536
|
+
# Removes an active notification from notification list.
|
2537
|
+
# Needs to be called only if the notification is removed by the current user.
|
2538
|
+
#
|
2539
|
+
# @param notification_group_id [Integer] Identifier of notification group to which the notification belongs.
|
2540
|
+
# @param notification_id [Integer] Identifier of removed notification.
|
2541
|
+
# @return [TD::Types::Ok]
|
2542
|
+
def remove_notification(notification_group_id, notification_id)
|
2543
|
+
broadcast('@type' => 'removeNotification',
|
2544
|
+
'notification_group_id' => notification_group_id,
|
2545
|
+
'notification_id' => notification_id)
|
2546
|
+
end
|
2547
|
+
|
2548
|
+
# Removes a group of active notifications.
|
2549
|
+
# Needs to be called only if the notification group is removed by the current user.
|
2550
|
+
#
|
2551
|
+
# @param notification_group_id [Integer] Notification group identifier.
|
2552
|
+
# @param max_notification_id [Integer] Maximum identifier of removed notifications.
|
2553
|
+
# @return [TD::Types::Ok]
|
2554
|
+
def remove_notification_group(notification_group_id, max_notification_id)
|
2555
|
+
broadcast('@type' => 'removeNotificationGroup',
|
2556
|
+
'notification_group_id' => notification_group_id,
|
2557
|
+
'max_notification_id' => max_notification_id)
|
2558
|
+
end
|
2559
|
+
|
2201
2560
|
# Removes a proxy server.
|
2202
2561
|
# Can be called before authorization.
|
2203
2562
|
#
|
@@ -2223,7 +2582,7 @@ module TD::ClientMethods
|
|
2223
2582
|
# or video files; pass false to remove the sticker from the list of recently sent stickers.
|
2224
2583
|
# @param sticker [TD::Types::InputFile] Sticker file to delete.
|
2225
2584
|
# @return [TD::Types::Ok]
|
2226
|
-
def remove_recent_sticker(
|
2585
|
+
def remove_recent_sticker(is_attached, sticker)
|
2227
2586
|
broadcast('@type' => 'removeRecentSticker',
|
2228
2587
|
'is_attached' => is_attached,
|
2229
2588
|
'sticker' => sticker)
|
@@ -2275,7 +2634,7 @@ module TD::ClientMethods
|
|
2275
2634
|
# ordinary sticker sets.
|
2276
2635
|
# @param sticker_set_ids [Array<Integer>] Identifiers of installed sticker sets in the new correct order.
|
2277
2636
|
# @return [TD::Types::Ok]
|
2278
|
-
def reorder_installed_sticker_sets(
|
2637
|
+
def reorder_installed_sticker_sets(is_masks, sticker_set_ids)
|
2279
2638
|
broadcast('@type' => 'reorderInstalledStickerSets',
|
2280
2639
|
'is_masks' => is_masks,
|
2281
2640
|
'sticker_set_ids' => sticker_set_ids)
|
@@ -2289,7 +2648,7 @@ module TD::ClientMethods
|
|
2289
2648
|
# @param reason [TD::Types::ChatReportReason] The reason for reporting the chat.
|
2290
2649
|
# @param message_ids [Array<Integer>] Identifiers of reported messages, if any.
|
2291
2650
|
# @return [TD::Types::Ok]
|
2292
|
-
def report_chat(chat_id, reason, message_ids
|
2651
|
+
def report_chat(chat_id, reason, message_ids)
|
2293
2652
|
broadcast('@type' => 'reportChat',
|
2294
2653
|
'chat_id' => chat_id,
|
2295
2654
|
'reason' => reason,
|
@@ -2303,7 +2662,7 @@ module TD::ClientMethods
|
|
2303
2662
|
# @param message_ids [Array<Integer>] Identifiers of messages sent in the supergroup by the user.
|
2304
2663
|
# This list must be non-empty.
|
2305
2664
|
# @return [TD::Types::Ok]
|
2306
|
-
def report_supergroup_spam(supergroup_id, user_id, message_ids
|
2665
|
+
def report_supergroup_spam(supergroup_id, user_id, message_ids)
|
2307
2666
|
broadcast('@type' => 'reportSupergroupSpam',
|
2308
2667
|
'supergroup_id' => supergroup_id,
|
2309
2668
|
'user_id' => user_id,
|
@@ -2311,7 +2670,7 @@ module TD::ClientMethods
|
|
2311
2670
|
end
|
2312
2671
|
|
2313
2672
|
# Requests to send a password recovery code to an email address that was previously set up.
|
2314
|
-
# Works only when the current authorization state is
|
2673
|
+
# Works only when the current authorization state is authorizationStateWaitPassword.
|
2315
2674
|
#
|
2316
2675
|
# @return [TD::Types::Ok]
|
2317
2676
|
def request_authentication_password_recovery
|
@@ -2326,8 +2685,8 @@ module TD::ClientMethods
|
|
2326
2685
|
end
|
2327
2686
|
|
2328
2687
|
# Re-sends an authentication code to the user.
|
2329
|
-
# Works only when the current authorization state is
|
2330
|
-
#
|
2688
|
+
# Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result
|
2689
|
+
# is not null.
|
2331
2690
|
#
|
2332
2691
|
# @return [TD::Types::Ok]
|
2333
2692
|
def resend_authentication_code
|
@@ -2335,7 +2694,7 @@ module TD::ClientMethods
|
|
2335
2694
|
end
|
2336
2695
|
|
2337
2696
|
# Re-sends the authentication code sent to confirm a new phone number for the user.
|
2338
|
-
# Works only if the previously received
|
2697
|
+
# Works only if the previously received authenticationCodeInfo next_code_type was not null.
|
2339
2698
|
#
|
2340
2699
|
# @return [TD::Types::AuthenticationCodeInfo]
|
2341
2700
|
def resend_change_phone_number_code
|
@@ -2349,6 +2708,23 @@ module TD::ClientMethods
|
|
2349
2708
|
broadcast('@type' => 'resendEmailAddressVerificationCode')
|
2350
2709
|
end
|
2351
2710
|
|
2711
|
+
# Resends messages which failed to send.
|
2712
|
+
# Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in
|
2713
|
+
# messageSendingStateFailed.retry_after time passed.
|
2714
|
+
# If a message is re-sent, the corresponding failed to send message is deleted.
|
2715
|
+
# Returns the sent messages in the same order as the message identifiers passed in message_ids.
|
2716
|
+
# If a message can't be re-sent, null will be returned instead of the message.
|
2717
|
+
#
|
2718
|
+
# @param chat_id [Integer] Identifier of the chat to send messages.
|
2719
|
+
# @param message_ids [Array<Integer>] Identifiers of the messages to resend.
|
2720
|
+
# Message identifiers must be in a strictly increasing order.
|
2721
|
+
# @return [TD::Types::Messages]
|
2722
|
+
def resend_messages(chat_id, message_ids)
|
2723
|
+
broadcast('@type' => 'resendMessages',
|
2724
|
+
'chat_id' => chat_id,
|
2725
|
+
'message_ids' => message_ids)
|
2726
|
+
end
|
2727
|
+
|
2352
2728
|
# Resends phone number confirmation code.
|
2353
2729
|
#
|
2354
2730
|
# @return [TD::Types::AuthenticationCodeInfo]
|
@@ -2363,6 +2739,13 @@ module TD::ClientMethods
|
|
2363
2739
|
broadcast('@type' => 'resendPhoneNumberVerificationCode')
|
2364
2740
|
end
|
2365
2741
|
|
2742
|
+
# Resends the 2-step verification recovery email address verification code.
|
2743
|
+
#
|
2744
|
+
# @return [TD::Types::PasswordState]
|
2745
|
+
def resend_recovery_email_address_code
|
2746
|
+
broadcast('@type' => 'resendRecoveryEmailAddressCode')
|
2747
|
+
end
|
2748
|
+
|
2366
2749
|
# Resets all notification settings to their default values.
|
2367
2750
|
# By default, all chats are unmuted, the sound is set to "default" and message previews are shown.
|
2368
2751
|
#
|
@@ -2371,6 +2754,13 @@ module TD::ClientMethods
|
|
2371
2754
|
broadcast('@type' => 'resetAllNotificationSettings')
|
2372
2755
|
end
|
2373
2756
|
|
2757
|
+
# Resets list of installed backgrounds to its default value.
|
2758
|
+
#
|
2759
|
+
# @return [TD::Types::Ok]
|
2760
|
+
def reset_backgrounds
|
2761
|
+
broadcast('@type' => 'resetBackgrounds')
|
2762
|
+
end
|
2763
|
+
|
2374
2764
|
# Resets all network data usage statistics to zero.
|
2375
2765
|
# Can be called before authorization.
|
2376
2766
|
#
|
@@ -2379,8 +2769,32 @@ module TD::ClientMethods
|
|
2379
2769
|
broadcast('@type' => 'resetNetworkStatistics')
|
2380
2770
|
end
|
2381
2771
|
|
2772
|
+
# Saves application log event on the server.
|
2773
|
+
# Can be called before authorization.
|
2774
|
+
#
|
2775
|
+
# @param type [String] Event type.
|
2776
|
+
# @param chat_id [Integer] Optional chat identifier, associated with the event.
|
2777
|
+
# @param data [TD::Types::JsonValue] The log event data.
|
2778
|
+
# @return [TD::Types::Ok]
|
2779
|
+
def save_application_log_event(type, chat_id, data)
|
2780
|
+
broadcast('@type' => 'saveApplicationLogEvent',
|
2781
|
+
'type' => type,
|
2782
|
+
'chat_id' => chat_id,
|
2783
|
+
'data' => data)
|
2784
|
+
end
|
2785
|
+
|
2786
|
+
# Searches for a background by its name.
|
2787
|
+
#
|
2788
|
+
# @param name [String] The name of the background.
|
2789
|
+
# @return [TD::Types::Background]
|
2790
|
+
def search_background(name)
|
2791
|
+
broadcast('@type' => 'searchBackground',
|
2792
|
+
'name' => name)
|
2793
|
+
end
|
2794
|
+
|
2382
2795
|
# Searches for call messages.
|
2383
|
-
# Returns the results in reverse chronological order (i.
|
2796
|
+
# Returns the results in reverse chronological order (i.
|
2797
|
+
# e., in order of decreasing message_id).
|
2384
2798
|
# For optimal performance the number of returned messages is chosen by the library.
|
2385
2799
|
#
|
2386
2800
|
# @param from_message_id [Integer] Identifier of the message from which to search; use 0 to get results from the last
|
@@ -2390,7 +2804,7 @@ module TD::ClientMethods
|
|
2390
2804
|
# reached.
|
2391
2805
|
# @param only_missed [Boolean] If true, returns only messages with missed calls.
|
2392
2806
|
# @return [TD::Types::Messages]
|
2393
|
-
def search_call_messages(from_message_id, limit
|
2807
|
+
def search_call_messages(from_message_id, limit, only_missed)
|
2394
2808
|
broadcast('@type' => 'searchCallMessages',
|
2395
2809
|
'from_message_id' => from_message_id,
|
2396
2810
|
'limit' => limit,
|
@@ -2401,12 +2815,12 @@ module TD::ClientMethods
|
|
2401
2815
|
# Requires administrator rights in channels.
|
2402
2816
|
#
|
2403
2817
|
# @param chat_id [Integer] Chat identifier.
|
2404
|
-
# @param query [String
|
2818
|
+
# @param query [String] Query to search for.
|
2405
2819
|
# @param limit [Integer] The maximum number of users to be returned.
|
2406
2820
|
# @param filter [TD::Types::ChatMembersFilter] The type of users to return.
|
2407
|
-
# By default,
|
2821
|
+
# By default, chatMembersFilterMembers.
|
2408
2822
|
# @return [TD::Types::ChatMembers]
|
2409
|
-
def search_chat_members(chat_id,
|
2823
|
+
def search_chat_members(chat_id, query, limit, filter)
|
2410
2824
|
broadcast('@type' => 'searchChatMembers',
|
2411
2825
|
'chat_id' => chat_id,
|
2412
2826
|
'query' => query,
|
@@ -2415,13 +2829,14 @@ module TD::ClientMethods
|
|
2415
2829
|
end
|
2416
2830
|
|
2417
2831
|
# Searches for messages with given words in the chat.
|
2418
|
-
# Returns the results in reverse chronological order, i.e.
|
2832
|
+
# Returns the results in reverse chronological order, i.e.
|
2833
|
+
# in order of decreasing message_id.
|
2419
2834
|
# Cannot be used in secret chats with a non-empty query (searchSecretMessages should be used instead), or without an
|
2420
2835
|
# enabled message database.
|
2421
2836
|
# For optimal performance the number of returned messages is chosen by the library.
|
2422
2837
|
#
|
2423
2838
|
# @param chat_id [Integer] Identifier of the chat in which to search messages.
|
2424
|
-
# @param query [String
|
2839
|
+
# @param query [String] Query to search for.
|
2425
2840
|
# @param sender_user_id [Integer] If not 0, only messages sent by the specified user will be returned.
|
2426
2841
|
# Not supported in secret chats.
|
2427
2842
|
# @param from_message_id [Integer] Identifier of the message starting from which history must be fetched; use 0 to
|
@@ -2435,8 +2850,7 @@ module TD::ClientMethods
|
|
2435
2850
|
# reached.
|
2436
2851
|
# @param filter [TD::Types::SearchMessagesFilter] Filter for message content in the search results.
|
2437
2852
|
# @return [TD::Types::Messages]
|
2438
|
-
def search_chat_messages(chat_id,
|
2439
|
-
query: nil, sender_user_id: 0, from_message_id: 0, filter: SearchMessagesFilter::Empty.new)
|
2853
|
+
def search_chat_messages(chat_id, query, sender_user_id, from_message_id, offset, limit, filter)
|
2440
2854
|
broadcast('@type' => 'searchChatMessages',
|
2441
2855
|
'chat_id' => chat_id,
|
2442
2856
|
'query' => query,
|
@@ -2453,7 +2867,7 @@ module TD::ClientMethods
|
|
2453
2867
|
# @param chat_id [Integer] Chat identifier.
|
2454
2868
|
# @param limit [Integer] Maximum number of messages to be returned.
|
2455
2869
|
# @return [TD::Types::Messages]
|
2456
|
-
def search_chat_recent_location_messages(chat_id, limit
|
2870
|
+
def search_chat_recent_location_messages(chat_id, limit)
|
2457
2871
|
broadcast('@type' => 'searchChatRecentLocationMessages',
|
2458
2872
|
'chat_id' => chat_id,
|
2459
2873
|
'limit' => limit)
|
@@ -2462,11 +2876,11 @@ module TD::ClientMethods
|
|
2462
2876
|
# Searches for the specified query in the title and username of already known chats, this is an offline request.
|
2463
2877
|
# Returns chats in the order seen in the chat list.
|
2464
2878
|
#
|
2465
|
-
# @param query [String
|
2879
|
+
# @param query [String] Query to search for.
|
2466
2880
|
# If the query is empty, returns up to 20 recently found chats.
|
2467
2881
|
# @param limit [Integer] Maximum number of chats to be returned.
|
2468
2882
|
# @return [TD::Types::Chats]
|
2469
|
-
def search_chats(query
|
2883
|
+
def search_chats(query, limit)
|
2470
2884
|
broadcast('@type' => 'searchChats',
|
2471
2885
|
'query' => query,
|
2472
2886
|
'limit' => limit)
|
@@ -2478,7 +2892,7 @@ module TD::ClientMethods
|
|
2478
2892
|
# @param query [String] Query to search for.
|
2479
2893
|
# @param limit [Integer] Maximum number of chats to be returned.
|
2480
2894
|
# @return [TD::Types::Chats]
|
2481
|
-
def search_chats_on_server(query, limit
|
2895
|
+
def search_chats_on_server(query, limit)
|
2482
2896
|
broadcast('@type' => 'searchChatsOnServer',
|
2483
2897
|
'query' => query,
|
2484
2898
|
'limit' => limit)
|
@@ -2486,21 +2900,33 @@ module TD::ClientMethods
|
|
2486
2900
|
|
2487
2901
|
# Searches for the specified query in the first names, last names and usernames of the known user contacts.
|
2488
2902
|
#
|
2489
|
-
# @param query [String, nil] Query to search for;
|
2903
|
+
# @param query [String, nil] Query to search for; may be empty to return all contacts.
|
2490
2904
|
# @param limit [Integer] Maximum number of users to be returned.
|
2491
2905
|
# @return [TD::Types::Users]
|
2492
|
-
def search_contacts(query = nil, limit
|
2906
|
+
def search_contacts(query = nil, limit)
|
2493
2907
|
broadcast('@type' => 'searchContacts',
|
2494
2908
|
'query' => query,
|
2495
2909
|
'limit' => limit)
|
2496
2910
|
end
|
2497
2911
|
|
2912
|
+
# Searches for emojis by keywords.
|
2913
|
+
# Supported only if the file database is enabled.
|
2914
|
+
#
|
2915
|
+
# @param text [String] Text to search for.
|
2916
|
+
# @param exact_match [Boolean] True, if only emojis, which exactly match text needs to be returned.
|
2917
|
+
# @return [TD::Types::Emojis]
|
2918
|
+
def search_emojis(text, exact_match)
|
2919
|
+
broadcast('@type' => 'searchEmojis',
|
2920
|
+
'text' => text,
|
2921
|
+
'exact_match' => exact_match)
|
2922
|
+
end
|
2923
|
+
|
2498
2924
|
# Searches for recently used hashtags by their prefix.
|
2499
2925
|
#
|
2500
|
-
# @param prefix [String
|
2926
|
+
# @param prefix [String] Hashtag prefix to search for.
|
2501
2927
|
# @param limit [Integer] Maximum number of hashtags to be returned.
|
2502
2928
|
# @return [TD::Types::Hashtags]
|
2503
|
-
def search_hashtags(prefix
|
2929
|
+
def search_hashtags(prefix, limit)
|
2504
2930
|
broadcast('@type' => 'searchHashtags',
|
2505
2931
|
'prefix' => prefix,
|
2506
2932
|
'limit' => limit)
|
@@ -2509,10 +2935,10 @@ module TD::ClientMethods
|
|
2509
2935
|
# Searches for installed sticker sets by looking for specified query in their title and name.
|
2510
2936
|
#
|
2511
2937
|
# @param is_masks [Boolean] Pass true to return mask sticker sets; pass false to return ordinary sticker sets.
|
2512
|
-
# @param query [String
|
2938
|
+
# @param query [String] Query to search for.
|
2513
2939
|
# @param limit [Integer] Maximum number of sticker sets to return.
|
2514
2940
|
# @return [TD::Types::StickerSets]
|
2515
|
-
def search_installed_sticker_sets(query
|
2941
|
+
def search_installed_sticker_sets(is_masks, query, limit)
|
2516
2942
|
broadcast('@type' => 'searchInstalledStickerSets',
|
2517
2943
|
'is_masks' => is_masks,
|
2518
2944
|
'query' => query,
|
@@ -2532,7 +2958,7 @@ module TD::ClientMethods
|
|
2532
2958
|
# Fewer messages may be returned than specified by the limit, even if the end of the message history has not been
|
2533
2959
|
# reached.
|
2534
2960
|
# @return [TD::Types::Messages]
|
2535
|
-
def search_messages(query,
|
2961
|
+
def search_messages(query, offset_date, offset_chat_id, offset_message_id, limit)
|
2536
2962
|
broadcast('@type' => 'searchMessages',
|
2537
2963
|
'query' => query,
|
2538
2964
|
'offset_date' => offset_date,
|
@@ -2572,7 +2998,7 @@ module TD::ClientMethods
|
|
2572
2998
|
# @param chat_id [Integer] Identifier of the chat in which to search.
|
2573
2999
|
# Specify 0 to search in all secret chats.
|
2574
3000
|
# @param query [String] Query to search for.
|
2575
|
-
# If empty,
|
3001
|
+
# If empty, searchChatMessages should be used instead.
|
2576
3002
|
# @param from_search_id [Integer] The identifier from the result of a previous request, use 0 to get results from the
|
2577
3003
|
# last message.
|
2578
3004
|
# @param limit [Integer] Maximum number of messages to be returned; up to 100.
|
@@ -2580,7 +3006,7 @@ module TD::ClientMethods
|
|
2580
3006
|
# reached.
|
2581
3007
|
# @param filter [TD::Types::SearchMessagesFilter] A filter for the content of messages in the search results.
|
2582
3008
|
# @return [TD::Types::FoundMessages]
|
2583
|
-
def search_secret_messages(chat_id, query,
|
3009
|
+
def search_secret_messages(chat_id, query, from_search_id, limit, filter)
|
2584
3010
|
broadcast('@type' => 'searchSecretMessages',
|
2585
3011
|
'chat_id' => chat_id,
|
2586
3012
|
'query' => query,
|
@@ -2611,9 +3037,9 @@ module TD::ClientMethods
|
|
2611
3037
|
# Searches for stickers from public sticker sets that correspond to a given emoji.
|
2612
3038
|
#
|
2613
3039
|
# @param emoji [String] String representation of emoji; must be non-empty.
|
2614
|
-
# @param limit [Integer] Maximum number of stickers to be returned.
|
3040
|
+
# @param limit [Integer, nil] Maximum number of stickers to be returned.
|
2615
3041
|
# @return [TD::Types::Stickers]
|
2616
|
-
def search_stickers(emoji, limit =
|
3042
|
+
def search_stickers(emoji, limit = nil)
|
2617
3043
|
broadcast('@type' => 'searchStickers',
|
2618
3044
|
'emoji' => emoji,
|
2619
3045
|
'limit' => limit)
|
@@ -2622,13 +3048,14 @@ module TD::ClientMethods
|
|
2622
3048
|
# Invites a bot to a chat (if it is not yet a member) and sends it the /start command.
|
2623
3049
|
# Bots can't be invited to a private chat other than the chat with the bot.
|
2624
3050
|
# Bots can't be invited to channels (although they can be added as admins) and secret chats.
|
3051
|
+
# Returns the sent message.
|
2625
3052
|
#
|
2626
3053
|
# @param bot_user_id [Integer] Identifier of the bot.
|
2627
3054
|
# @param chat_id [Integer] Identifier of the target chat.
|
2628
|
-
# @param parameter [String
|
2629
|
-
#
|
2630
|
-
# @return [TD::Types::Message]
|
2631
|
-
def send_bot_start_message(bot_user_id, chat_id, parameter
|
3055
|
+
# @param parameter [String] A hidden parameter sent to the bot for deep linking purposes
|
3056
|
+
# (https://core.telegram.org/bots#deep-linking).
|
3057
|
+
# @return [TD::Types::Message]
|
3058
|
+
def send_bot_start_message(bot_user_id, chat_id, parameter)
|
2632
3059
|
broadcast('@type' => 'sendBotStartMessage',
|
2633
3060
|
'bot_user_id' => bot_user_id,
|
2634
3061
|
'chat_id' => chat_id,
|
@@ -2650,13 +3077,16 @@ module TD::ClientMethods
|
|
2650
3077
|
#
|
2651
3078
|
# @param call_id [Integer] Call identifier.
|
2652
3079
|
# @param rating [Integer] Call rating; 1-5.
|
2653
|
-
# @param comment [String
|
3080
|
+
# @param comment [String] An optional user comment if the rating is less than 5.
|
3081
|
+
# @param problems [Array<TD::Types::CallProblem>] List of the exact types of problems with the call, specified by the
|
3082
|
+
# user.
|
2654
3083
|
# @return [TD::Types::Ok]
|
2655
|
-
def send_call_rating(call_id, rating, comment
|
2656
|
-
broadcast('@type'
|
2657
|
-
'call_id'
|
2658
|
-
'rating'
|
2659
|
-
'comment'
|
3084
|
+
def send_call_rating(call_id, rating, comment, problems)
|
3085
|
+
broadcast('@type' => 'sendCallRating',
|
3086
|
+
'call_id' => call_id,
|
3087
|
+
'rating' => rating,
|
3088
|
+
'comment' => comment,
|
3089
|
+
'problems' => problems)
|
2660
3090
|
end
|
2661
3091
|
|
2662
3092
|
# Sends a notification about user activity in a chat.
|
@@ -2723,30 +3153,35 @@ module TD::ClientMethods
|
|
2723
3153
|
# @param from_background [Boolean] Pass true if the message is sent from background.
|
2724
3154
|
# @param query_id [Integer] Identifier of the inline query.
|
2725
3155
|
# @param result_id [String] Identifier of the inline result.
|
3156
|
+
# @param hide_via_bot [Boolean] If true, there will be no mention of a bot, via which the message is sent.
|
3157
|
+
# Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and
|
3158
|
+
# GetOption("venue_search_bot_username").
|
2726
3159
|
# @return [TD::Types::Message]
|
2727
|
-
def send_inline_query_result_message(chat_id,
|
2728
|
-
|
3160
|
+
def send_inline_query_result_message(chat_id, reply_to_message_id, disable_notification, from_background, query_id,
|
3161
|
+
result_id, hide_via_bot)
|
2729
3162
|
broadcast('@type' => 'sendInlineQueryResultMessage',
|
2730
3163
|
'chat_id' => chat_id,
|
2731
3164
|
'reply_to_message_id' => reply_to_message_id,
|
2732
3165
|
'disable_notification' => disable_notification,
|
2733
3166
|
'from_background' => from_background,
|
2734
3167
|
'query_id' => query_id,
|
2735
|
-
'result_id' => result_id
|
3168
|
+
'result_id' => result_id,
|
3169
|
+
'hide_via_bot' => hide_via_bot)
|
2736
3170
|
end
|
2737
3171
|
|
2738
3172
|
# Sends a message.
|
3173
|
+
# Returns the sent message.
|
2739
3174
|
#
|
2740
3175
|
# @param chat_id [Integer] Target chat.
|
2741
3176
|
# @param reply_to_message_id [Integer] Identifier of the message to reply to or 0.
|
2742
3177
|
# @param disable_notification [Boolean] Pass true to disable notification for the message.
|
2743
3178
|
# Not supported in secret chats.
|
2744
3179
|
# @param from_background [Boolean] Pass true if the message is sent from the background.
|
2745
|
-
# @param reply_markup [TD::Types::ReplyMarkup
|
3180
|
+
# @param reply_markup [TD::Types::ReplyMarkup] Markup for replying to the message; for bots only.
|
2746
3181
|
# @param input_message_content [TD::Types::InputMessageContent] The content of the message to be sent.
|
2747
|
-
# @return [TD::Types::Message]
|
2748
|
-
def send_message(chat_id,
|
2749
|
-
|
3182
|
+
# @return [TD::Types::Message]
|
3183
|
+
def send_message(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup,
|
3184
|
+
input_message_content)
|
2750
3185
|
broadcast('@type' => 'sendMessage',
|
2751
3186
|
'chat_id' => chat_id,
|
2752
3187
|
'reply_to_message_id' => reply_to_message_id,
|
@@ -2758,6 +3193,7 @@ module TD::ClientMethods
|
|
2758
3193
|
|
2759
3194
|
# Sends messages grouped together into an album.
|
2760
3195
|
# Currently only photo and video messages can be grouped into an album.
|
3196
|
+
# Returns sent messages.
|
2761
3197
|
#
|
2762
3198
|
# @param chat_id [Integer] Target chat.
|
2763
3199
|
# @param reply_to_message_id [Integer] Identifier of a message to reply to or 0.
|
@@ -2765,9 +3201,8 @@ module TD::ClientMethods
|
|
2765
3201
|
# Not supported in secret chats.
|
2766
3202
|
# @param from_background [Boolean] Pass true if the messages are sent from the background.
|
2767
3203
|
# @param input_message_contents [Array<TD::Types::InputMessageContent>] Contents of messages to be sent.
|
2768
|
-
# @return [TD::Types::Messages]
|
2769
|
-
def send_message_album(chat_id, input_message_contents
|
2770
|
-
reply_to_message_id: 0, disable_notification: false, from_background: false)
|
3204
|
+
# @return [TD::Types::Messages]
|
3205
|
+
def send_message_album(chat_id, reply_to_message_id, disable_notification, from_background, input_message_contents)
|
2771
3206
|
broadcast('@type' => 'sendMessageAlbum',
|
2772
3207
|
'chat_id' => chat_id,
|
2773
3208
|
'reply_to_message_id' => reply_to_message_id,
|
@@ -2777,6 +3212,8 @@ module TD::ClientMethods
|
|
2777
3212
|
end
|
2778
3213
|
|
2779
3214
|
# Sends a Telegram Passport authorization form, effectively sharing data with the service.
|
3215
|
+
# This method must be called after getPassportAuthorizationFormAvailableElements if some previously available
|
3216
|
+
# elements need to be used.
|
2780
3217
|
#
|
2781
3218
|
# @param autorization_form_id [Integer] Authorization form identifier.
|
2782
3219
|
# @param types [Array<TD::Types::PassportElementType>] Types of Telegram Passport elements chosen by user to complete
|
@@ -2792,11 +3229,11 @@ module TD::ClientMethods
|
|
2792
3229
|
#
|
2793
3230
|
# @param chat_id [Integer] Chat identifier of the Invoice message.
|
2794
3231
|
# @param message_id [Integer] Message identifier.
|
2795
|
-
# @param order_info_id [String] Identifier returned by
|
2796
|
-
# @param shipping_option_id [String
|
3232
|
+
# @param order_info_id [String] Identifier returned by ValidateOrderInfo, or an empty string.
|
3233
|
+
# @param shipping_option_id [String] Identifier of a chosen shipping option, if applicable.
|
2797
3234
|
# @param credentials [TD::Types::InputCredentials] The credentials chosen by user for payment.
|
2798
3235
|
# @return [TD::Types::PaymentResult]
|
2799
|
-
def send_payment_form(chat_id, message_id,
|
3236
|
+
def send_payment_form(chat_id, message_id, order_info_id, shipping_option_id, credentials)
|
2800
3237
|
broadcast('@type' => 'sendPaymentForm',
|
2801
3238
|
'chat_id' => chat_id,
|
2802
3239
|
'message_id' => message_id,
|
@@ -2811,32 +3248,26 @@ module TD::ClientMethods
|
|
2811
3248
|
#
|
2812
3249
|
# @param hash [String] Value of the "hash" parameter from the link.
|
2813
3250
|
# @param phone_number [String] Value of the "phone" parameter from the link.
|
2814
|
-
# @param
|
2815
|
-
#
|
2816
|
-
# @param is_current_phone_number [Boolean] Pass true if the phone number is used on the current device.
|
2817
|
-
# Ignored if allow_flash_call is false.
|
3251
|
+
# @param settings [TD::Types::PhoneNumberAuthenticationSettings] Settings for the authentication of the user's phone
|
3252
|
+
# number.
|
2818
3253
|
# @return [TD::Types::AuthenticationCodeInfo]
|
2819
|
-
def send_phone_number_confirmation_code(hash, phone_number,
|
2820
|
-
broadcast('@type'
|
2821
|
-
'hash'
|
2822
|
-
'phone_number'
|
2823
|
-
'
|
2824
|
-
'is_current_phone_number' => is_current_phone_number)
|
3254
|
+
def send_phone_number_confirmation_code(hash, phone_number, settings)
|
3255
|
+
broadcast('@type' => 'sendPhoneNumberConfirmationCode',
|
3256
|
+
'hash' => hash,
|
3257
|
+
'phone_number' => phone_number,
|
3258
|
+
'settings' => settings)
|
2825
3259
|
end
|
2826
3260
|
|
2827
3261
|
# Sends a code to verify a phone number to be added to a user's Telegram Passport.
|
2828
3262
|
#
|
2829
3263
|
# @param phone_number [String] The phone number of the user, in international format.
|
2830
|
-
# @param
|
2831
|
-
#
|
2832
|
-
# @param is_current_phone_number [Boolean] Pass true if the phone number is used on the current device.
|
2833
|
-
# Ignored if allow_flash_call is false.
|
3264
|
+
# @param settings [TD::Types::PhoneNumberAuthenticationSettings] Settings for the authentication of the user's phone
|
3265
|
+
# number.
|
2834
3266
|
# @return [TD::Types::AuthenticationCodeInfo]
|
2835
|
-
def send_phone_number_verification_code(phone_number,
|
2836
|
-
broadcast('@type'
|
2837
|
-
'phone_number'
|
2838
|
-
'
|
2839
|
-
'is_current_phone_number' => is_current_phone_number)
|
3267
|
+
def send_phone_number_verification_code(phone_number, settings)
|
3268
|
+
broadcast('@type' => 'sendPhoneNumberVerificationCode',
|
3269
|
+
'phone_number' => phone_number,
|
3270
|
+
'settings' => settings)
|
2840
3271
|
end
|
2841
3272
|
|
2842
3273
|
# Changes the period of inactivity after which the account of the current user will automatically be deleted.
|
@@ -2860,19 +3291,43 @@ module TD::ClientMethods
|
|
2860
3291
|
end
|
2861
3292
|
|
2862
3293
|
# Sets the phone number of the user and sends an authentication code to the user.
|
2863
|
-
# Works only when the current authorization state is
|
3294
|
+
# Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending
|
3295
|
+
# authentication query and the current authorization state is authorizationStateWaitCode or
|
3296
|
+
# authorizationStateWaitPassword.
|
2864
3297
|
#
|
2865
3298
|
# @param phone_number [String] The phone number of the user, in international format.
|
2866
|
-
# @param
|
2867
|
-
#
|
2868
|
-
# @
|
2869
|
-
|
3299
|
+
# @param settings [TD::Types::PhoneNumberAuthenticationSettings] Settings for the authentication of the user's phone
|
3300
|
+
# number.
|
3301
|
+
# @return [TD::Types::Ok]
|
3302
|
+
def set_authentication_phone_number(phone_number, settings)
|
3303
|
+
broadcast('@type' => 'setAuthenticationPhoneNumber',
|
3304
|
+
'phone_number' => phone_number,
|
3305
|
+
'settings' => settings)
|
3306
|
+
end
|
3307
|
+
|
3308
|
+
# Sets auto-download settings.
|
3309
|
+
#
|
3310
|
+
# @param settings [TD::Types::AutoDownloadSettings] New user auto-download settings.
|
3311
|
+
# @param type [TD::Types::NetworkType] Type of the network for which the new settings are applied.
|
2870
3312
|
# @return [TD::Types::Ok]
|
2871
|
-
def
|
2872
|
-
broadcast('@type'
|
2873
|
-
'
|
2874
|
-
'
|
2875
|
-
|
3313
|
+
def set_auto_download_settings(settings, type)
|
3314
|
+
broadcast('@type' => 'setAutoDownloadSettings',
|
3315
|
+
'settings' => settings,
|
3316
|
+
'type' => type)
|
3317
|
+
end
|
3318
|
+
|
3319
|
+
# Changes the background selected by the user; adds background to the list of installed backgrounds.
|
3320
|
+
#
|
3321
|
+
# @param background [TD::Types::InputBackground] The input background to use, null for solid backgrounds.
|
3322
|
+
# @param type [TD::Types::BackgroundType] Background type; null for default background.
|
3323
|
+
# The method will return error 404 if type is null.
|
3324
|
+
# @param for_dark_theme [Boolean] True, if the background is chosen for dark theme.
|
3325
|
+
# @return [TD::Types::Background]
|
3326
|
+
def set_background(background, type, for_dark_theme)
|
3327
|
+
broadcast('@type' => 'setBackground',
|
3328
|
+
'background' => background,
|
3329
|
+
'type' => type,
|
3330
|
+
'for_dark_theme' => for_dark_theme)
|
2876
3331
|
end
|
2877
3332
|
|
2878
3333
|
# Changes the bio of the current user.
|
@@ -2907,10 +3362,23 @@ module TD::ClientMethods
|
|
2907
3362
|
'client_data' => client_data)
|
2908
3363
|
end
|
2909
3364
|
|
3365
|
+
# Changes information about a chat.
|
3366
|
+
# Available for basic groups, supergroups, and channels.
|
3367
|
+
# Requires can_change_info rights.
|
3368
|
+
#
|
3369
|
+
# @param chat_id [Integer] Identifier of the chat.
|
3370
|
+
# @param description [String] New chat description; 0-255 characters.
|
3371
|
+
# @return [TD::Types::Ok]
|
3372
|
+
def set_chat_description(chat_id, description)
|
3373
|
+
broadcast('@type' => 'setChatDescription',
|
3374
|
+
'chat_id' => chat_id,
|
3375
|
+
'description' => description)
|
3376
|
+
end
|
3377
|
+
|
2910
3378
|
# Changes the draft message in a chat.
|
2911
3379
|
#
|
2912
3380
|
# @param chat_id [Integer] Chat identifier.
|
2913
|
-
# @param draft_message [TD::Types::DraftMessage, nil] New draft message.
|
3381
|
+
# @param draft_message [TD::Types::DraftMessage, nil] New draft message; may be null.
|
2914
3382
|
# @return [TD::Types::Ok]
|
2915
3383
|
def set_chat_draft_message(chat_id, draft_message = nil)
|
2916
3384
|
broadcast('@type' => 'setChatDraftMessage',
|
@@ -2919,7 +3387,7 @@ module TD::ClientMethods
|
|
2919
3387
|
end
|
2920
3388
|
|
2921
3389
|
# Changes the status of a chat member, needs appropriate privileges.
|
2922
|
-
# This function is currently not suitable for adding new members to the chat; instead, use
|
3390
|
+
# This function is currently not suitable for adding new members to the chat; instead, use addChatMember.
|
2923
3391
|
# The chat member status will not be changed until it has been synchronized with the server.
|
2924
3392
|
#
|
2925
3393
|
# @param chat_id [Integer] Chat identifier.
|
@@ -2944,17 +3412,30 @@ module TD::ClientMethods
|
|
2944
3412
|
'notification_settings' => notification_settings)
|
2945
3413
|
end
|
2946
3414
|
|
3415
|
+
# Changes the chat members permissions.
|
3416
|
+
# Supported only for basic groups and supergroups.
|
3417
|
+
# Requires can_restrict_members administrator right.
|
3418
|
+
#
|
3419
|
+
# @param chat_id [Integer] Chat identifier.
|
3420
|
+
# @param permissions [TD::Types::ChatPermissions] New non-administrator members permissions in the chat.
|
3421
|
+
# @return [TD::Types::Ok]
|
3422
|
+
def set_chat_permissions(chat_id, permissions)
|
3423
|
+
broadcast('@type' => 'setChatPermissions',
|
3424
|
+
'chat_id' => chat_id,
|
3425
|
+
'permissions' => permissions)
|
3426
|
+
end
|
3427
|
+
|
2947
3428
|
# Changes the photo of a chat.
|
2948
3429
|
# Supported only for basic groups, supergroups and channels.
|
2949
|
-
# Requires
|
3430
|
+
# Requires can_change_info rights.
|
2950
3431
|
# The photo will not be changed before request to the server has been completed.
|
2951
3432
|
#
|
2952
3433
|
# @param chat_id [Integer] Chat identifier.
|
2953
3434
|
# @param photo [TD::Types::InputFile] New chat photo.
|
2954
|
-
# You can use a zero
|
3435
|
+
# You can use a zero InputFileId to delete the chat photo.
|
2955
3436
|
# Files that are accessible only by HTTP URL are not acceptable.
|
2956
3437
|
# @return [TD::Types::Ok]
|
2957
|
-
def set_chat_photo(chat_id, photo
|
3438
|
+
def set_chat_photo(chat_id, photo)
|
2958
3439
|
broadcast('@type' => 'setChatPhoto',
|
2959
3440
|
'chat_id' => chat_id,
|
2960
3441
|
'photo' => photo)
|
@@ -2962,11 +3443,11 @@ module TD::ClientMethods
|
|
2962
3443
|
|
2963
3444
|
# Changes the chat title.
|
2964
3445
|
# Supported only for basic groups, supergroups and channels.
|
2965
|
-
# Requires
|
3446
|
+
# Requires can_change_info rights.
|
2966
3447
|
# The title will not be changed until the request to the server has been completed.
|
2967
3448
|
#
|
2968
3449
|
# @param chat_id [Integer] Chat identifier.
|
2969
|
-
# @param title [String] New title of the chat; 1-
|
3450
|
+
# @param title [String] New title of the chat; 1-128 characters.
|
2970
3451
|
# @return [TD::Types::Ok]
|
2971
3452
|
def set_chat_title(chat_id, title)
|
2972
3453
|
broadcast('@type' => 'setChatTitle',
|
@@ -2974,11 +3455,12 @@ module TD::ClientMethods
|
|
2974
3455
|
'title' => title)
|
2975
3456
|
end
|
2976
3457
|
|
2977
|
-
# Adds or changes a custom language pack to the current localization target.
|
3458
|
+
# Adds or changes a custom local language pack to the current localization target.
|
2978
3459
|
#
|
2979
3460
|
# @param info [TD::Types::LanguagePackInfo] Information about the language pack.
|
2980
3461
|
# Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64
|
2981
3462
|
# characters.
|
3463
|
+
# Can be called before authorization.
|
2982
3464
|
# @param strings [Array<TD::Types::LanguagePackString>] Strings of the new language pack.
|
2983
3465
|
# @return [TD::Types::Ok]
|
2984
3466
|
def set_custom_language_pack(info, strings)
|
@@ -2987,10 +3469,11 @@ module TD::ClientMethods
|
|
2987
3469
|
'strings' => strings)
|
2988
3470
|
end
|
2989
3471
|
|
2990
|
-
# Adds, edits or deletes a string in a custom language pack.
|
3472
|
+
# Adds, edits or deletes a string in a custom local language pack.
|
3473
|
+
# Can be called before authorization.
|
2991
3474
|
#
|
2992
|
-
# @param language_pack_id [String] Identifier of a previously added custom language pack in the current
|
2993
|
-
# target.
|
3475
|
+
# @param language_pack_id [String] Identifier of a previously added custom local language pack in the current
|
3476
|
+
# localization target.
|
2994
3477
|
# @param new_string [TD::Types::LanguagePackString] New language pack string.
|
2995
3478
|
# @return [TD::Types::Ok]
|
2996
3479
|
def set_custom_language_pack_string(language_pack_id, new_string)
|
@@ -3009,13 +3492,13 @@ module TD::ClientMethods
|
|
3009
3492
|
'new_encryption_key' => new_encryption_key)
|
3010
3493
|
end
|
3011
3494
|
|
3012
|
-
#
|
3495
|
+
# Informs TDLib on a file generation prograss.
|
3013
3496
|
#
|
3014
3497
|
# @param generation_id [Integer] The identifier of the generation process.
|
3015
3498
|
# @param expected_size [Integer] Expected size of the generated file, in bytes; 0 if unknown.
|
3016
3499
|
# @param local_prefix_size [Integer] The number of bytes already generated.
|
3017
3500
|
# @return [TD::Types::Ok]
|
3018
|
-
def set_file_generation_progress(generation_id,
|
3501
|
+
def set_file_generation_progress(generation_id, expected_size, local_prefix_size)
|
3019
3502
|
broadcast('@type' => 'setFileGenerationProgress',
|
3020
3503
|
'generation_id' => generation_id,
|
3021
3504
|
'expected_size' => expected_size,
|
@@ -3024,7 +3507,7 @@ module TD::ClientMethods
|
|
3024
3507
|
|
3025
3508
|
# Updates the game score of the specified user in the game; for bots only.
|
3026
3509
|
#
|
3027
|
-
# @param chat_id [Integer] The chat to which the message with the game.
|
3510
|
+
# @param chat_id [Integer] The chat to which the message with the game belongs.
|
3028
3511
|
# @param message_id [Integer] Identifier of the message.
|
3029
3512
|
# @param edit_message [Boolean] True, if the message should be edited.
|
3030
3513
|
# @param user_id [Integer] User identifier.
|
@@ -3032,7 +3515,7 @@ module TD::ClientMethods
|
|
3032
3515
|
# @param force [Boolean] Pass true to update the score even if it decreases.
|
3033
3516
|
# If the score is 0, the user will be deleted from the high score table.
|
3034
3517
|
# @return [TD::Types::Message]
|
3035
|
-
def set_game_score(chat_id, message_id, user_id, score,
|
3518
|
+
def set_game_score(chat_id, message_id, edit_message, user_id, score, force)
|
3036
3519
|
broadcast('@type' => 'setGameScore',
|
3037
3520
|
'chat_id' => chat_id,
|
3038
3521
|
'message_id' => message_id,
|
@@ -3051,7 +3534,7 @@ module TD::ClientMethods
|
|
3051
3534
|
# @param force [Boolean] Pass true to update the score even if it decreases.
|
3052
3535
|
# If the score is 0, the user will be deleted from the high score table.
|
3053
3536
|
# @return [TD::Types::Ok]
|
3054
|
-
def set_inline_game_score(inline_message_id, user_id, score,
|
3537
|
+
def set_inline_game_score(inline_message_id, edit_message, user_id, score, force)
|
3055
3538
|
broadcast('@type' => 'setInlineGameScore',
|
3056
3539
|
'inline_message_id' => inline_message_id,
|
3057
3540
|
'edit_message' => edit_message,
|
@@ -3060,11 +3543,52 @@ module TD::ClientMethods
|
|
3060
3543
|
'force' => force)
|
3061
3544
|
end
|
3062
3545
|
|
3546
|
+
# Sets new log stream for internal logging of TDLib.
|
3547
|
+
# This is an offline method.
|
3548
|
+
# Can be called before authorization.
|
3549
|
+
# Can be called synchronously.
|
3550
|
+
#
|
3551
|
+
# @param log_stream [TD::Types::LogStream] New log stream.
|
3552
|
+
# @return [TD::Types::Ok]
|
3553
|
+
def set_log_stream(log_stream)
|
3554
|
+
broadcast('@type' => 'setLogStream',
|
3555
|
+
'log_stream' => log_stream)
|
3556
|
+
end
|
3557
|
+
|
3558
|
+
# Sets the verbosity level for a specified TDLib internal log tag.
|
3559
|
+
# This is an offline method.
|
3560
|
+
# Can be called before authorization.
|
3561
|
+
# Can be called synchronously.
|
3562
|
+
#
|
3563
|
+
# @param tag [String] Logging tag to change verbosity level.
|
3564
|
+
# @param new_verbosity_level [Integer] New verbosity level; 1-1024.
|
3565
|
+
# @return [TD::Types::Ok]
|
3566
|
+
def set_log_tag_verbosity_level(tag, new_verbosity_level)
|
3567
|
+
broadcast('@type' => 'setLogTagVerbosityLevel',
|
3568
|
+
'tag' => tag,
|
3569
|
+
'new_verbosity_level' => new_verbosity_level)
|
3570
|
+
end
|
3571
|
+
|
3572
|
+
# Sets the verbosity level of the internal logging of TDLib.
|
3573
|
+
# This is an offline method.
|
3574
|
+
# Can be called before authorization.
|
3575
|
+
# Can be called synchronously.
|
3576
|
+
#
|
3577
|
+
# @param new_verbosity_level [Integer] New value of the verbosity level for logging.
|
3578
|
+
# Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug
|
3579
|
+
# warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug,
|
3580
|
+
# value greater than 5 and up to 1023 can be used to enable even more logging.
|
3581
|
+
# @return [TD::Types::Ok]
|
3582
|
+
def set_log_verbosity_level(new_verbosity_level)
|
3583
|
+
broadcast('@type' => 'setLogVerbosityLevel',
|
3584
|
+
'new_verbosity_level' => new_verbosity_level)
|
3585
|
+
end
|
3586
|
+
|
3063
3587
|
# Changes the first and last name of the current user.
|
3064
|
-
# If something changes,
|
3588
|
+
# If something changes, updateUser will be sent.
|
3065
3589
|
#
|
3066
|
-
# @param first_name [String] The new value of the first name for the user; 1-
|
3067
|
-
# @param last_name [String] The new value of the optional last name for the user; 0-
|
3590
|
+
# @param first_name [String] The new value of the first name for the user; 1-64 characters.
|
3591
|
+
# @param last_name [String] The new value of the optional last name for the user; 0-64 characters.
|
3068
3592
|
# @return [TD::Types::Ok]
|
3069
3593
|
def set_name(first_name, last_name)
|
3070
3594
|
broadcast('@type' => 'setName',
|
@@ -3080,20 +3604,19 @@ module TD::ClientMethods
|
|
3080
3604
|
# network data usage statistics.
|
3081
3605
|
#
|
3082
3606
|
# @param type [TD::Types::NetworkType] The new network type.
|
3083
|
-
# By default,
|
3607
|
+
# By default, networkTypeOther.
|
3084
3608
|
# @return [TD::Types::Ok]
|
3085
|
-
def set_network_type(type
|
3609
|
+
def set_network_type(type)
|
3086
3610
|
broadcast('@type' => 'setNetworkType',
|
3087
3611
|
'type' => type)
|
3088
3612
|
end
|
3089
3613
|
|
3090
3614
|
# Sets the value of an option.
|
3091
|
-
# Only writable options can be set.
|
3615
|
+
# (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set.
|
3092
3616
|
# Can be called before authorization.
|
3093
3617
|
#
|
3094
3618
|
# @param name [String] The name of the option.
|
3095
3619
|
# @param value [TD::Types::OptionValue] The new value of the option.
|
3096
|
-
# @see https://core.telegram.org/tdlib/options List of available options
|
3097
3620
|
# @return [TD::Types::Ok]
|
3098
3621
|
def set_option(name, value)
|
3099
3622
|
broadcast('@type' => 'setOption',
|
@@ -3127,16 +3650,14 @@ module TD::ClientMethods
|
|
3127
3650
|
end
|
3128
3651
|
|
3129
3652
|
# Changes the password for the user.
|
3130
|
-
# If a new recovery email address is specified, then the
|
3131
|
-
#
|
3132
|
-
# The application should periodically call {#get_password_state} to check whether the new email address has been
|
3133
|
-
# confirmed.
|
3653
|
+
# If a new recovery email address is specified, then the change will not be applied until the new recovery email
|
3654
|
+
# address is confirmed.
|
3134
3655
|
#
|
3135
3656
|
# @param old_password [String] Previous password of the user.
|
3136
3657
|
# @param new_password [String, nil] New password of the user; may be empty to remove the password.
|
3137
|
-
# @param new_hint [String, nil] New password hint.
|
3658
|
+
# @param new_hint [String, nil] New password hint; may be empty.
|
3138
3659
|
# @param set_recovery_email_address [Boolean] Pass true if the recovery email address should be changed.
|
3139
|
-
# @param new_recovery_email_address [String, nil] New recovery email address.
|
3660
|
+
# @param new_recovery_email_address [String, nil] New recovery email address; may be empty.
|
3140
3661
|
# @return [TD::Types::PasswordState]
|
3141
3662
|
def set_password(old_password, new_password: nil, new_hint: nil, set_recovery_email_address: false,
|
3142
3663
|
new_recovery_email_address: nil)
|
@@ -3157,8 +3678,22 @@ module TD::ClientMethods
|
|
3157
3678
|
'chat_ids' => chat_ids)
|
3158
3679
|
end
|
3159
3680
|
|
3681
|
+
# Changes user answer to a poll.
|
3682
|
+
#
|
3683
|
+
# @param chat_id [Integer] Identifier of the chat to which the poll belongs.
|
3684
|
+
# @param message_id [Integer] Identifier of the message containing the poll.
|
3685
|
+
# @param option_ids [Array<Integer>] 0-based identifiers of options, chosen by the user.
|
3686
|
+
# Currently user can't choose more than 1 option.
|
3687
|
+
# @return [TD::Types::Ok]
|
3688
|
+
def set_poll_answer(chat_id, message_id, option_ids)
|
3689
|
+
broadcast('@type' => 'setPollAnswer',
|
3690
|
+
'chat_id' => chat_id,
|
3691
|
+
'message_id' => message_id,
|
3692
|
+
'option_ids' => option_ids)
|
3693
|
+
end
|
3694
|
+
|
3160
3695
|
# Uploads a new profile photo for the current user.
|
3161
|
-
# If something changes,
|
3696
|
+
# If something changes, updateUser will be sent.
|
3162
3697
|
#
|
3163
3698
|
# @param photo [TD::Types::InputFile] Profile photo to set.
|
3164
3699
|
# {TD::Types::InputFile::Id} and {TD::Types::InputFile::Remote} may still be unsupported.
|
@@ -3168,18 +3703,16 @@ module TD::ClientMethods
|
|
3168
3703
|
'photo' => photo)
|
3169
3704
|
end
|
3170
3705
|
|
3171
|
-
# Changes the recovery email address of the user.
|
3172
|
-
# If a new recovery email address is specified, then the
|
3173
|
-
#
|
3174
|
-
# The application should periodically call {#get_password_state} to check whether the email address has been
|
3175
|
-
# confirmed.
|
3706
|
+
# Changes the 2-step verification recovery email address of the user.
|
3707
|
+
# If a new recovery email address is specified, then the change will not be applied until the new recovery email
|
3708
|
+
# address is confirmed.
|
3176
3709
|
# If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds
|
3177
3710
|
# immediately and aborts all other requests waiting for an email confirmation.
|
3178
3711
|
#
|
3179
3712
|
# @param password [String] Password of the current user.
|
3180
3713
|
# @param new_recovery_email_address [String] New recovery email address.
|
3181
3714
|
# @return [TD::Types::PasswordState]
|
3182
|
-
def set_recovery_email_address(
|
3715
|
+
def set_recovery_email_address(password, new_recovery_email_address)
|
3183
3716
|
broadcast('@type' => 'setRecoveryEmailAddress',
|
3184
3717
|
'password' => password,
|
3185
3718
|
'new_recovery_email_address' => new_recovery_email_address)
|
@@ -3209,24 +3742,13 @@ module TD::ClientMethods
|
|
3209
3742
|
'position' => position)
|
3210
3743
|
end
|
3211
3744
|
|
3212
|
-
# Changes
|
3213
|
-
#
|
3214
|
-
# @param supergroup_id [Integer] Identifier of the supergroup or channel.
|
3215
|
-
# @param description [String] New supergroup or channel description; 0-255 characters.
|
3216
|
-
# @return [TD::Types::Ok]
|
3217
|
-
def set_supergroup_description(supergroup_id, description)
|
3218
|
-
broadcast('@type' => 'setSupergroupDescription',
|
3219
|
-
'supergroup_id' => supergroup_id,
|
3220
|
-
'description' => description)
|
3221
|
-
end
|
3222
|
-
|
3223
|
-
# Changes the sticker set of a supergroup; requires appropriate rights in the supergroup.
|
3745
|
+
# Changes the sticker set of a supergroup; requires can_change_info rights.
|
3224
3746
|
#
|
3225
3747
|
# @param supergroup_id [Integer] Identifier of the supergroup.
|
3226
3748
|
# @param sticker_set_id [Integer] New value of the supergroup sticker set identifier.
|
3227
3749
|
# Use 0 to remove the supergroup sticker set.
|
3228
3750
|
# @return [TD::Types::Ok]
|
3229
|
-
def set_supergroup_sticker_set(supergroup_id, sticker_set_id
|
3751
|
+
def set_supergroup_sticker_set(supergroup_id, sticker_set_id)
|
3230
3752
|
broadcast('@type' => 'setSupergroupStickerSet',
|
3231
3753
|
'supergroup_id' => supergroup_id,
|
3232
3754
|
'sticker_set_id' => sticker_set_id)
|
@@ -3238,14 +3760,14 @@ module TD::ClientMethods
|
|
3238
3760
|
# @param username [String] New value of the username.
|
3239
3761
|
# Use an empty string to remove the username.
|
3240
3762
|
# @return [TD::Types::Ok]
|
3241
|
-
def set_supergroup_username(supergroup_id, username
|
3763
|
+
def set_supergroup_username(supergroup_id, username)
|
3242
3764
|
broadcast('@type' => 'setSupergroupUsername',
|
3243
3765
|
'supergroup_id' => supergroup_id,
|
3244
3766
|
'username' => username)
|
3245
3767
|
end
|
3246
3768
|
|
3247
3769
|
# Sets the parameters for TDLib initialization.
|
3248
|
-
# Works only when the current authorization state is
|
3770
|
+
# Works only when the current authorization state is authorizationStateWaitTdlibParameters.
|
3249
3771
|
#
|
3250
3772
|
# @param parameters [TD::Types::TdlibParameters] Parameters.
|
3251
3773
|
# @return [TD::Types::Ok]
|
@@ -3266,16 +3788,41 @@ module TD::ClientMethods
|
|
3266
3788
|
end
|
3267
3789
|
|
3268
3790
|
# Changes the username of the current user.
|
3269
|
-
# If something changes,
|
3791
|
+
# If something changes, updateUser will be sent.
|
3270
3792
|
#
|
3271
3793
|
# @param username [String] The new value of the username.
|
3272
3794
|
# Use an empty string to remove the username.
|
3273
3795
|
# @return [TD::Types::Ok]
|
3274
|
-
def set_username(username
|
3796
|
+
def set_username(username)
|
3275
3797
|
broadcast('@type' => 'setUsername',
|
3276
3798
|
'username' => username)
|
3277
3799
|
end
|
3278
3800
|
|
3801
|
+
# Stops a poll.
|
3802
|
+
# A poll in a message can be stopped when the message has can_be_edited flag set.
|
3803
|
+
#
|
3804
|
+
# @param chat_id [Integer] Identifier of the chat to which the poll belongs.
|
3805
|
+
# @param message_id [Integer] Identifier of the message containing the poll.
|
3806
|
+
# @param reply_markup [TD::Types::ReplyMarkup] The new message reply markup; for bots only.
|
3807
|
+
# @return [TD::Types::Ok]
|
3808
|
+
def stop_poll(chat_id, message_id, reply_markup)
|
3809
|
+
broadcast('@type' => 'stopPoll',
|
3810
|
+
'chat_id' => chat_id,
|
3811
|
+
'message_id' => message_id,
|
3812
|
+
'reply_markup' => reply_markup)
|
3813
|
+
end
|
3814
|
+
|
3815
|
+
# Fetches the latest versions of all strings from a language pack in the current localization target from the server.
|
3816
|
+
# This method doesn't need to be called explicitly for the current used/base language packs.
|
3817
|
+
# Can be called before authorization.
|
3818
|
+
#
|
3819
|
+
# @param language_pack_id [String] Language pack identifier.
|
3820
|
+
# @return [TD::Types::Ok]
|
3821
|
+
def synchronize_language_pack(language_pack_id)
|
3822
|
+
broadcast('@type' => 'synchronizeLanguagePack',
|
3823
|
+
'language_pack_id' => language_pack_id)
|
3824
|
+
end
|
3825
|
+
|
3279
3826
|
# Terminates all other sessions of the current user.
|
3280
3827
|
#
|
3281
3828
|
# @return [TD::Types::Ok]
|
@@ -3292,17 +3839,6 @@ module TD::ClientMethods
|
|
3292
3839
|
'session_id' => session_id)
|
3293
3840
|
end
|
3294
3841
|
|
3295
|
-
# Toggles the "All members are admins" setting in basic groups; requires creator privileges in the group.
|
3296
|
-
#
|
3297
|
-
# @param basic_group_id [Integer] Identifier of the basic group.
|
3298
|
-
# @param everyone_is_administrator [Boolean] New value of everyone_is_administrator.
|
3299
|
-
# @return [TD::Types::Ok]
|
3300
|
-
def toggle_basic_group_administrators(basic_group_id, everyone_is_administrator)
|
3301
|
-
broadcast('@type' => 'toggleBasicGroupAdministrators',
|
3302
|
-
'basic_group_id' => basic_group_id,
|
3303
|
-
'everyone_is_administrator' => everyone_is_administrator)
|
3304
|
-
end
|
3305
|
-
|
3306
3842
|
# Changes the value of the default disable_notification parameter, used when a message is sent to a chat.
|
3307
3843
|
#
|
3308
3844
|
# @param chat_id [Integer] Chat identifier.
|
@@ -3337,20 +3873,7 @@ module TD::ClientMethods
|
|
3337
3873
|
'is_pinned' => is_pinned)
|
3338
3874
|
end
|
3339
3875
|
|
3340
|
-
# Toggles whether
|
3341
|
-
# supergroup.
|
3342
|
-
#
|
3343
|
-
# @param supergroup_id [Integer] Identifier of the supergroup.
|
3344
|
-
# @param anyone_can_invite [Boolean] New value of anyone_can_invite.
|
3345
|
-
# @return [TD::Types::Ok]
|
3346
|
-
def toggle_supergroup_invites(supergroup_id, anyone_can_invite)
|
3347
|
-
broadcast('@type' => 'toggleSupergroupInvites',
|
3348
|
-
'supergroup_id' => supergroup_id,
|
3349
|
-
'anyone_can_invite' => anyone_can_invite)
|
3350
|
-
end
|
3351
|
-
|
3352
|
-
# Toggles whether the message history of a supergroup is available to new members; requires appropriate administrator
|
3353
|
-
# rights in the supergroup.
|
3876
|
+
# Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights.
|
3354
3877
|
#
|
3355
3878
|
# @param supergroup_id [Integer] The identifier of the supergroup.
|
3356
3879
|
# @param is_all_history_available [Boolean] The new value of is_all_history_available.
|
@@ -3361,7 +3884,7 @@ module TD::ClientMethods
|
|
3361
3884
|
'is_all_history_available' => is_all_history_available)
|
3362
3885
|
end
|
3363
3886
|
|
3364
|
-
# Toggles sender signatures messages sent in a channel; requires
|
3887
|
+
# Toggles sender signatures messages sent in a channel; requires can_change_info rights.
|
3365
3888
|
#
|
3366
3889
|
# @param supergroup_id [Integer] Identifier of the channel.
|
3367
3890
|
# @param sign_messages [Boolean] New value of sign_messages.
|
@@ -3381,18 +3904,17 @@ module TD::ClientMethods
|
|
3381
3904
|
'user_id' => user_id)
|
3382
3905
|
end
|
3383
3906
|
|
3384
|
-
# Removes the pinned message from a
|
3385
|
-
# supergroup or channel.
|
3907
|
+
# Removes the pinned message from a chat; requires can_pin_messages rights in the group or channel.
|
3386
3908
|
#
|
3387
|
-
# @param
|
3909
|
+
# @param chat_id [Integer] Identifier of the chat.
|
3388
3910
|
# @return [TD::Types::Ok]
|
3389
|
-
def
|
3390
|
-
broadcast('@type'
|
3391
|
-
'
|
3911
|
+
def unpin_chat_message(chat_id)
|
3912
|
+
broadcast('@type' => 'unpinChatMessage',
|
3913
|
+
'chat_id' => chat_id)
|
3392
3914
|
end
|
3393
3915
|
|
3394
|
-
# Creates a new supergroup from an existing basic group and sends a corresponding
|
3395
|
-
#
|
3916
|
+
# Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and
|
3917
|
+
# messageChatUpgradeFrom; requires creator privileges.
|
3396
3918
|
# Deactivates the original basic group.
|
3397
3919
|
#
|
3398
3920
|
# @param chat_id [Integer] Identifier of the chat to upgrade.
|
@@ -3403,29 +3925,29 @@ module TD::ClientMethods
|
|
3403
3925
|
end
|
3404
3926
|
|
3405
3927
|
# Asynchronously uploads a file to the cloud without sending it in a message.
|
3406
|
-
#
|
3928
|
+
# updateFile will be used to notify about upload progress and successful completion of the upload.
|
3407
3929
|
# The file will not have a persistent remote identifier until it will be sent in a message.
|
3408
3930
|
#
|
3409
3931
|
# @param file [TD::Types::InputFile] File to upload.
|
3410
3932
|
# @param file_type [TD::Types::FileType] File type.
|
3411
3933
|
# @param priority [Integer] Priority of the upload (1-32).
|
3412
3934
|
# The higher the priority, the earlier the file will be uploaded.
|
3413
|
-
# If the priorities of two files are equal, then the first one for which
|
3935
|
+
# If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded
|
3414
3936
|
# first.
|
3415
3937
|
# @return [TD::Types::File]
|
3416
|
-
def upload_file(file, file_type, priority
|
3938
|
+
def upload_file(file, file_type, priority)
|
3417
3939
|
broadcast('@type' => 'uploadFile',
|
3418
3940
|
'file' => file,
|
3419
3941
|
'file_type' => file_type,
|
3420
3942
|
'priority' => priority)
|
3421
3943
|
end
|
3422
3944
|
|
3423
|
-
# Uploads a PNG image with a sticker; for bots only
|
3945
|
+
# Uploads a PNG image with a sticker; for bots only; returns the uploaded file.
|
3424
3946
|
#
|
3425
3947
|
# @param user_id [Integer] Sticker file owner.
|
3426
3948
|
# @param png_sticker [TD::Types::InputFile] PNG image with the sticker; must be up to 512 kB in size and fit in
|
3427
3949
|
# 512x512 square.
|
3428
|
-
# @return [TD::Types::File]
|
3950
|
+
# @return [TD::Types::File]
|
3429
3951
|
def upload_sticker_file(user_id, png_sticker)
|
3430
3952
|
broadcast('@type' => 'uploadStickerFile',
|
3431
3953
|
'user_id' => user_id,
|
@@ -3440,7 +3962,7 @@ module TD::ClientMethods
|
|
3440
3962
|
# @param order_info [TD::Types::OrderInfo] The order information, provided by the user.
|
3441
3963
|
# @param allow_save [Boolean] True, if the order information can be saved.
|
3442
3964
|
# @return [TD::Types::ValidatedOrderInfo]
|
3443
|
-
def validate_order_info(chat_id, message_id, order_info, allow_save
|
3965
|
+
def validate_order_info(chat_id, message_id, order_info, allow_save)
|
3444
3966
|
broadcast('@type' => 'validateOrderInfo',
|
3445
3967
|
'chat_id' => chat_id,
|
3446
3968
|
'message_id' => message_id,
|
@@ -3448,7 +3970,7 @@ module TD::ClientMethods
|
|
3448
3970
|
'allow_save' => allow_save)
|
3449
3971
|
end
|
3450
3972
|
|
3451
|
-
#
|
3973
|
+
# Informs TDLib that messages are being viewed by the user.
|
3452
3974
|
# Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as
|
3453
3975
|
# read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels).
|
3454
3976
|
#
|
@@ -3456,7 +3978,7 @@ module TD::ClientMethods
|
|
3456
3978
|
# @param message_ids [Array<Integer>] The identifiers of the messages being viewed.
|
3457
3979
|
# @param force_read [Boolean] True, if messages in closed chats should be marked as read.
|
3458
3980
|
# @return [TD::Types::Ok]
|
3459
|
-
def view_messages(chat_id, message_ids, force_read
|
3981
|
+
def view_messages(chat_id, message_ids, force_read)
|
3460
3982
|
broadcast('@type' => 'viewMessages',
|
3461
3983
|
'chat_id' => chat_id,
|
3462
3984
|
'message_ids' => message_ids,
|
@@ -3471,4 +3993,19 @@ module TD::ClientMethods
|
|
3471
3993
|
broadcast('@type' => 'viewTrendingStickerSets',
|
3472
3994
|
'sticker_set_ids' => sticker_set_ids)
|
3473
3995
|
end
|
3996
|
+
|
3997
|
+
# Writes a part of a generated file.
|
3998
|
+
# This method is intended to be used only if the client has no direct access to TDLib's file system, because it is
|
3999
|
+
# usually slower than a direct write to the destination file.
|
4000
|
+
#
|
4001
|
+
# @param generation_id [Integer] The identifier of the generation process.
|
4002
|
+
# @param offset [Integer] The offset from which to write the data to the file.
|
4003
|
+
# @param data [String] The data to write.
|
4004
|
+
# @return [TD::Types::Ok]
|
4005
|
+
def write_generated_file_part(generation_id, offset, data)
|
4006
|
+
broadcast('@type' => 'writeGeneratedFilePart',
|
4007
|
+
'generation_id' => generation_id,
|
4008
|
+
'offset' => offset,
|
4009
|
+
'data' => data)
|
4010
|
+
end
|
3474
4011
|
end
|