tdlib-ruby 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/README.md +2 -1
  4. data/bin/parser +2 -3
  5. data/lib/tdlib/client_methods.rb +341 -108
  6. data/lib/tdlib/types.rb +69 -9
  7. data/lib/tdlib/types/audio.rb +1 -1
  8. data/lib/tdlib/types/authorization_state.rb +1 -0
  9. data/lib/tdlib/types/authorization_state/wait_other_device_confirmation.rb +9 -0
  10. data/lib/tdlib/types/authorization_state/wait_phone_number.rb +2 -0
  11. data/lib/tdlib/types/auto_download_settings.rb +5 -3
  12. data/lib/tdlib/types/background.rb +1 -1
  13. data/lib/tdlib/types/background_fill.rb +11 -0
  14. data/lib/tdlib/types/background_fill/gradient.rb +13 -0
  15. data/lib/tdlib/types/background_fill/solid.rb +8 -0
  16. data/lib/tdlib/types/background_type.rb +1 -1
  17. data/lib/tdlib/types/background_type/fill.rb +8 -0
  18. data/lib/tdlib/types/background_type/pattern.rb +7 -6
  19. data/lib/tdlib/types/background_type/wallpaper.rb +1 -1
  20. data/lib/tdlib/types/base.rb +1 -1
  21. data/lib/tdlib/types/basic_group_full_info.rb +2 -2
  22. data/lib/tdlib/types/call_protocol.rb +2 -2
  23. data/lib/tdlib/types/can_transfer_ownership_result.rb +13 -0
  24. data/lib/tdlib/types/can_transfer_ownership_result/ok.rb +5 -0
  25. data/lib/tdlib/types/can_transfer_ownership_result/password_needed.rb +5 -0
  26. data/lib/tdlib/types/can_transfer_ownership_result/password_too_fresh.rb +8 -0
  27. data/lib/tdlib/types/can_transfer_ownership_result/session_too_fresh.rb +8 -0
  28. data/lib/tdlib/types/chat.rb +9 -2
  29. data/lib/tdlib/types/chat_action_bar.rb +14 -0
  30. data/lib/tdlib/types/chat_action_bar/add_contact.rb +6 -0
  31. data/lib/tdlib/types/chat_action_bar/report_add_block.rb +6 -0
  32. data/lib/tdlib/types/chat_action_bar/report_spam.rb +5 -0
  33. data/lib/tdlib/types/chat_action_bar/report_unrelated_location.rb +6 -0
  34. data/lib/tdlib/types/chat_action_bar/share_phone_number.rb +6 -0
  35. data/lib/tdlib/types/chat_administrator.rb +12 -0
  36. data/lib/tdlib/types/chat_administrators.rb +8 -0
  37. data/lib/tdlib/types/chat_event_action.rb +3 -0
  38. data/lib/tdlib/types/chat_event_action/linked_chat_changed.rb +10 -0
  39. data/lib/tdlib/types/chat_event_action/location_changed.rb +10 -0
  40. data/lib/tdlib/types/chat_event_action/slow_mode_delay_changed.rb +10 -0
  41. data/lib/tdlib/types/chat_invite_link_info.rb +2 -1
  42. data/lib/tdlib/types/chat_list.rb +11 -0
  43. data/lib/tdlib/types/chat_list/archive.rb +6 -0
  44. data/lib/tdlib/types/chat_list/main.rb +5 -0
  45. data/lib/tdlib/types/chat_location.rb +10 -0
  46. data/lib/tdlib/types/chat_member_status/administrator.rb +4 -1
  47. data/lib/tdlib/types/chat_member_status/creator.rb +4 -1
  48. data/lib/tdlib/types/chat_members_filter/administrators.rb +1 -1
  49. data/lib/tdlib/types/chat_nearby.rb +10 -0
  50. data/lib/tdlib/types/chat_report_reason.rb +1 -0
  51. data/lib/tdlib/types/chat_report_reason/unrelated_location.rb +5 -0
  52. data/lib/tdlib/types/chats_nearby.rb +10 -0
  53. data/lib/tdlib/types/formatted_text.rb +4 -0
  54. data/lib/tdlib/types/inline_keyboard_button_type/login_url.rb +1 -1
  55. data/lib/tdlib/types/input_file/remote.rb +4 -0
  56. data/lib/tdlib/types/input_inline_query_result/sticker.rb +2 -2
  57. data/lib/tdlib/types/input_message_content/text.rb +2 -1
  58. data/lib/tdlib/types/log_stream/file.rb +2 -2
  59. data/lib/tdlib/types/login_url_info.rb +11 -0
  60. data/lib/tdlib/types/login_url_info/open.rb +10 -0
  61. data/lib/tdlib/types/login_url_info/request_confirmation.rb +15 -0
  62. data/lib/tdlib/types/message.rb +7 -1
  63. data/lib/tdlib/types/message_forward_info.rb +5 -5
  64. data/lib/tdlib/types/message_scheduling_state.rb +11 -0
  65. data/lib/tdlib/types/message_scheduling_state/send_at_date.rb +9 -0
  66. data/lib/tdlib/types/message_scheduling_state/send_when_online.rb +6 -0
  67. data/lib/tdlib/types/notification.rb +2 -0
  68. data/lib/tdlib/types/page_block.rb +1 -0
  69. data/lib/tdlib/types/page_block/voice_note.rb +10 -0
  70. data/lib/tdlib/types/page_block_table_cell.rb +3 -2
  71. data/lib/tdlib/types/public_chat_type.rb +11 -0
  72. data/lib/tdlib/types/public_chat_type/has_username.rb +5 -0
  73. data/lib/tdlib/types/public_chat_type/is_location_based.rb +5 -0
  74. data/lib/tdlib/types/public_message_link.rb +1 -1
  75. data/lib/tdlib/types/push_message_content/chat_add_members.rb +1 -1
  76. data/lib/tdlib/types/push_message_content/chat_delete_member.rb +1 -1
  77. data/lib/tdlib/types/remote_file.rb +5 -0
  78. data/lib/tdlib/types/rich_text/strikethrough.rb +1 -1
  79. data/lib/tdlib/types/rich_text/url.rb +2 -0
  80. data/lib/tdlib/types/secret_chat.rb +5 -4
  81. data/lib/tdlib/types/send_message_options.rb +14 -0
  82. data/lib/tdlib/types/supergroup.rb +12 -8
  83. data/lib/tdlib/types/supergroup_full_info.rb +17 -3
  84. data/lib/tdlib/types/supergroup_members_filter/administrators.rb +1 -1
  85. data/lib/tdlib/types/terms_of_service.rb +1 -1
  86. data/lib/tdlib/types/text_entity_type.rb +3 -1
  87. data/lib/tdlib/types/text_entity_type/strikethrough.rb +5 -0
  88. data/lib/tdlib/types/text_entity_type/underline.rb +5 -0
  89. data/lib/tdlib/types/text_parse_mode/markdown.rb +4 -0
  90. data/lib/tdlib/types/ton_lite_server_response.rb +8 -0
  91. data/lib/tdlib/types/ton_wallet_password_salt.rb +8 -0
  92. data/lib/tdlib/types/top_chat_category.rb +1 -0
  93. data/lib/tdlib/types/top_chat_category/forward_chats.rb +5 -0
  94. data/lib/tdlib/types/update.rb +5 -0
  95. data/lib/tdlib/types/update/active_notifications.rb +1 -1
  96. data/lib/tdlib/types/update/chat_action_bar.rb +10 -0
  97. data/lib/tdlib/types/update/chat_chat_list.rb +11 -0
  98. data/lib/tdlib/types/update/chat_has_scheduled_messages.rb +10 -0
  99. data/lib/tdlib/types/update/chat_last_message.rb +1 -1
  100. data/lib/tdlib/types/update/chat_order.rb +2 -1
  101. data/lib/tdlib/types/update/have_pending_notifications.rb +1 -1
  102. data/lib/tdlib/types/update/message_live_location_viewed.rb +11 -0
  103. data/lib/tdlib/types/update/new_callback_query.rb +1 -1
  104. data/lib/tdlib/types/update/unread_chat_count.rb +5 -1
  105. data/lib/tdlib/types/update/unread_message_count.rb +4 -2
  106. data/lib/tdlib/types/update/users_nearby.rb +9 -0
  107. data/lib/tdlib/types/user.rb +7 -10
  108. data/lib/tdlib/types/user_full_info.rb +3 -0
  109. data/lib/tdlib/types/user_privacy_setting.rb +2 -0
  110. data/lib/tdlib/types/user_privacy_setting/allow_finding_by_phone_number.rb +7 -0
  111. data/lib/tdlib/types/user_privacy_setting/show_phone_number.rb +5 -0
  112. data/lib/tdlib/types/user_privacy_setting_rule.rb +2 -0
  113. data/lib/tdlib/types/user_privacy_setting_rule/allow_chat_members.rb +8 -0
  114. data/lib/tdlib/types/user_privacy_setting_rule/allow_users.rb +1 -1
  115. data/lib/tdlib/types/user_privacy_setting_rule/restrict_chat_members.rb +8 -0
  116. data/lib/tdlib/types/user_privacy_setting_rule/restrict_users.rb +1 -1
  117. data/lib/tdlib/types/user_type/deleted.rb +1 -1
  118. data/lib/tdlib/types/user_type/unknown.rb +1 -1
  119. data/lib/tdlib/types/video.rb +1 -1
  120. data/lib/tdlib/version.rb +1 -1
  121. data/tdlib-ruby.gemspec +6 -6
  122. metadata +68 -21
  123. data/lib/tdlib/types/background_type/solid.rb +0 -8
  124. data/lib/tdlib/types/chat_report_spam_state.rb +0 -8
  125. data/lib/tdlib/types/link_state.rb +0 -13
  126. data/lib/tdlib/types/link_state/is_contact.rb +0 -5
  127. data/lib/tdlib/types/link_state/knows_phone_number.rb +0 -5
  128. data/lib/tdlib/types/link_state/none.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 549e36683b58bc5f2ab9ac8de4c50104f4abc1ab21a0a5a6777b130c0ebd80b9
