tgbot 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -20
- data/lib/api.yaml +122 -100
- data/lib/tgbot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbaa43b35f2b7dc4ca638faa4916d8a6d048fd0d750bfd57ff2f32df41f61328
|
4
|
+
data.tar.gz: 94a8aae2c6f642d08c8d001c0ee7f761a7d186b45bf3885e3e3d4f517ceabf9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc1a210d70ff33ba63a2e11916bb8f54c496d9725d365770fbe31b87b29404eab3a62346d03b59d302d431cb48807544766ebe7d4728a2ecec358755bcfc897
|
7
|
+
data.tar.gz: cd5b0921d4e2ee244352768cb86dc5cb9ad629cd2b668b76593ebbdb964f05acb2d04d4fb07036473da99f07f3a3cdc56ed413fe3ce0109dc299062596e44ae9
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Tgbot
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/tgbot.svg)](https://badge.fury.io/rb/tgbot)
|
4
|
-
![Bot API Version](https://img.shields.io/badge/Bot%20API-4.
|
4
|
+
![Bot API Version](https://img.shields.io/badge/Bot%20API-4.4-blue.svg?style=flat-square)
|
5
5
|
![](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat-square)
|
6
6
|
|
7
7
|
A tiny but easy-to-use wrapper of [Telegram Bot API](https://core.telegram.org/bots/api).
|
@@ -14,17 +14,18 @@ A tiny but easy-to-use wrapper of [Telegram Bot API](https://core.telegram.org/b
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
Tgbot.run TOKEN, proxy: 'http://127.0.0.1:1080' do
|
17
|
+
@name = get_me&.result&.first_name
|
17
18
|
on 'start' do
|
18
|
-
reply "
|
19
|
+
reply "#@name, at your service."
|
19
20
|
end
|
20
21
|
end
|
21
22
|
# or
|
22
23
|
bot = Tgbot.new TOKEN, proxy: 'http://127.0.0.1:1080'
|
23
|
-
bot.on('start'){ reply "#{
|
24
|
+
bot.on('start'){ reply "#{get_me&.result&.first_name}, at your service." }
|
24
25
|
bot.run # will block current thread
|
25
26
|
```
|
26
27
|
|
27
|
-
|
28
|
+
#### `Tgbot.run token, **options do (block) end`
|
28
29
|
|
29
30
|
Start a long polling bot.
|
30
31
|
|
@@ -38,26 +39,25 @@ Start a long polling bot.
|
|
38
39
|
|
39
40
|
and in that `(block)`:
|
40
41
|
|
41
|
-
|
42
|
+
#### method_missing
|
42
43
|
|
43
44
|
Just call the native bot api. e.g. `getMe()` `send_message(chat_id: 123, text: 'hello')`.
|
44
45
|
|
45
|
-
Returns an OpenStruct of the replied object.
|
46
|
+
Returns an OpenStruct of the replied object. Basically `struct{ok=true,result=...}`.
|
46
47
|
|
47
|
-
|
48
|
+
#### `self.debug = true | false (default)`
|
48
49
|
|
49
50
|
Show debug info (every message, matched command).
|
50
51
|
|
51
|
-
|
52
|
+
#### `start do (do sth when it is connected) end`
|
52
53
|
|
53
54
|
```ruby
|
54
55
|
start do
|
55
|
-
puts "\e[33m#{get_me&.first_name}\e[32m, at your service."
|
56
|
+
puts "\e[33m#{get_me&.result&.first_name}\e[32m, at your service."
|
56
57
|
end
|
57
58
|
```
|
58
59
|
|
59
|
-
|
60
|
-
|
60
|
+
#### `finish do (do sth when Ctrl+C) end`
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
finish do
|
@@ -65,7 +65,7 @@ finish do
|
|
65
65
|
end
|
66
66
|
```
|
67
67
|
|
68
|
-
|
68
|
+
#### `on pattern=nil, **options do |match_data, update, task| (block) end`
|
69
69
|
|
70
70
|
Match pattern and do something.
|
71
71
|
|
@@ -82,17 +82,17 @@ e.g. `"hey bot, /r3d6@mybot+1 lol" => #<MatchData "/r3d6+1" 1:"3" 2:"6" 3:"1">`
|
|
82
82
|
|--------|------|-------|---------|
|
83
83
|
| name | `String` | just give it a name | `'roll!'` |
|
84
84
|
| before_all | `true` | set to run before other `on`s matching the same message | `true` |
|
85
|
-
| after_all | `true` | set to run after other `on`s matching the same message<sup>
|
85
|
+
| after_all | `true` | set to run after other `on`s matching the same message<sup>2</sup><br>you can't set both `before_all` and `after_all` on one command | `true` |
|
86
86
|
|
87
|
-
<sup>
|
87
|
+
<sup>2</sup>: order is `* -> before2 -> before1 -> other -> after1 -> after2 -> *`.
|
88
88
|
|
89
89
|
and in that `(block)`:
|
90
90
|
|
91
|
-
|
91
|
+
#### `debug message`
|
92
92
|
|
93
93
|
Puts that message to STDERR when it is in debug mode.
|
94
94
|
|
95
|
-
|
95
|
+
#### `reply *things, **options`
|
96
96
|
|
97
97
|
Reply to the matched message.
|
98
98
|
|
@@ -104,20 +104,20 @@ Reply to the matched message.
|
|
104
104
|
| option | type | notes | example |
|
105
105
|
|--------|------|-------|---------|
|
106
106
|
| media | `false` | set to `false` to force `sendDocument` | `'127.0.0.1:1080'` |
|
107
|
-
| style | `:none` \| `:at` \| `nil` (default) | reply style<sup>
|
107
|
+
| style | `:none` \| `:at` \| `nil` (default) | reply style<sup>3</sup> | `:at` |
|
108
108
|
| parse_mode, etc. | depends | see [sendMessage](https://core.telegram.org/bots/api#sendmessage) | - |
|
109
109
|
|
110
|
-
reply style<sup>
|
110
|
+
reply style<sup>3</sup>:
|
111
111
|
|
112
112
|
- `:none` : don't add reply info, so the sender won't receive a prompting.
|
113
113
|
- `:at`: use `[inline mention of a user](tg://user?id=123456789)` in replied message.
|
114
114
|
- `nil` (default): include `reply_to_message_id` in replied message object.
|
115
115
|
|
116
|
-
|
116
|
+
#### `interrupt!` `done!`
|
117
117
|
|
118
118
|
Stop processing this message (if there be further blocks matching it). see `before_all` `after_all`.
|
119
119
|
|
120
|
-
|
120
|
+
#### `retry! n=1`
|
121
121
|
|
122
122
|
Enqueue this message again for at most `n` times.
|
123
123
|
|
data/lib/api.yaml
CHANGED
@@ -3,6 +3,23 @@ name: Telegram Bot API
|
|
3
3
|
children:
|
4
4
|
- name: Recent changes
|
5
5
|
children:
|
6
|
+
- name: July 29, 2019
|
7
|
+
children: []
|
8
|
+
desc:
|
9
|
+
- name: p
|
10
|
+
content: Bot API 4.4
|
11
|
+
- name: ul
|
12
|
+
content:
|
13
|
+
- Added support for animated stickers. New field is_animated in Sticker and StickerSet objects, animated stickers can now be used in sendSticker and InlineQueryResultCachedSticker.
|
14
|
+
- Added support for default permissions in groups. New object ChatPermissions, containing actions which a member can take in a chat. New field permissions in the Chat object; new method setChatPermissions.
|
15
|
+
- The field all_members_are_administrators has been removed from the documentation for the Chat object. The field is still returned in the object for backward compatibility, but new bots should use the permissions field instead.
|
16
|
+
- 'Added support for more permissions for group and supergroup members: added the new field can_send_polls to ChatMember object, added can_change_info, can_invite_users, can_pin_messages in ChatMember object for restricted users (previously available only for administrators).'
|
17
|
+
- The method restrictChatMember now takes the new user permissions in a single argument of the type ChatPermissions. The old way of passing parameters will keep working for a while for backward compatibility.
|
18
|
+
- Added description support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to setChatDescription and receive the group's description in the Chat object in the response to getChat method.
|
19
|
+
- Added invite_link support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to exportChatInviteLink and receive the group's invite link in the Chat object in the response to getChat method.
|
20
|
+
- File identifiers from the ChatPhoto object are now invalidated and can no longer be used whenever the photo is changed.
|
21
|
+
- 'All webhook requests from the Bot API are now coming from the subnets 149.154.160.0/20 and 91.108.4.0/22. Most users won''t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.'
|
22
|
+
- As of the next Bot API update (version 4.5), nested MessageEntity objects will be allowed in message texts and captions. Please make sure that your code can correctly handle such entities.
|
6
23
|
- name: May 31, 2019
|
7
24
|
children: []
|
8
25
|
desc:
|
@@ -35,35 +52,6 @@ children:
|
|
35
52
|
- Added the field forward_sender_name to the Message object, containing name of the sender who has opted to hide their account.
|
36
53
|
- 'Starting in July 2019, webhook requests from Bot API will be coming from the subnets 149.154.160.0/20 and 91.108.4.0/22. Most users won''t need to do anything to continue receiving webhooks. If you control inbound access with a firewall, you may need to update your configuration. You can always find the list of actual IP addresses of servers used to send webhooks there: https://core.telegram.org/bots/webhooks.'
|
37
54
|
- Document thumbnails now should be inscribed in a 320x320 square instead of 90x90.
|
38
|
-
- name: August 27, 2018
|
39
|
-
children: []
|
40
|
-
desc:
|
41
|
-
- name: p
|
42
|
-
content: Bot API 4.1
|
43
|
-
- name: ul
|
44
|
-
content:
|
45
|
-
- Added support for translated versions of documents in Telegram Passport. New field translation in EncryptedPassportElement.
|
46
|
-
- 'New errors: PassportElementErrorTranslationFile and PassportElementErrorTranslationFiles, PassportElementErrorUnspecified.'
|
47
|
-
- name: July 26, 2018
|
48
|
-
children: []
|
49
|
-
desc:
|
50
|
-
- name: p
|
51
|
-
content: Bot API 4.0.
|
52
|
-
- name: ul
|
53
|
-
content:
|
54
|
-
- Added support for Telegram Passport. See the official announcement on the blog and the manual for details.
|
55
|
-
- 'Added support for editing the media content of messages: added the method editMessageMedia and new types InputMediaAnimation, InputMediaAudio, and InputMediaDocument.'
|
56
|
-
- Added the field thumb to the Audio object to contain the thumbnail of the album cover to which the music file belongs.
|
57
|
-
- Added support for attaching custom thumbnails to uploaded files. For animations, audios, videos and video notes, which are less than 10 MB in size, thumbnails are generated automatically.
|
58
|
-
- tg:// URLs now can be used in inline keyboard url buttons and text_link message entities.
|
59
|
-
- Added the method sendAnimation, which can be used instead of sendDocument to send animations, specifying their duration, width and height.
|
60
|
-
- Added the field animation to the Message object. For backward compatibility, when this field is set, the document field will be also set.
|
61
|
-
- 'Added two new MessageEntity types: cashtag and phone_number.'
|
62
|
-
- 'Added support for Foursquare venues: added the new field foursquare_type to the objects Venue, InlineQueryResultVenue and InputVenueMessageContent, and the parameter foursquare_type to the sendVenue method.'
|
63
|
-
- You can now create inline mentions of users, who have pressed your bot's callback buttons.
|
64
|
-
- You can now use the Retry-After response header to configure the delay after which the Bot API will retry the request after an unsuccessful response from a webhook.
|
65
|
-
- If a webhook returns the HTTP error 410 Gone for all requests for more than 23 hours successively, it can be automatically removed.
|
66
|
-
- 'Added vCard support when sharing contacts: added the field vcard to the objects Contact, InlineQueryResultContact, InputContactMessageContent and the method sendContact.'
|
67
55
|
- name: p
|
68
56
|
content: See earlier changes »
|
69
57
|
- name: Authorizing your bot
|
@@ -284,21 +272,21 @@ children:
|
|
284
272
|
- Field: last_name
|
285
273
|
Type: String
|
286
274
|
Description: Optional. Last name of the other party in a private chat
|
287
|
-
- Field: all_members_are_administrators
|
288
|
-
Type: Boolean
|
289
|
-
Description: Optional. True if a group has ‘All Members Are Admins’ enabled.
|
290
275
|
- Field: photo
|
291
276
|
Type: ChatPhoto
|
292
277
|
Description: Optional. Chat photo. Returned only in getChat.
|
293
278
|
- Field: description
|
294
279
|
Type: String
|
295
|
-
Description: Optional. Description, for supergroups and channel chats. Returned only in getChat.
|
280
|
+
Description: Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
|
296
281
|
- Field: invite_link
|
297
282
|
Type: String
|
298
|
-
Description: Optional. Chat invite link, for supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.
|
283
|
+
Description: Optional. Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.
|
299
284
|
- Field: pinned_message
|
300
285
|
Type: Message
|
301
286
|
Description: Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat.
|
287
|
+
- Field: permissions
|
288
|
+
Type: ChatPermissions
|
289
|
+
Description: Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
|
302
290
|
- Field: sticker_set_name
|
303
291
|
Type: String
|
304
292
|
Description: Optional. For supergroups, name of group sticker set. Returned only in getChat.
|
@@ -481,7 +469,7 @@ children:
|
|
481
469
|
table:
|
482
470
|
- Field: file_id
|
483
471
|
Type: String
|
484
|
-
Description:
|
472
|
+
Description: Identifier for this file
|
485
473
|
- Field: width
|
486
474
|
Type: Integer
|
487
475
|
Description: Photo width
|
@@ -499,7 +487,7 @@ children:
|
|
499
487
|
table:
|
500
488
|
- Field: file_id
|
501
489
|
Type: String
|
502
|
-
Description:
|
490
|
+
Description: Identifier for this file
|
503
491
|
- Field: duration
|
504
492
|
Type: Integer
|
505
493
|
Description: Duration of the audio in seconds as defined by sender
|
@@ -526,7 +514,7 @@ children:
|
|
526
514
|
table:
|
527
515
|
- Field: file_id
|
528
516
|
Type: String
|
529
|
-
Description:
|
517
|
+
Description: Identifier for this file
|
530
518
|
- Field: thumb
|
531
519
|
Type: PhotoSize
|
532
520
|
Description: Optional. Document thumbnail as defined by sender
|
@@ -547,7 +535,7 @@ children:
|
|
547
535
|
table:
|
548
536
|
- Field: file_id
|
549
537
|
Type: String
|
550
|
-
Description:
|
538
|
+
Description: Identifier for this file
|
551
539
|
- Field: width
|
552
540
|
Type: Integer
|
553
541
|
Description: Video width as defined by sender
|
@@ -574,7 +562,7 @@ children:
|
|
574
562
|
table:
|
575
563
|
- Field: file_id
|
576
564
|
Type: String
|
577
|
-
Description:
|
565
|
+
Description: Identifier for this file
|
578
566
|
- Field: width
|
579
567
|
Type: Integer
|
580
568
|
Description: Video width as defined by sender
|
@@ -604,7 +592,7 @@ children:
|
|
604
592
|
table:
|
605
593
|
- Field: file_id
|
606
594
|
Type: String
|
607
|
-
Description:
|
595
|
+
Description: Identifier for this file
|
608
596
|
- Field: duration
|
609
597
|
Type: Integer
|
610
598
|
Description: Duration of the audio in seconds as defined by sender
|
@@ -622,7 +610,7 @@ children:
|
|
622
610
|
table:
|
623
611
|
- Field: file_id
|
624
612
|
Type: String
|
625
|
-
Description:
|
613
|
+
Description: Identifier for this file
|
626
614
|
- Field: length
|
627
615
|
Type: Integer
|
628
616
|
Description: Video width and height (diameter of the video message) as defined by sender
|
@@ -741,7 +729,7 @@ children:
|
|
741
729
|
table:
|
742
730
|
- Field: file_id
|
743
731
|
Type: String
|
744
|
-
Description:
|
732
|
+
Description: Identifier for this file
|
745
733
|
- Field: file_size
|
746
734
|
Type: Integer
|
747
735
|
Description: Optional. File size, if known
|
@@ -893,13 +881,13 @@ children:
|
|
893
881
|
- name: p
|
894
882
|
content: Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
|
895
883
|
- name: blockquote
|
896
|
-
content:
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
884
|
+
content: |-
|
885
|
+
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
|
886
|
+
|
887
|
+
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
|
888
|
+
Guide the user through a step-by-step process. ‘Please send me your question’, ‘Cool, now let’s add the first answer option‘, ’Great. Keep adding answer options, then send /done when you‘re ready’.
|
889
|
+
|
890
|
+
The last option is definitely more attractive. And if you use ForceReply in your bot‘s questions, it will receive the user’s answers even if it only receives replies, commands and mentions — without any extra work for the user.
|
903
891
|
table:
|
904
892
|
- Field: force_reply
|
905
893
|
Type: 'True'
|
@@ -915,10 +903,10 @@ children:
|
|
915
903
|
table:
|
916
904
|
- Field: small_file_id
|
917
905
|
Type: String
|
918
|
-
Description:
|
906
|
+
Description: File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
|
919
907
|
- Field: big_file_id
|
920
908
|
Type: String
|
921
|
-
Description:
|
909
|
+
Description: File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
|
922
910
|
- name: ChatMember
|
923
911
|
children: []
|
924
912
|
desc:
|
@@ -933,49 +921,82 @@ children:
|
|
933
921
|
Description: The member's status in the chat. Can be “creator”, “administrator”, “member”, “restricted”, “left” or “kicked”
|
934
922
|
- Field: until_date
|
935
923
|
Type: Integer
|
936
|
-
Description: Optional. Restricted and kicked only. Date when restrictions will be lifted for this user
|
924
|
+
Description: Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time
|
937
925
|
- Field: can_be_edited
|
938
926
|
Type: Boolean
|
939
927
|
Description: Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user
|
940
|
-
- Field: can_change_info
|
941
|
-
Type: Boolean
|
942
|
-
Description: Optional. Administrators only. True, if the administrator can change the chat title, photo and other settings
|
943
928
|
- Field: can_post_messages
|
944
929
|
Type: Boolean
|
945
|
-
Description: Optional. Administrators only. True, if the administrator can post in the channel
|
930
|
+
Description: Optional. Administrators only. True, if the administrator can post in the channel; channels only
|
946
931
|
- Field: can_edit_messages
|
947
932
|
Type: Boolean
|
948
|
-
Description: Optional. Administrators only. True, if the administrator can edit messages of other users and can pin messages
|
933
|
+
Description: Optional. Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only
|
949
934
|
- Field: can_delete_messages
|
950
935
|
Type: Boolean
|
951
936
|
Description: Optional. Administrators only. True, if the administrator can delete messages of other users
|
952
|
-
- Field: can_invite_users
|
953
|
-
Type: Boolean
|
954
|
-
Description: Optional. Administrators only. True, if the administrator can invite new users to the chat
|
955
937
|
- Field: can_restrict_members
|
956
938
|
Type: Boolean
|
957
939
|
Description: Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
|
958
|
-
- Field: can_pin_messages
|
959
|
-
Type: Boolean
|
960
|
-
Description: Optional. Administrators only. True, if the administrator can pin messages, groups and supergroups only
|
961
940
|
- Field: can_promote_members
|
962
941
|
Type: Boolean
|
963
942
|
Description: Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
|
943
|
+
- Field: can_change_info
|
944
|
+
Type: Boolean
|
945
|
+
Description: Optional. Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings
|
946
|
+
- Field: can_invite_users
|
947
|
+
Type: Boolean
|
948
|
+
Description: Optional. Administrators and restricted only. True, if the user is allowed to invite new users to the chat
|
949
|
+
- Field: can_pin_messages
|
950
|
+
Type: Boolean
|
951
|
+
Description: Optional. Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only
|
964
952
|
- Field: is_member
|
965
953
|
Type: Boolean
|
966
954
|
Description: Optional. Restricted only. True, if the user is a member of the chat at the moment of the request
|
967
955
|
- Field: can_send_messages
|
968
956
|
Type: Boolean
|
969
|
-
Description: Optional. Restricted only. True, if the user
|
957
|
+
Description: Optional. Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues
|
970
958
|
- Field: can_send_media_messages
|
971
959
|
Type: Boolean
|
972
|
-
Description: Optional. Restricted only. True, if the user
|
960
|
+
Description: Optional. Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes
|
961
|
+
- Field: can_send_polls
|
962
|
+
Type: Boolean
|
963
|
+
Description: Optional. Restricted only. True, if the user is allowed to send polls
|
973
964
|
- Field: can_send_other_messages
|
974
965
|
Type: Boolean
|
975
|
-
Description: Optional. Restricted only. True, if the user
|
966
|
+
Description: Optional. Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots
|
976
967
|
- Field: can_add_web_page_previews
|
977
968
|
Type: Boolean
|
978
|
-
Description: Optional. Restricted only. True, if user
|
969
|
+
Description: Optional. Restricted only. True, if the user is allowed to add web page previews to their messages
|
970
|
+
- name: ChatPermissions
|
971
|
+
children: []
|
972
|
+
desc:
|
973
|
+
- name: p
|
974
|
+
content: Describes actions that a non-administrator user is allowed to take in a chat.
|
975
|
+
table:
|
976
|
+
- Field: can_send_messages
|
977
|
+
Type: Boolean
|
978
|
+
Description: Optional. True, if the user is allowed to send text messages, contacts, locations and venues
|
979
|
+
- Field: can_send_media_messages
|
980
|
+
Type: Boolean
|
981
|
+
Description: Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
|
982
|
+
- Field: can_send_polls
|
983
|
+
Type: Boolean
|
984
|
+
Description: Optional. True, if the user is allowed to send polls, implies can_send_messages
|
985
|
+
- Field: can_send_other_messages
|
986
|
+
Type: Boolean
|
987
|
+
Description: Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
|
988
|
+
- Field: can_add_web_page_previews
|
989
|
+
Type: Boolean
|
990
|
+
Description: Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
|
991
|
+
- Field: can_change_info
|
992
|
+
Type: Boolean
|
993
|
+
Description: Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
|
994
|
+
- Field: can_invite_users
|
995
|
+
Type: Boolean
|
996
|
+
Description: Optional. True, if the user is allowed to invite new users to the chat
|
997
|
+
- Field: can_pin_messages
|
998
|
+
Type: Boolean
|
999
|
+
Description: Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
|
979
1000
|
- name: ResponseParameters
|
980
1001
|
children: []
|
981
1002
|
desc:
|
@@ -1155,6 +1176,7 @@ children:
|
|
1155
1176
|
- It is not possible to resend thumbnails.
|
1156
1177
|
- Resending a photo by file_id will send all of its sizes.
|
1157
1178
|
- file_id is unique for each individual bot and can't be transferred from one bot to another.
|
1179
|
+
- file_id uniquely identifies a file, but a file can have different valid file_ids even for the same bot.
|
1158
1180
|
- name: p
|
1159
1181
|
content: Sending by URL
|
1160
1182
|
- name: ul
|
@@ -1324,7 +1346,7 @@ children:
|
|
1324
1346
|
children: []
|
1325
1347
|
desc:
|
1326
1348
|
- name: p
|
1327
|
-
content: Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .
|
1349
|
+
content: Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
|
1328
1350
|
- name: p
|
1329
1351
|
content: For sending voice messages, use the sendVoice method instead.
|
1330
1352
|
table:
|
@@ -1865,8 +1887,6 @@ children:
|
|
1865
1887
|
desc:
|
1866
1888
|
- name: p
|
1867
1889
|
content: Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
1868
|
-
- name: blockquote
|
1869
|
-
content: 'Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group. Otherwise members may only be removed by the group''s creator or by the member that added them.'
|
1870
1890
|
table:
|
1871
1891
|
- Parameter: chat_id
|
1872
1892
|
Type: Integer or String
|
@@ -1898,7 +1918,7 @@ children:
|
|
1898
1918
|
children: []
|
1899
1919
|
desc:
|
1900
1920
|
- name: p
|
1901
|
-
content: Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all
|
1921
|
+
content: Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
|
1902
1922
|
table:
|
1903
1923
|
- Parameter: chat_id
|
1904
1924
|
Type: Integer or String
|
@@ -1908,26 +1928,14 @@ children:
|
|
1908
1928
|
Type: Integer
|
1909
1929
|
Required: 'Yes'
|
1910
1930
|
Description: Unique identifier of the target user
|
1931
|
+
- Parameter: permissions
|
1932
|
+
Type: ChatPermissions
|
1933
|
+
Required: 'Yes'
|
1934
|
+
Description: New user permissions
|
1911
1935
|
- Parameter: until_date
|
1912
1936
|
Type: Integer
|
1913
1937
|
Required: Optional
|
1914
1938
|
Description: Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
|
1915
|
-
- Parameter: can_send_messages
|
1916
|
-
Type: Boolean
|
1917
|
-
Required: Optional
|
1918
|
-
Description: Pass True, if the user can send text messages, contacts, locations and venues
|
1919
|
-
- Parameter: can_send_media_messages
|
1920
|
-
Type: Boolean
|
1921
|
-
Required: Optional
|
1922
|
-
Description: Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
|
1923
|
-
- Parameter: can_send_other_messages
|
1924
|
-
Type: Boolean
|
1925
|
-
Required: Optional
|
1926
|
-
Description: Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages
|
1927
|
-
- Parameter: can_add_web_page_previews
|
1928
|
-
Type: Boolean
|
1929
|
-
Required: Optional
|
1930
|
-
Description: Pass True, if the user may add web page previews to their messages, implies can_send_media_messages
|
1931
1939
|
- name: promoteChatMember
|
1932
1940
|
children: []
|
1933
1941
|
desc:
|
@@ -1974,6 +1982,20 @@ children:
|
|
1974
1982
|
Type: Boolean
|
1975
1983
|
Required: Optional
|
1976
1984
|
Description: Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
|
1985
|
+
- name: setChatPermissions
|
1986
|
+
children: []
|
1987
|
+
desc:
|
1988
|
+
- name: p
|
1989
|
+
content: Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success.
|
1990
|
+
table:
|
1991
|
+
- Parameter: chat_id
|
1992
|
+
Type: Integer or String
|
1993
|
+
Required: 'Yes'
|
1994
|
+
Description: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
1995
|
+
- Parameter: permissions
|
1996
|
+
Type: ChatPermissions
|
1997
|
+
Required: 'Yes'
|
1998
|
+
Description: New default chat permissions
|
1977
1999
|
- name: exportChatInviteLink
|
1978
2000
|
children: []
|
1979
2001
|
desc:
|
@@ -1991,8 +2013,6 @@ children:
|
|
1991
2013
|
desc:
|
1992
2014
|
- name: p
|
1993
2015
|
content: Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
1994
|
-
- name: blockquote
|
1995
|
-
content: 'Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.'
|
1996
2016
|
table:
|
1997
2017
|
- Parameter: chat_id
|
1998
2018
|
Type: Integer or String
|
@@ -2007,8 +2027,6 @@ children:
|
|
2007
2027
|
desc:
|
2008
2028
|
- name: p
|
2009
2029
|
content: Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
2010
|
-
- name: blockquote
|
2011
|
-
content: 'Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.'
|
2012
2030
|
table:
|
2013
2031
|
- Parameter: chat_id
|
2014
2032
|
Type: Integer or String
|
@@ -2019,8 +2037,6 @@ children:
|
|
2019
2037
|
desc:
|
2020
2038
|
- name: p
|
2021
2039
|
content: Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
2022
|
-
- name: blockquote
|
2023
|
-
content: 'Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting is off in the target group.'
|
2024
2040
|
table:
|
2025
2041
|
- Parameter: chat_id
|
2026
2042
|
Type: Integer or String
|
@@ -2034,7 +2050,7 @@ children:
|
|
2034
2050
|
children: []
|
2035
2051
|
desc:
|
2036
2052
|
- name: p
|
2037
|
-
content: Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
2053
|
+
content: Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
|
2038
2054
|
table:
|
2039
2055
|
- Parameter: chat_id
|
2040
2056
|
Type: Integer or String
|
@@ -2347,13 +2363,16 @@ children:
|
|
2347
2363
|
table:
|
2348
2364
|
- Field: file_id
|
2349
2365
|
Type: String
|
2350
|
-
Description:
|
2366
|
+
Description: Identifier for this file
|
2351
2367
|
- Field: width
|
2352
2368
|
Type: Integer
|
2353
2369
|
Description: Sticker width
|
2354
2370
|
- Field: height
|
2355
2371
|
Type: Integer
|
2356
2372
|
Description: Sticker height
|
2373
|
+
- Field: is_animated
|
2374
|
+
Type: Boolean
|
2375
|
+
Description: True, if the sticker is animated
|
2357
2376
|
- Field: thumb
|
2358
2377
|
Type: PhotoSize
|
2359
2378
|
Description: Optional. Sticker thumbnail in the .webp or .jpg format
|
@@ -2381,6 +2400,9 @@ children:
|
|
2381
2400
|
- Field: title
|
2382
2401
|
Type: String
|
2383
2402
|
Description: Sticker set title
|
2403
|
+
- Field: is_animated
|
2404
|
+
Type: Boolean
|
2405
|
+
Description: True, if the sticker set contains animated stickers
|
2384
2406
|
- Field: contains_masks
|
2385
2407
|
Type: Boolean
|
2386
2408
|
Description: True, if the sticker set contains masks
|
@@ -2409,7 +2431,7 @@ children:
|
|
2409
2431
|
children: []
|
2410
2432
|
desc:
|
2411
2433
|
- name: p
|
2412
|
-
content: Use this method to send .
|
2434
|
+
content: Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned.
|
2413
2435
|
table:
|
2414
2436
|
- Parameter: chat_id
|
2415
2437
|
Type: Integer or String
|
@@ -2845,7 +2867,7 @@ children:
|
|
2845
2867
|
children: []
|
2846
2868
|
desc:
|
2847
2869
|
- name: p
|
2848
|
-
content: Represents a link to an
|
2870
|
+
content: Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
2849
2871
|
- name: p
|
2850
2872
|
content: 'Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.'
|
2851
2873
|
table:
|
@@ -3209,7 +3231,7 @@ children:
|
|
3209
3231
|
- name: p
|
3210
3232
|
content: Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
|
3211
3233
|
- name: p
|
3212
|
-
content: 'Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.'
|
3234
|
+
content: 'Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them.'
|
3213
3235
|
table:
|
3214
3236
|
- Field: type
|
3215
3237
|
Type: String
|
@@ -3330,7 +3352,7 @@ children:
|
|
3330
3352
|
children: []
|
3331
3353
|
desc:
|
3332
3354
|
- name: p
|
3333
|
-
content: Represents a link to an
|
3355
|
+
content: Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
|
3334
3356
|
- name: p
|
3335
3357
|
content: 'Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.'
|
3336
3358
|
table:
|
@@ -3793,7 +3815,7 @@ children:
|
|
3793
3815
|
table:
|
3794
3816
|
- Field: file_id
|
3795
3817
|
Type: String
|
3796
|
-
Description:
|
3818
|
+
Description: Identifier for this file
|
3797
3819
|
- Field: file_size
|
3798
3820
|
Type: Integer
|
3799
3821
|
Description: File size
|
data/lib/tgbot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tgbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hyrious
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|