4
- data.tar.gz: ababc856edc0046ddefd04e5b2582de902dfb53d0e91c9e2f69967afa9250a4b
3
+ metadata.gz: b9e176529fc658fb3f1cdd453eb43068742468a2964fbc4ce78183ab9efed5ec
4
+ data.tar.gz: 8d9be756f46a6aa947b5bed03ae5c16d0475f3210492385bea075d2656f6d603
5
5
  SHA512:
6
- metadata.gz: 31fb522fba4b1e17d15d07b00856a034e0a6914fe90ca3d9c6f7e444a6ea66affb5baee25079c81d9372fc1dc01e22e27a284adf51bed49eef7c3ac7202219e9
7
- data.tar.gz: 6fb5e7f76a41a00d55f19c4a63b8adc9fa77d0c41299995278e9ace3b317718819a8f0ccee6351b5a8bd7b4c52108bdc0c3808caec7a228e856c6d3712386d44
6
+ metadata.gz: 2c0775f4e688e10688d34dcc78ec95328770ab7cd3a03349371448f48cf662d8ed30049af41da350943417dfce518c89f6c8fda331fff9d2fd95544707aca968
7
+ data.tar.gz: 53aedc6fd23f9924c2d3c1f09944875817e5ae2d2cb3073531094380b1fa89a1265f14f6ba102a0cb35cc4d8f98865d00a49745f69297b5ffa926f2e4f11b1b4
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.4.9
4
- - 2.6.5
4
+ - 2.7.0
5
5
  addons:
6
6
  apt:
7
7
  sources:
@@ -19,6 +19,7 @@ env:
19
19
  global:
20
20
  secure: DmAoRsr+dTPVNs486nBXzChjzCCVdoxfmSbvqMBBl0v8uuUIZD1rSfYKcEaL5pmE7vgYq3X+3Dk0gf4ef/p2xPVKqFKrkBiF/7t06WgQTH7003gHMLq3aC7R9+1xvqJDzpoc6UB59Y1fOJBe5YfqDuw1dT9a46tzY2uzoVpEpbN8M/hssaKf6Wuzvpz5yekFeXq2raPwi3aOqvkSG+ODoacVdYQgJ4Vn0//CI2HzWijkQCvdsefWQUKkbgtuLWRp3UNy8AEhVWzQnTcSM7oc+MwMsOI/90DZkTP5n2WJl/CFTM5b70VyrIciG92SvTAhhBo/p7t3QBJa6kJMPXAHh5q+3wqVQA411+CoVF48bO5rKjKY3Ply49uqAzVJRh+Tkhf5uC1pHiZ6QKGxu1Czde+mKItBpaDmJFmQi0CSdv2WYXLnJWOQIO6vc2P3liwpMDRDyaGWOQtUYS+gHAlRbD4NPycIkGjkcjmLMqSEEO1TdCpM+CYwTvNTkRS+9HrWXZNdEfWORDYHgYohoIP6kY6XWSgunUb6F6pVxLoPWJNEBEVuIMZeOa/s9oklxBzD5XXIzBx4QsPYanvfxoN1uOcXlBXbOGqwiqb+urokNDw+BzWhbA+xY03U2+yO0Ujh3HQDyMDtrXEQfaPC0SxpEvIINVYwznG4sMKvbOaCVSo=
21
21
  before_install:
22
+ - gem install -v 2.1.2 bundler
22
23
  - set -e
23
24
  - cd td
24
25
  - mkdir -p build
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # tdlib-ruby
2
2
 
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/9362ca2682b7edbae205/maintainability)](https://codeclimate.com/github/centosadmin/tdlib-ruby/maintainability) [![Build Status](https://travis-ci.org/centosadmin/tdlib-ruby.svg?branch=master)](https://travis-ci.org/centosadmin/tdlib-ruby)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/9362ca2682b7edbae205/maintainability)](https://codeclimate.com/github/centosadmin/tdlib-ruby/maintainability) [![Build Status](https://travis-ci.org/southbridgeio/tdlib-ruby.svg?branch=master)](https://travis-ci.org/centosadmin/tdlib-ruby)
4
4
 
5
5
  ## Description
6
6
 
@@ -30,6 +30,7 @@ http://rpms.southbridge.ru/rhel6/stable/SRPMS/
30
30
  | 1.x | → | 1.0 - 1.2 |
31
31
  | 2.0 | → | 1.3 |
32
32
  | 2.1 | → | 1.5 |
33
+ | 2.2 | → | 1.6 |
33
34
 
34
35
  ## Install
35
36
 
data/bin/parser CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- require 'open-uri'
3
2
  require 'active_support/all'
4
3
 
5
4
  AUTOLOAD_BASE_DIR = 'tdlib/types'
6
- TD_API_TL_LOCATION = "https://raw.githubusercontent.com/tdlib/td/v1.5.0/td/generate/scheme/td_api.tl"
5
+ TD_API_TL_LOCATION = 'td/td/generate/scheme/td_api.tl'
7
6
 
8
7
 
9
8
  def parse_tl_type(type)
@@ -221,7 +220,7 @@ klass = <<-RUBY
221
220
  module TD::Types
222
221
  class Base < Dry::Struct
223
222
  # throw an error when unknown keys provided
224
- input input.strict
223
+ schema schema.strict
225
224
 
226
225
  # convert string keys to symbols
227
226
  transform_keys(&:to_sym)
@@ -53,6 +53,22 @@ module TD::ClientMethods
53
53
  'user_ids' => user_ids)
54
54
  end
55
55
 
56
+ # Adds a user to the contact list or edits an existing contact by their user identifier.
57
+ #
58
+ # @param contact [TD::Types::Contact, nil] The contact to add or edit; phone number can be empty and needs to be
59
+ # specified only if known, vCard is ignored.
60
+ # @param share_phone_number [Boolean] True, if the new contact needs to be allowed to see current user's phone
61
+ # number.
62
+ # A corresponding rule to {TD::Types::UserPrivacySetting::ShowPhoneNumber} will be added if needed.
63
+ # Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be
64
+ # asked to share their phone number.
65
+ # @return [TD::Types::Ok]
66
+ def add_contact(contact = nil, share_phone_number)
67
+ broadcast('@type' => 'addContact',
68
+ 'contact' => contact,
69
+ 'share_phone_number' => share_phone_number)
70
+ end
71
+
56
72
  # Adds a custom server language pack to the list of installed language packs in current localization target.
57
73
  # Can be called before authorization.
58
74
  #
@@ -101,7 +117,7 @@ module TD::ClientMethods
101
117
  # Can be called before authorization.
102
118
  # Can be called synchronously.
103
119
  #
104
- # @param verbosity_level [Integer] Minimum verbosity level needed for the message to be logged, 0-1023.
120
+ # @param verbosity_level [Integer] The minimum verbosity level needed for the message to be logged, 0-1023.
105
121
  # @param text [String] Text of a message to log.
106
122
  # @return [TD::Types::Ok]
107
123
  def add_log_message(verbosity_level, text)
@@ -275,6 +291,13 @@ module TD::ClientMethods
275
291
  'user_id' => user_id)
276
292
  end
277
293
 
294
+ # Checks whether the current session can be used to transfer a chat ownership to another user.
295
+ #
296
+ # @return [TD::Types::CanTransferOwnershipResult]
297
+ def can_transfer_ownership
298
+ broadcast('@type' => 'canTransferOwnership')
299
+ end
300
+
278
301
  # Stops the downloading of a file.
279
302
  # If a file has already been downloaded, does nothing.
280
303
  #
@@ -299,19 +322,6 @@ module TD::ClientMethods
299
322
  'file_id' => file_id)
300
323
  end
301
324
 
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.
305
- #
306
- # @param chat_id [Integer] Chat identifier.
307
- # @param is_spam_chat [Boolean] If true, the chat will be reported as spam; otherwise it will be marked as not spam.
308
- # @return [TD::Types::Ok]
309
- def change_chat_report_spam_state(chat_id, is_spam_chat)
310
- broadcast('@type' => 'changeChatReportSpamState',
311
- 'chat_id' => chat_id,
312
- 'is_spam_chat' => is_spam_chat)
313
- end
314
-
315
325
  # Changes imported contacts using the list of current user contacts saved on the device.
316
326
  # Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts.
317
327
  # Query result depends on the result of the previous query, so only one query is possible at the same time.
@@ -413,6 +423,16 @@ module TD::ClientMethods
413
423
  'username' => username)
414
424
  end
415
425
 
426
+ # Checks whether the maximum number of owned public chats has been reached.
427
+ # Returns corresponding error if the limit was reached.
428
+ #
429
+ # @param type [TD::Types::PublicChatType] Type of the public chats, for which to check the limit.
430
+ # @return [TD::Types::Ok]
431
+ def check_created_public_chats_limit(type)
432
+ broadcast('@type' => 'checkCreatedPublicChatsLimit',
433
+ 'type' => type)
434
+ end
435
+
416
436
  # Checks the database encryption key for correctness.
417
437
  # Works only when the current authorization state is authorizationStateWaitEncryptionKey.
418
438
  #
@@ -534,6 +554,17 @@ module TD::ClientMethods
534
554
  'secret_chat_id' => secret_chat_id)
535
555
  end
536
556
 
557
+ # Confirms QR code authentication on another device.
558
+ # Returns created session on success.
559
+ #
560
+ # @param link [String] A link from a QR code.
561
+ # The link must be scanned by the in-app camera.
562
+ # @return [TD::Types::Session]
563
+ def confirm_qr_code_authentication(link)
564
+ broadcast('@type' => 'confirmQrCodeAuthentication',
565
+ 'link' => link)
566
+ end
567
+
537
568
  # Returns an existing chat corresponding to a known basic group.
538
569
  #
539
570
  # @param basic_group_id [Integer] Basic group identifier.
@@ -605,12 +636,14 @@ module TD::ClientMethods
605
636
  # @param title [String] Title of the new chat; 1-128 characters.
606
637
  # @param is_channel [Boolean] True, if a channel chat should be created.
607
638
  # @param description [String] Chat description; 0-255 characters.
639
+ # @param location [TD::Types::ChatLocation] Chat location if a location-based supergroup is being created.
608
640
  # @return [TD::Types::Chat]
609
- def create_new_supergroup_chat(title, is_channel, description)
641
+ def create_new_supergroup_chat(title, is_channel, description, location)
610
642
  broadcast('@type' => 'createNewSupergroupChat',
611
643
  'title' => title,
612
644
  'is_channel' => is_channel,
613
- 'description' => description)
645
+ 'description' => description,
646
+ 'location' => location)
614
647
  end
615
648
 
616
649
  # Returns an existing chat corresponding to a given user.
@@ -685,7 +718,7 @@ module TD::ClientMethods
685
718
  end
686
719
 
687
720
  # Deletes all messages sent by the specified user to a chat.
688
- # Supported only in supergroups; requires can_delete_messages administrator privileges.
721
+ # Supported only for supergroups; requires can_delete_messages administrator privileges.
689
722
  #
690
723
  # @param chat_id [Integer] Chat identifier.
691
724
  # @param user_id [Integer] User identifier.
@@ -778,7 +811,7 @@ module TD::ClientMethods
778
811
  end
779
812
 
780
813
  # Deletes a supergroup or channel along with all messages in the corresponding chat.
781
- # This will release the supergroup or channel username and remove all members; requires creator privileges in the
814
+ # This will release the supergroup or channel username and remove all members; requires owner privileges in the
782
815
  # supergroup or channel.
783
816
  # Chats with more than 1000 members can't be deleted using this method.
784
817
  #
@@ -1011,6 +1044,21 @@ module TD::ClientMethods
1011
1044
  'reply_markup' => reply_markup)
1012
1045
  end
1013
1046
 
1047
+ # Edits the time when a scheduled message will be sent.
1048
+ # Scheduling state of all messages in the same album or forwarded together with the message will be also changed.
1049
+ #
1050
+ # @param chat_id [Integer] The chat the message belongs to.
1051
+ # @param message_id [Integer] Identifier of the message.
1052
+ # @param scheduling_state [TD::Types::MessageSchedulingState] The new message scheduling state.
1053
+ # Pass null to send the message immediately.
1054
+ # @return [TD::Types::Ok]
1055
+ def edit_message_scheduling_state(chat_id, message_id, scheduling_state)
1056
+ broadcast('@type' => 'editMessageSchedulingState',
1057
+ 'chat_id' => chat_id,
1058
+ 'message_id' => message_id,
1059
+ 'scheduling_state' => scheduling_state)
1060
+ end
1061
+
1014
1062
  # Edits the text of a message (or a text of a game message).
1015
1063
  # Returns the edited message after the edit is completed on the server side.
1016
1064
  #
@@ -1075,9 +1123,7 @@ module TD::ClientMethods
1075
1123
  # @param chat_id [Integer] Identifier of the chat to which to forward messages.
1076
1124
  # @param from_chat_id [Integer] Identifier of the chat from which to forward messages.
1077
1125
  # @param message_ids [Array<Integer>] Identifiers of the messages to forward.
1078
- # @param disable_notification [Boolean] Pass true to disable notification for the message, doesn't work if messages
1079
- # are forwarded to a secret chat.
1080
- # @param from_background [Boolean] Pass true if the messages are sent from the background.
1126
+ # @param options [TD::Types::SendMessageOptions] Options to be used to send the messages.
1081
1127
  # @param as_album [Boolean] True, if the messages should be grouped into an album after forwarding.
1082
1128
  # For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages.
1083
1129
  # @param send_copy [Boolean] True, if content of the messages needs to be copied without links to the original
@@ -1086,17 +1132,15 @@ module TD::ClientMethods
1086
1132
  # @param remove_caption [Boolean] True, if media captions of message copies needs to be removed.
1087
1133
  # Ignored if send_copy is false.
1088
1134
  # @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)
1091
- broadcast('@type' => 'forwardMessages',
1092
- 'chat_id' => chat_id,
1093
- 'from_chat_id' => from_chat_id,
1094
- 'message_ids' => message_ids,
1095
- 'disable_notification' => disable_notification,
1096
- 'from_background' => from_background,
1097
- 'as_album' => as_album,
1098
- 'send_copy' => send_copy,
1099
- 'remove_caption' => remove_caption)
1135
+ def forward_messages(chat_id, from_chat_id, message_ids, options, as_album, send_copy, remove_caption)
1136
+ broadcast('@type' => 'forwardMessages',
1137
+ 'chat_id' => chat_id,
1138
+ 'from_chat_id' => from_chat_id,
1139
+ 'message_ids' => message_ids,
1140
+ 'options' => options,
1141
+ 'as_album' => as_album,
1142
+ 'send_copy' => send_copy,
1143
+ 'remove_caption' => remove_caption)
1100
1144
  end
1101
1145
 
1102
1146
  # Generates a new invite link for a chat; the previously generated link is revoked.
@@ -1153,7 +1197,7 @@ module TD::ClientMethods
1153
1197
  #
1154
1198
  # @param is_masks [Boolean] Pass true to return mask stickers sets; pass false to return ordinary sticker sets.
1155
1199
  # @param offset_sticker_set_id [Integer] Identifier of the sticker set from which to return the result.
1156
- # @param limit [Integer] Maximum number of sticker sets to return.
1200
+ # @param limit [Integer] The maximum number of sticker sets to return.
1157
1201
  # @return [TD::Types::StickerSets]
1158
1202
  def get_archived_sticker_sets(is_masks, offset_sticker_set_id, limit)
1159
1203
  broadcast('@type' => 'getArchivedStickerSets',
@@ -1230,7 +1274,7 @@ module TD::ClientMethods
1230
1274
  # Returns users that were blocked by the current user.
1231
1275
  #
1232
1276
  # @param offset [Integer] Number of users to skip in the result; must be non-negative.
1233
- # @param limit [Integer] Maximum number of users to return; up to 100.
1277
+ # @param limit [Integer] The maximum number of users to return; up to 100.
1234
1278
  # @return [TD::Types::Users]
1235
1279
  def get_blocked_users(offset, limit)
1236
1280
  broadcast('@type' => 'getBlockedUsers',
@@ -1261,17 +1305,17 @@ module TD::ClientMethods
1261
1305
  'chat_id' => chat_id)
1262
1306
  end
1263
1307
 
1264
- # Returns a list of users who are administrators of the chat.
1308
+ # Returns a list of administrators of the chat with their custom titles.
1265
1309
  #
1266
1310
  # @param chat_id [Integer] Chat identifier.
1267
- # @return [TD::Types::Users]
1311
+ # @return [TD::Types::ChatAdministrators]
1268
1312
  def get_chat_administrators(chat_id)
1269
1313
  broadcast('@type' => 'getChatAdministrators',
1270
1314
  'chat_id' => chat_id)
1271
1315
  end
1272
1316
 
1273
1317
  # Returns a list of service actions taken by chat members and administrators in the last 48 hours.
1274
- # Available only in supergroups and channels.
1318
+ # Available only for supergroups and channels.
1275
1319
  # Requires administrator rights.
1276
1320
  # Returns results in reverse chronological order (i.
1277
1321
  # e., in order of decreasing event_id).
@@ -1280,7 +1324,7 @@ module TD::ClientMethods
1280
1324
  # @param query [String] Search query by which to filter events.
1281
1325
  # @param from_event_id [Integer] Identifier of an event from which to return results.
1282
1326
  # Use 0 to get results from the latest events.
1283
- # @param limit [Integer] Maximum number of events to return; up to 100.
1327
+ # @param limit [Integer] The maximum number of events to return; up to 100.
1284
1328
  # @param filters [TD::Types::ChatEventLogFilters] The types of events to return.
1285
1329
  # By default, all types will be returned.
1286
1330
  # @param user_ids [Array<Integer>] User identifiers by which to filter events.
@@ -1381,17 +1425,19 @@ module TD::ClientMethods
1381
1425
  'chat_id' => chat_id)
1382
1426
  end
1383
1427
 
1384
- # Returns information on whether the current chat can be reported as spam.
1428
+ # Returns all scheduled messages in a chat.
1429
+ # The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id).
1385
1430
  #
1386
1431
  # @param chat_id [Integer] Chat identifier.
1387
- # @return [TD::Types::ChatReportSpamState]
1388
- def get_chat_report_spam_state(chat_id)
1389
- broadcast('@type' => 'getChatReportSpamState',
1432
+ # @return [TD::Types::Messages]
1433
+ def get_chat_scheduled_messages(chat_id)
1434
+ broadcast('@type' => 'getChatScheduledMessages',
1390
1435
  'chat_id' => chat_id)
1391
1436
  end
1392
1437
 
1393
1438
  # Returns an HTTP URL with the chat statistics.
1394
1439
  # Currently this method can be used only for channels.
1440
+ # Can be used only if SupergroupFullInfo.can_view_statistics == true.
1395
1441
  #
1396
1442
  # @param chat_id [Integer] Chat identifier.
1397
1443
  # @param parameters [String] Parameters from "tg://statsrefresh?params=******" link.
@@ -1404,19 +1450,21 @@ module TD::ClientMethods
1404
1450
  'is_dark' => is_dark)
1405
1451
  end
1406
1452
 
1407
- # Returns an ordered list of chats.
1453
+ # Returns an ordered list of chats in a chat list.
1408
1454
  # Chats are sorted by the pair (order, chat_id) in decreasing order.
1409
1455
  # (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed
1410
1456
  # 64-bit number 9223372036854775807 == 2^63 - 1).
1411
1457
  # For optimal performance the number of returned chats is chosen by the library.
1412
1458
  #
1459
+ # @param chat_list [TD::Types::ChatList] The chat list in which to return chats.
1413
1460
  # @param offset_order [Integer] Chat order to return chats from.
1414
1461
  # @param offset_chat_id [Integer] Chat identifier to return chats from.
1415
1462
  # @param limit [Integer] The maximum number of chats to be returned.
1416
1463
  # It is possible that fewer chats than the limit are returned even if the end of the list is not reached.
1417
1464
  # @return [TD::Types::Chats]
1418
- def get_chats(offset_order, offset_chat_id, limit)
1465
+ def get_chats(chat_list, offset_order, offset_chat_id, limit)
1419
1466
  broadcast('@type' => 'getChats',
1467
+ 'chat_list' => chat_list,
1420
1468
  'offset_order' => offset_order,
1421
1469
  'offset_chat_id' => offset_chat_id,
1422
1470
  'limit' => limit)
@@ -1445,11 +1493,13 @@ module TD::ClientMethods
1445
1493
  broadcast('@type' => 'getCountryCode')
1446
1494
  end
1447
1495
 
1448
- # Returns a list of public chats with username created by the user.
1496
+ # Returns a list of public chats of the specified type, owned by the user.
1449
1497
  #
1498
+ # @param type [TD::Types::PublicChatType] Type of the public chats to return.
1450
1499
  # @return [TD::Types::Chats]
1451
- def get_created_public_chats
1452
- broadcast('@type' => 'getCreatedPublicChats')
1500
+ def get_created_public_chats(type)
1501
+ broadcast('@type' => 'getCreatedPublicChats',
1502
+ 'type' => type)
1453
1503
  end
1454
1504
 
1455
1505
  # Returns all updates needed to restore current TDLib state, i.e.
@@ -1565,7 +1615,7 @@ module TD::ClientMethods
1565
1615
  #
1566
1616
  # @param user_id [Integer] User identifier.
1567
1617
  # @param offset_chat_id [Integer] Chat identifier starting from which to return chats; use 0 for the first request.
1568
- # @param limit [Integer] Maximum number of chats to be returned; up to 100.
1618
+ # @param limit [Integer] The maximum number of chats to be returned; up to 100.
1569
1619
  # @return [TD::Types::Chats]
1570
1620
  def get_groups_in_common(user_id, offset_chat_id, limit)
1571
1621
  broadcast('@type' => 'getGroupsInCommon',
@@ -1581,6 +1631,15 @@ module TD::ClientMethods
1581
1631
  broadcast('@type' => 'getImportedContactCount')
1582
1632
  end
1583
1633
 
1634
+ # Returns a list of recently inactive supergroups and channels.
1635
+ # Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH
1636
+ # error.
1637
+ #
1638
+ # @return [TD::Types::Chats]
1639
+ def get_inactive_supergroup_chats
1640
+ broadcast('@type' => 'getInactiveSupergroupChats')
1641
+ end
1642
+
1584
1643
  # Returns game high scores and some part of the high score table in the range of the specified user; for bots only.
1585
1644
  #
1586
1645
  # @param inline_message_id [String] Inline message identifier.
@@ -1596,7 +1655,7 @@ module TD::ClientMethods
1596
1655
  # Returns an error with code 502 if the bot fails to answer the query before the query timeout expires.
1597
1656
  #
1598
1657
  # @param bot_user_id [Integer] The identifier of the target bot.
1599
- # @param chat_id [Integer] Identifier of the chat, where the query was sent.
1658
+ # @param chat_id [Integer] Identifier of the chat where the query was sent.
1600
1659
  # @param user_location [TD::Types::Location] Location of the user, only if needed.
1601
1660
  # @param query [String] Text of the query.
1602
1661
  # @param offset [String] Offset of the first entry to return.
@@ -1748,6 +1807,38 @@ module TD::ClientMethods
1748
1807
  broadcast('@type' => 'getLogVerbosityLevel')
1749
1808
  end
1750
1809
 
1810
+ # Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline
1811
+ # button of type inlineKeyboardButtonTypeLoginUrl.
1812
+ # Use the method getLoginUrlInfo to find whether a prior user confirmation is needed.
1813
+ # If an error is returned, then the button must be handled as an ordinary URL button.
1814
+ #
1815
+ # @param chat_id [Integer] Chat identifier of the message with the button.
1816
+ # @param message_id [Integer] Message identifier of the message with the button.
1817
+ # @param button_id [Integer] Button identifier.
1818
+ # @param allow_write_access [Boolean] True, if the user allowed the bot to send them messages.
1819
+ # @return [TD::Types::HttpUrl]
1820
+ def get_login_url(chat_id, message_id, button_id, allow_write_access)
1821
+ broadcast('@type' => 'getLoginUrl',
1822
+ 'chat_id' => chat_id,
1823
+ 'message_id' => message_id,
1824
+ 'button_id' => button_id,
1825
+ 'allow_write_access' => allow_write_access)
1826
+ end
1827
+
1828
+ # Returns information about a button of type inlineKeyboardButtonTypeLoginUrl.
1829
+ # The method needs to be called when the user presses the button.
1830
+ #
1831
+ # @param chat_id [Integer] Chat identifier of the message with the button.
1832
+ # @param message_id [Integer] Message identifier of the message with the button.
1833
+ # @param button_id [Integer] Button identifier.
1834
+ # @return [TD::Types::LoginUrlInfo]
1835
+ def get_login_url_info(chat_id, message_id, button_id)
1836
+ broadcast('@type' => 'getLoginUrlInfo',
1837
+ 'chat_id' => chat_id,
1838
+ 'message_id' => message_id,
1839
+ 'button_id' => button_id)
1840
+ end
1841
+
1751
1842
  # Returns information about a file with a map thumbnail in PNG format.
1752
1843
  # Only map thumbnail files with size less than 1MB can be downloaded.
1753
1844
  #
@@ -1955,7 +2046,7 @@ module TD::ClientMethods
1955
2046
  end
1956
2047
 
1957
2048
  # Returns a public HTTPS link to a message.
1958
- # Available only for messages in supergroups and channels with username.
2049
+ # Available only for messages in supergroups and channels with a username.
1959
2050
  #
1960
2051
  # @param chat_id [Integer] Identifier of the chat to which the message belongs.
1961
2052
  # @param message_id [Integer] Identifier of the message.
@@ -2019,6 +2110,9 @@ module TD::ClientMethods
2019
2110
 
2020
2111
  # Returns information about a file by its remote ID; this is an offline request.
2021
2112
  # Can be used to register a URL as a file for further uploading, or sending as a message.
2113
+ # Even the request succeeds, the file can be used only if it is still accessible to the user.
2114
+ # For example, if the file is from a message, then the message must be not deleted and accessible to the user.
2115
+ # If the file database is disabled, then the corresponding object with the file must be preloaded by the client.
2022
2116
  #
2023
2117
  # @param remote_file_id [String] Remote identifier of the file to get.
2024
2118
  # @param file_type [TD::Types::FileType] File type, if known.
@@ -2099,7 +2193,7 @@ module TD::ClientMethods
2099
2193
  #
2100
2194
  # @param emoji [String] String representation of emoji.
2101
2195
  # If empty, returns all known installed stickers.
2102
- # @param limit [Integer] Maximum number of stickers to be returned.
2196
+ # @param limit [Integer] The maximum number of stickers to be returned.
2103
2197
  # @return [TD::Types::Stickers]
2104
2198
  def get_stickers(emoji, limit)
2105
2199
  broadcast('@type' => 'getStickers',
@@ -2110,8 +2204,8 @@ module TD::ClientMethods
2110
2204
  # Returns storage usage statistics.
2111
2205
  # Can be called before authorization.
2112
2206
  #
2113
- # @param chat_limit [Integer] Maximum number of chats with the largest storage usage for which separate statistics
2114
- # should be returned.
2207
+ # @param chat_limit [Integer] The maximum number of chats with the largest storage usage for which separate
2208
+ # statistics should be returned.
2115
2209
  # All other chats will be grouped in entries with chat_id == 0.
2116
2210
  # If the chat info database is not used, the chat_limit is ignored and is always set to 0.
2117
2211
  # @return [TD::Types::StorageStatistics]
@@ -2128,7 +2222,15 @@ module TD::ClientMethods
2128
2222
  broadcast('@type' => 'getStorageStatisticsFast')
2129
2223
  end
2130
2224
 
2131
- # Returns information about a supergroup or channel by its identifier.
2225
+ # Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel.
2226
+ # Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group.
2227
+ #
2228
+ # @return [TD::Types::Chats]
2229
+ def get_suitable_discussion_chats
2230
+ broadcast('@type' => 'getSuitableDiscussionChats')
2231
+ end
2232
+
2233
+ # Returns information about a supergroup or a channel by its identifier.
2132
2234
  # This is an offline request if the current user is not a bot.
2133
2235
  #
2134
2236
  # @param supergroup_id [Integer] Supergroup or channel identifier.
@@ -2138,7 +2240,7 @@ module TD::ClientMethods
2138
2240
  'supergroup_id' => supergroup_id)
2139
2241
  end
2140
2242
 
2141
- # Returns full information about a supergroup or channel by its identifier, cached for up to 1 minute.
2243
+ # Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute.
2142
2244
  #
2143
2245
  # @param supergroup_id [Integer] Supergroup or channel identifier.
2144
2246
  # @return [TD::Types::SupergroupFullInfo]
@@ -2191,11 +2293,18 @@ module TD::ClientMethods
2191
2293
  'text' => text)
2192
2294
  end
2193
2295
 
2296
+ # Returns a salt to be used with locally stored password to access a local TON-based wallet.
2297
+ #
2298
+ # @return [TD::Types::TonWalletPasswordSalt]
2299
+ def get_ton_wallet_password_salt
2300
+ broadcast('@type' => 'getTonWalletPasswordSalt')
2301
+ end
2302
+
2194
2303
  # Returns a list of frequently used chats.
2195
2304
  # Supported only if the chat info database is enabled.
2196
2305
  #
2197
2306
  # @param category [TD::Types::TopChatCategory] Category of chats to be returned.
2198
- # @param limit [Integer] Maximum number of chats to be returned; up to 30.
2307
+ # @param limit [Integer] The maximum number of chats to be returned; up to 30.
2199
2308
  # @return [TD::Types::Chats]
2200
2309
  def get_top_chats(category, limit)
2201
2310
  broadcast('@type' => 'getTopChats',
@@ -2243,7 +2352,7 @@ module TD::ClientMethods
2243
2352
  #
2244
2353
  # @param user_id [Integer] User identifier.
2245
2354
  # @param offset [Integer] The number of photos to skip; must be non-negative.
2246
- # @param limit [Integer] Maximum number of photos to be returned; up to 100.
2355
+ # @param limit [Integer] The maximum number of photos to be returned; up to 100.
2247
2356
  # @return [TD::Types::UserProfilePhotos]
2248
2357
  def get_user_profile_photos(user_id, offset, limit)
2249
2358
  broadcast('@type' => 'getUserProfilePhotos',
@@ -2275,9 +2384,9 @@ module TD::ClientMethods
2275
2384
  'text' => text)
2276
2385
  end
2277
2386
 
2278
- # Adds new contacts or edits existing contacts; contacts' user identifiers are ignored.
2387
+ # Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored.
2279
2388
  #
2280
- # @param contacts [Array<TD::Types::Contact>] The list of contacts to import or edit, contact's vCard are ignored and
2389
+ # @param contacts [Array<TD::Types::Contact>] The list of contacts to import or edit; contacts' vCard are ignored and
2281
2390
  # are not imported.
2282
2391
  # @return [TD::Types::ImportedContacts]
2283
2392
  def import_contacts(contacts)
@@ -2385,7 +2494,8 @@ module TD::ClientMethods
2385
2494
  'chat_limit' => chat_limit)
2386
2495
  end
2387
2496
 
2388
- # Parses Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text.
2497
+ # Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in
2498
+ # the text.
2389
2499
  # This is an offline method.
2390
2500
  # Can be called before authorization.
2391
2501
  # Can be called synchronously.
@@ -2515,6 +2625,15 @@ module TD::ClientMethods
2515
2625
  'background_id' => background_id)
2516
2626
  end
2517
2627
 
2628
+ # Removes a chat action bar without any other action.
2629
+ #
2630
+ # @param chat_id [Integer] Chat identifier.
2631
+ # @return [TD::Types::Ok]
2632
+ def remove_chat_action_bar(chat_id)
2633
+ broadcast('@type' => 'removeChatActionBar',
2634
+ 'chat_id' => chat_id)
2635
+ end
2636
+
2518
2637
  # Removes users from the contact list.
2519
2638
  #
2520
2639
  # @param user_ids [Array<Integer>] Identifiers of users to be deleted.
@@ -2549,7 +2668,7 @@ module TD::ClientMethods
2549
2668
  # Needs to be called only if the notification group is removed by the current user.
2550
2669
  #
2551
2670
  # @param notification_group_id [Integer] Notification group identifier.
2552
- # @param max_notification_id [Integer] Maximum identifier of removed notifications.
2671
+ # @param max_notification_id [Integer] The maximum identifier of removed notifications.
2553
2672
  # @return [TD::Types::Ok]
2554
2673
  def remove_notification_group(notification_group_id, max_notification_id)
2555
2674
  broadcast('@type' => 'removeNotificationGroup',
@@ -2642,7 +2761,7 @@ module TD::ClientMethods
2642
2761
 
2643
2762
  # Reports a chat to the Telegram moderators.
2644
2763
  # Supported only for supergroups, channels, or private chats with bots, since other chats can't be checked by
2645
- # moderators.
2764
+ # moderators, or when the report is done from the chat action bar.
2646
2765
  #
2647
2766
  # @param chat_id [Integer] Chat identifier.
2648
2767
  # @param reason [TD::Types::ChatReportReason] The reason for reporting the chat.
@@ -2684,6 +2803,16 @@ module TD::ClientMethods
2684
2803
  broadcast('@type' => 'requestPasswordRecovery')
2685
2804
  end
2686
2805
 
2806
+ # Requests QR code authentication by scanning a QR code on another logged in device.
2807
+ # Works only when the current authorization state is authorizationStateWaitPhoneNumber.
2808
+ #
2809
+ # @param other_user_ids [Array<Integer>] List of user identifiers of other users currently using the client.
2810
+ # @return [TD::Types::Ok]
2811
+ def request_qr_code_authentication(other_user_ids)
2812
+ broadcast('@type' => 'requestQrCodeAuthentication',
2813
+ 'other_user_ids' => other_user_ids)
2814
+ end
2815
+
2687
2816
  # Re-sends an authentication code to the user.
2688
2817
  # Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result
2689
2818
  # is not null.
@@ -2865,7 +2994,7 @@ module TD::ClientMethods
2865
2994
  # Returns up to 1 location message per user.
2866
2995
  #
2867
2996
  # @param chat_id [Integer] Chat identifier.
2868
- # @param limit [Integer] Maximum number of messages to be returned.
2997
+ # @param limit [Integer] The maximum number of messages to be returned.
2869
2998
  # @return [TD::Types::Messages]
2870
2999
  def search_chat_recent_location_messages(chat_id, limit)
2871
3000
  broadcast('@type' => 'searchChatRecentLocationMessages',
@@ -2878,7 +3007,7 @@ module TD::ClientMethods
2878
3007
  #
2879
3008
  # @param query [String] Query to search for.
2880
3009
  # If the query is empty, returns up to 20 recently found chats.
2881
- # @param limit [Integer] Maximum number of chats to be returned.
3010
+ # @param limit [Integer] The maximum number of chats to be returned.
2882
3011
  # @return [TD::Types::Chats]
2883
3012
  def search_chats(query, limit)
2884
3013
  broadcast('@type' => 'searchChats',
@@ -2886,11 +3015,22 @@ module TD::ClientMethods
2886
3015
  'limit' => limit)
2887
3016
  end
2888
3017
 
3018
+ # Returns a list of users and location-based supergroups nearby.
3019
+ # The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby.
3020
+ # The request should be sent again every 25 seconds with adjusted location to not miss new chats.
3021
+ #
3022
+ # @param location [TD::Types::Location] Current user location.
3023
+ # @return [TD::Types::ChatsNearby]
3024
+ def search_chats_nearby(location)
3025
+ broadcast('@type' => 'searchChatsNearby',
3026
+ 'location' => location)
3027
+ end
3028
+
2889
3029
  # Searches for the specified query in the title and username of already known chats via request to the server.
2890
3030
  # Returns chats in the order seen in the chat list.
2891
3031
  #
2892
3032
  # @param query [String] Query to search for.
2893
- # @param limit [Integer] Maximum number of chats to be returned.
3033
+ # @param limit [Integer] The maximum number of chats to be returned.
2894
3034
  # @return [TD::Types::Chats]
2895
3035
  def search_chats_on_server(query, limit)
2896
3036
  broadcast('@type' => 'searchChatsOnServer',
@@ -2901,7 +3041,7 @@ module TD::ClientMethods
2901
3041
  # Searches for the specified query in the first names, last names and usernames of the known user contacts.
2902
3042
  #
2903
3043
  # @param query [String, nil] Query to search for; may be empty to return all contacts.
2904
- # @param limit [Integer] Maximum number of users to be returned.
3044
+ # @param limit [Integer] The maximum number of users to be returned.
2905
3045
  # @return [TD::Types::Users]
2906
3046
  def search_contacts(query = nil, limit)
2907
3047
  broadcast('@type' => 'searchContacts',
@@ -2914,17 +3054,19 @@ module TD::ClientMethods
2914
3054
  #
2915
3055
  # @param text [String] Text to search for.
2916
3056
  # @param exact_match [Boolean] True, if only emojis, which exactly match text needs to be returned.
3057
+ # @param input_language_code [String, nil] IETF language tag of the user's input language; can be empty if unknown.
2917
3058
  # @return [TD::Types::Emojis]
2918
- def search_emojis(text, exact_match)
2919
- broadcast('@type' => 'searchEmojis',
2920
- 'text' => text,
2921
- 'exact_match' => exact_match)
3059
+ def search_emojis(text, exact_match, input_language_code = nil)
3060
+ broadcast('@type' => 'searchEmojis',
3061
+ 'text' => text,
3062
+ 'exact_match' => exact_match,
3063
+ 'input_language_code' => input_language_code)
2922
3064
  end
2923
3065
 
2924
3066
  # Searches for recently used hashtags by their prefix.
2925
3067
  #
2926
3068
  # @param prefix [String] Hashtag prefix to search for.
2927
- # @param limit [Integer] Maximum number of hashtags to be returned.
3069
+ # @param limit [Integer] The maximum number of hashtags to be returned.
2928
3070
  # @return [TD::Types::Hashtags]
2929
3071
  def search_hashtags(prefix, limit)
2930
3072
  broadcast('@type' => 'searchHashtags',
@@ -2936,7 +3078,7 @@ module TD::ClientMethods
2936
3078
  #
2937
3079
  # @param is_masks [Boolean] Pass true to return mask sticker sets; pass false to return ordinary sticker sets.
2938
3080
  # @param query [String] Query to search for.
2939
- # @param limit [Integer] Maximum number of sticker sets to return.
3081
+ # @param limit [Integer] The maximum number of sticker sets to return.
2940
3082
  # @return [TD::Types::StickerSets]
2941
3083
  def search_installed_sticker_sets(is_masks, query, limit)
2942
3084
  broadcast('@type' => 'searchInstalledStickerSets',
@@ -2949,6 +3091,8 @@ module TD::ClientMethods
2949
3091
  # Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)).
2950
3092
  # For optimal performance the number of returned messages is chosen by the library.
2951
3093
  #
3094
+ # @param chat_list [TD::Types::ChatList] Chat list in which to search messages; pass null to search in all chats
3095
+ # regardless of their chat list.
2952
3096
  # @param query [String] Query to search for.
2953
3097
  # @param offset_date [Integer] The date of the message starting from which the results should be fetched.
2954
3098
  # Use 0 or any date in the future to get results from the last message.
@@ -2958,8 +3102,9 @@ module TD::ClientMethods
2958
3102
  # Fewer messages may be returned than specified by the limit, even if the end of the message history has not been
2959
3103
  # reached.
2960
3104
  # @return [TD::Types::Messages]
2961
- def search_messages(query, offset_date, offset_chat_id, offset_message_id, limit)
3105
+ def search_messages(chat_list, query, offset_date, offset_chat_id, offset_message_id, limit)
2962
3106
  broadcast('@type' => 'searchMessages',
3107
+ 'chat_list' => chat_list,
2963
3108
  'query' => query,
2964
3109
  'offset_date' => offset_date,
2965
3110
  'offset_chat_id' => offset_chat_id,
@@ -3001,7 +3146,7 @@ module TD::ClientMethods
3001
3146
  # If empty, searchChatMessages should be used instead.
3002
3147
  # @param from_search_id [Integer] The identifier from the result of a previous request, use 0 to get results from the
3003
3148
  # last message.
3004
- # @param limit [Integer] Maximum number of messages to be returned; up to 100.
3149
+ # @param limit [Integer] The maximum number of messages to be returned; up to 100.
3005
3150
  # Fewer messages may be returned than specified by the limit, even if the end of the message history has not been
3006
3151
  # reached.
3007
3152
  # @param filter [TD::Types::SearchMessagesFilter] A filter for the content of messages in the search results.
@@ -3037,7 +3182,7 @@ module TD::ClientMethods
3037
3182
  # Searches for stickers from public sticker sets that correspond to a given emoji.
3038
3183
  #
3039
3184
  # @param emoji [String] String representation of emoji; must be non-empty.
3040
- # @param limit [Integer, nil] Maximum number of stickers to be returned.
3185
+ # @param limit [Integer, nil] The maximum number of stickers to be returned.
3041
3186
  # @return [TD::Types::Stickers]
3042
3187
  def search_stickers(emoji, limit = nil)
3043
3188
  broadcast('@type' => 'searchStickers',
@@ -3148,25 +3293,21 @@ module TD::ClientMethods
3148
3293
  #
3149
3294
  # @param chat_id [Integer] Target chat.
3150
3295
  # @param reply_to_message_id [Integer] Identifier of a message to reply to or 0.
3151
- # @param disable_notification [Boolean] Pass true to disable notification for the message.
3152
- # Not supported in secret chats.
3153
- # @param from_background [Boolean] Pass true if the message is sent from background.
3296
+ # @param options [TD::Types::SendMessageOptions] Options to be used to send the message.
3154
3297
  # @param query_id [Integer] Identifier of the inline query.
3155
3298
  # @param result_id [String] Identifier of the inline result.
3156
3299
  # @param hide_via_bot [Boolean] If true, there will be no mention of a bot, via which the message is sent.
3157
3300
  # Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and
3158
3301
  # GetOption("venue_search_bot_username").
3159
3302
  # @return [TD::Types::Message]
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)
3162
- broadcast('@type' => 'sendInlineQueryResultMessage',
3163
- 'chat_id' => chat_id,
3164
- 'reply_to_message_id' => reply_to_message_id,
3165
- 'disable_notification' => disable_notification,
3166
- 'from_background' => from_background,
3167
- 'query_id' => query_id,
3168
- 'result_id' => result_id,
3169
- 'hide_via_bot' => hide_via_bot)
3303
+ def send_inline_query_result_message(chat_id, reply_to_message_id, options, query_id, result_id, hide_via_bot)
3304
+ broadcast('@type' => 'sendInlineQueryResultMessage',
3305
+ 'chat_id' => chat_id,
3306
+ 'reply_to_message_id' => reply_to_message_id,
3307
+ 'options' => options,
3308
+ 'query_id' => query_id,
3309
+ 'result_id' => result_id,
3310
+ 'hide_via_bot' => hide_via_bot)
3170
3311
  end
3171
3312
 
3172
3313
  # Sends a message.
@@ -3174,19 +3315,15 @@ module TD::ClientMethods
3174
3315
  #
3175
3316
  # @param chat_id [Integer] Target chat.
3176
3317
  # @param reply_to_message_id [Integer] Identifier of the message to reply to or 0.
3177
- # @param disable_notification [Boolean] Pass true to disable notification for the message.
3178
- # Not supported in secret chats.
3179
- # @param from_background [Boolean] Pass true if the message is sent from the background.
3318
+ # @param options [TD::Types::SendMessageOptions] Options to be used to send the message.
3180
3319
  # @param reply_markup [TD::Types::ReplyMarkup] Markup for replying to the message; for bots only.
3181
3320
  # @param input_message_content [TD::Types::InputMessageContent] The content of the message to be sent.
3182
3321
  # @return [TD::Types::Message]
3183
- def send_message(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup,
3184
- input_message_content)
3322
+ def send_message(chat_id, reply_to_message_id, options, reply_markup, input_message_content)
3185
3323
  broadcast('@type' => 'sendMessage',
3186
3324
  'chat_id' => chat_id,
3187
3325
  'reply_to_message_id' => reply_to_message_id,
3188
- 'disable_notification' => disable_notification,
3189
- 'from_background' => from_background,
3326
+ 'options' => options,
3190
3327
  'reply_markup' => reply_markup,
3191
3328
  'input_message_content' => input_message_content)
3192
3329
  end
@@ -3197,17 +3334,14 @@ module TD::ClientMethods
3197
3334
  #
3198
3335
  # @param chat_id [Integer] Target chat.
3199
3336
  # @param reply_to_message_id [Integer] Identifier of a message to reply to or 0.
3200
- # @param disable_notification [Boolean] Pass true to disable notification for the messages.
3201
- # Not supported in secret chats.
3202
- # @param from_background [Boolean] Pass true if the messages are sent from the background.
3337
+ # @param options [TD::Types::SendMessageOptions] Options to be used to send the messages.
3203
3338
  # @param input_message_contents [Array<TD::Types::InputMessageContent>] Contents of messages to be sent.
3204
3339
  # @return [TD::Types::Messages]
3205
- def send_message_album(chat_id, reply_to_message_id, disable_notification, from_background, input_message_contents)
3340
+ def send_message_album(chat_id, reply_to_message_id, options, input_message_contents)
3206
3341
  broadcast('@type' => 'sendMessageAlbum',
3207
3342
  'chat_id' => chat_id,
3208
3343
  'reply_to_message_id' => reply_to_message_id,
3209
- 'disable_notification' => disable_notification,
3210
- 'from_background' => from_background,
3344
+ 'options' => options,
3211
3345
  'input_message_contents' => input_message_contents)
3212
3346
  end
3213
3347
 
@@ -3270,6 +3404,16 @@ module TD::ClientMethods
3270
3404
  'settings' => settings)
3271
3405
  end
3272
3406
 
3407
+ # Sends a request to TON lite server through Telegram servers.
3408
+ # Can be called before authorization.
3409
+ #
3410
+ # @param request [String] The request.
3411
+ # @return [TD::Types::TonLiteServerResponse]
3412
+ def send_ton_lite_server_request(request)
3413
+ broadcast('@type' => 'sendTonLiteServerRequest',
3414
+ 'request' => request)
3415
+ end
3416
+
3273
3417
  # Changes the period of inactivity after which the account of the current user will automatically be deleted.
3274
3418
  #
3275
3419
  # @param ttl [TD::Types::AccountTtl] New account TTL.
@@ -3318,7 +3462,7 @@ module TD::ClientMethods
3318
3462
 
3319
3463
  # Changes the background selected by the user; adds background to the list of installed backgrounds.
3320
3464
  #
3321
- # @param background [TD::Types::InputBackground] The input background to use, null for solid backgrounds.
3465
+ # @param background [TD::Types::InputBackground] The input background to use, null for filled backgrounds.
3322
3466
  # @param type [TD::Types::BackgroundType] Background type; null for default background.
3323
3467
  # The method will return error 404 if type is null.
3324
3468
  # @param for_dark_theme [Boolean] True, if the background is chosen for dark theme.
@@ -3351,6 +3495,18 @@ module TD::ClientMethods
3351
3495
  'error_message' => error_message)
3352
3496
  end
3353
3497
 
3498
+ # Moves a chat to a different chat list.
3499
+ # Current chat list of the chat must ne non-null.
3500
+ #
3501
+ # @param chat_id [Integer] Chat identifier.
3502
+ # @param chat_list [TD::Types::ChatList] New chat list of the chat.
3503
+ # @return [TD::Types::Ok]
3504
+ def set_chat_chat_list(chat_id, chat_list)
3505
+ broadcast('@type' => 'setChatChatList',
3506
+ 'chat_id' => chat_id,
3507
+ 'chat_list' => chat_list)
3508
+ end
3509
+
3354
3510
  # Changes client data associated with a chat.
3355
3511
  #
3356
3512
  # @param chat_id [Integer] Chat identifier.
@@ -3375,6 +3531,24 @@ module TD::ClientMethods
3375
3531
  'description' => description)
3376
3532
  end
3377
3533
 
3534
+ # Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified.
3535
+ #
3536
+ # @param chat_id [Integer] Identifier of the channel chat.
3537
+ # Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires
3538
+ # can_pin_messages rights in the supergroup).
3539
+ # @param discussion_chat_id [Integer] Identifier of a new channel's discussion group.
3540
+ # Use 0 to remove the discussion group.
3541
+ # Use the method getSuitableDiscussionChats to find all suitable groups.
3542
+ # Basic group chats needs to be first upgraded to supergroup chats.
3543
+ # If new chat members don't have access to old messages in the supergroup, then
3544
+ # toggleSupergroupIsAllHistoryAvailable needs to be used first to change that.
3545
+ # @return [TD::Types::Ok]
3546
+ def set_chat_discussion_group(chat_id, discussion_chat_id)
3547
+ broadcast('@type' => 'setChatDiscussionGroup',
3548
+ 'chat_id' => chat_id,
3549
+ 'discussion_chat_id' => discussion_chat_id)
3550
+ end
3551
+
3378
3552
  # Changes the draft message in a chat.
3379
3553
  #
3380
3554
  # @param chat_id [Integer] Chat identifier.
@@ -3386,8 +3560,22 @@ module TD::ClientMethods
3386
3560
  'draft_message' => draft_message)
3387
3561
  end
3388
3562
 
3563
+ # Changes the location of a chat.
3564
+ # Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the
3565
+ # method is allowed to use.
3566
+ #
3567
+ # @param chat_id [Integer] Chat identifier.
3568
+ # @param location [TD::Types::ChatLocation] New location for the chat; must be valid and not null.
3569
+ # @return [TD::Types::Ok]
3570
+ def set_chat_location(chat_id, location)
3571
+ broadcast('@type' => 'setChatLocation',
3572
+ 'chat_id' => chat_id,
3573
+ 'location' => location)
3574
+ end
3575
+
3389
3576
  # Changes the status of a chat member, needs appropriate privileges.
3390
- # This function is currently not suitable for adding new members to the chat; instead, use addChatMember.
3577
+ # This function is currently not suitable for adding new members to the chat and transferring chat ownership;
3578
+ # instead, use addChatMember or transferChatOwnership.
3391
3579
  # The chat member status will not be changed until it has been synchronized with the server.
3392
3580
  #
3393
3581
  # @param chat_id [Integer] Chat identifier.
@@ -3402,9 +3590,11 @@ module TD::ClientMethods
3402
3590
  end
3403
3591
 
3404
3592
  # Changes the notification settings of a chat.
3593
+ # Notification settings of a chat with the current user (Saved Messages) can't be changed.
3405
3594
  #
3406
3595
  # @param chat_id [Integer] Chat identifier.
3407
3596
  # @param notification_settings [TD::Types::ChatNotificationSettings] New notification settings for the chat.
3597
+ # If the chat is muted for more than 1 week, it is considered to be muted forever.
3408
3598
  # @return [TD::Types::Ok]
3409
3599
  def set_chat_notification_settings(chat_id, notification_settings)
3410
3600
  broadcast('@type' => 'setChatNotificationSettings',
@@ -3441,6 +3631,18 @@ module TD::ClientMethods
3441
3631
  'photo' => photo)
3442
3632
  end
3443
3633
 
3634
+ # Changes the slow mode delay of a chat.
3635
+ # Available only for supergroups; requires can_restrict_members rights.
3636
+ #
3637
+ # @param chat_id [Integer] Chat identifier.
3638
+ # @param slow_mode_delay [Integer] New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600.
3639
+ # @return [TD::Types::Ok]
3640
+ def set_chat_slow_mode_delay(chat_id, slow_mode_delay)
3641
+ broadcast('@type' => 'setChatSlowModeDelay',
3642
+ 'chat_id' => chat_id,
3643
+ 'slow_mode_delay' => slow_mode_delay)
3644
+ end
3645
+
3444
3646
  # Changes the chat title.
3445
3647
  # Supported only for basic groups, supergroups and channels.
3446
3648
  # Requires can_change_info rights.
@@ -3671,11 +3873,13 @@ module TD::ClientMethods
3671
3873
 
3672
3874
  # Changes the order of pinned chats.
3673
3875
  #
3876
+ # @param chat_list [TD::Types::ChatList] Chat list in which to change the order of pinned chats.
3674
3877
  # @param chat_ids [Array<Integer>] The new list of pinned chats.
3675
3878
  # @return [TD::Types::Ok]
3676
- def set_pinned_chats(chat_ids)
3677
- broadcast('@type' => 'setPinnedChats',
3678
- 'chat_ids' => chat_ids)
3879
+ def set_pinned_chats(chat_list, chat_ids)
3880
+ broadcast('@type' => 'setPinnedChats',
3881
+ 'chat_list' => chat_list,
3882
+ 'chat_ids' => chat_ids)
3679
3883
  end
3680
3884
 
3681
3885
  # Changes user answer to a poll.
@@ -3754,7 +3958,7 @@ module TD::ClientMethods
3754
3958
  'sticker_set_id' => sticker_set_id)
3755
3959
  end
3756
3960
 
3757
- # Changes the username of a supergroup or channel, requires creator privileges in the supergroup or channel.
3961
+ # Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel.
3758
3962
  #
3759
3963
  # @param supergroup_id [Integer] Identifier of the supergroup or channel.
3760
3964
  # @param username [String] New value of the username.
@@ -3798,6 +4002,17 @@ module TD::ClientMethods
3798
4002
  'username' => username)
3799
4003
  end
3800
4004
 
4005
+ # Shares the phone number of the current user with a mutual contact.
4006
+ # Supposed to be called when the user clicks on chatActionBarSharePhoneNumber.
4007
+ #
4008
+ # @param user_id [Integer] Identifier of the user with whom to share the phone number.
4009
+ # The user must be a mutual contact.
4010
+ # @return [TD::Types::Ok]
4011
+ def share_phone_number(user_id)
4012
+ broadcast('@type' => 'sharePhoneNumber',
4013
+ 'user_id' => user_id)
4014
+ end
4015
+
3801
4016
  # Stops a poll.
3802
4017
  # A poll in a message can be stopped when the message has can_be_edited flag set.
3803
4018
  #
@@ -3862,7 +4077,8 @@ module TD::ClientMethods
3862
4077
  end
3863
4078
 
3864
4079
  # Changes the pinned state of a chat.
3865
- # You can pin up to GetOption("pinned_chat_count_max") non-secret chats and the same number of secret chats.
4080
+ # You can pin up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") non-secret chats
4081
+ # and the same number of secret chats in the main/archive chat list.
3866
4082
  #
3867
4083
  # @param chat_id [Integer] Chat identifier.
3868
4084
  # @param is_pinned [Boolean] New value of is_pinned.
@@ -3895,6 +4111,23 @@ module TD::ClientMethods
3895
4111
  'sign_messages' => sign_messages)
3896
4112
  end
3897
4113
 
4114
+ # Changes the owner of a chat.
4115
+ # The current user must be a current owner of the chat.
4116
+ # Use the method canTransferOwnership to check whether the ownership can be transferred from the current session.
4117
+ # Available only for supergroups and channel chats.
4118
+ #
4119
+ # @param chat_id [Integer] Chat identifier.
4120
+ # @param user_id [Integer] Identifier of the user to which transfer the ownership.
4121
+ # The ownership can't be transferred to a bot or to a deleted user.
4122
+ # @param password [String] The password of the current user.
4123
+ # @return [TD::Types::Ok]
4124
+ def transfer_chat_ownership(chat_id, user_id, password)
4125
+ broadcast('@type' => 'transferChatOwnership',
4126
+ 'chat_id' => chat_id,
4127
+ 'user_id' => user_id,
4128
+ 'password' => password)
4129
+ end
4130
+
3898
4131
  # Removes a user from the blacklist.
3899
4132
  #
3900
4133
  # @param user_id [Integer] User identifier.