teleruby 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +0 -2
- data/lib/api/delete_apis.rb +6 -6
- data/lib/api/get_apis.rb +22 -16
- data/lib/api/nstandard.rb +4 -1
- data/lib/api/other_apis.rb +19 -19
- data/lib/api/send_apis.rb +17 -17
- data/lib/api/set_apis.rb +14 -15
- data/lib/core_api.rb +3 -1
- data/lib/teleruby.rb +7 -2
- data/teleruby.gemspec +1 -1
- metadata +3 -53
- data/lib/api/all.rb +0 -12
- data/lib/objects/all.rb +0 -42
- data/lib/teleruby/all_apis.rb +0 -22
- data/lib/teleruby/api/delete_apis.rb +0 -58
- data/lib/teleruby/api/get_apis.rb +0 -172
- data/lib/teleruby/api/nstandard.rb +0 -27
- data/lib/teleruby/api/other_apis.rb +0 -241
- data/lib/teleruby/api/send_apis.rb +0 -206
- data/lib/teleruby/api/set_apis.rb +0 -137
- data/lib/teleruby/core_api.rb +0 -52
- data/lib/teleruby/objects/all.rb +0 -42
- data/lib/teleruby/objects/animation.rb +0 -40
- data/lib/teleruby/objects/audio.rb +0 -39
- data/lib/teleruby/objects/bot_command.rb +0 -24
- data/lib/teleruby/objects/callback_query.rb +0 -66
- data/lib/teleruby/objects/chat.rb +0 -164
- data/lib/teleruby/objects/chat_member.rb +0 -142
- data/lib/teleruby/objects/chat_permissions.rb +0 -59
- data/lib/teleruby/objects/chat_photo.rb +0 -37
- data/lib/teleruby/objects/chosen_inline_result.rb +0 -45
- data/lib/teleruby/objects/contact.rb +0 -37
- data/lib/teleruby/objects/dice.rb +0 -21
- data/lib/teleruby/objects/document.rb +0 -29
- data/lib/teleruby/objects/file.rb +0 -32
- data/lib/teleruby/objects/game.rb +0 -65
- data/lib/teleruby/objects/inline_query.rb +0 -44
- data/lib/teleruby/objects/inlinekeyboardbutton.rb +0 -59
- data/lib/teleruby/objects/inlinekeyboardmarkup.rb +0 -31
- data/lib/teleruby/objects/location.rb +0 -21
- data/lib/teleruby/objects/mask_position.rb +0 -35
- data/lib/teleruby/objects/message.rb +0 -400
- data/lib/teleruby/objects/message_entity.rb +0 -95
- data/lib/teleruby/objects/order_info.rb +0 -36
- data/lib/teleruby/objects/photo_size.rb +0 -14
- data/lib/teleruby/objects/poll.rb +0 -97
- data/lib/teleruby/objects/poll_answer.rb +0 -29
- data/lib/teleruby/objects/poll_option.rb +0 -22
- data/lib/teleruby/objects/pre_checkout_query.rb +0 -50
- data/lib/teleruby/objects/same/common.rb +0 -31
- data/lib/teleruby/objects/same/common_2.rb +0 -32
- data/lib/teleruby/objects/shipping_address.rb +0 -39
- data/lib/teleruby/objects/shipping_query.rb +0 -32
- data/lib/teleruby/objects/sticker.rb +0 -59
- data/lib/teleruby/objects/update.rb +0 -207
- data/lib/teleruby/objects/user.rb +0 -66
- data/lib/teleruby/objects/user_profile_photos.rb +0 -36
- data/lib/teleruby/objects/venue.rb +0 -40
- data/lib/teleruby/objects/video.rb +0 -39
- data/lib/teleruby/objects/video_note.rb +0 -50
- data/lib/teleruby/objects/voice.rb +0 -20
- data/lib/teleruby/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a40223df4cf794ae2e08ea1d74ba081de67ef2f0d364d14d5dfa5ff58cdd43
|
4
|
+
data.tar.gz: ec615dbd87f2b753a3ec00655b60c656a98aa7aa5fd8317f20b019b47ba3af1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383c43e5e777a85386bbbac77c9352fc40c4c1be68366ce311afa783618521ab95d63937574e837c7480beb10512a36841ada5d1d76f2263c015eb4fef9718a4
|
7
|
+
data.tar.gz: 56e59911af03c63b0ad1f88a3804970e368ad04f929b8e44c9b8d8593139234d21eba4ead0a294c77f4146424809604ce5f1298fc3b2e58597e59c3fc86bb486
|
data/LICENSE.md
CHANGED
@@ -5,5 +5,3 @@ This program is free software: you can redistribute it and/or modify it under th
|
|
5
5
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
6
6
|
|
7
7
|
You should have received a copy of the GNU General Public License along with this program. If not, [see](https://www.gnu.org/licenses/)
|
8
|
-
|
9
|
-
|
data/lib/api/delete_apis.rb
CHANGED
@@ -9,13 +9,13 @@ module Telegram
|
|
9
9
|
# Use this method to delete a chat photo.
|
10
10
|
def delete_chat_photo(chat_id)
|
11
11
|
unless chat_id.to_i.negative?
|
12
|
-
|
12
|
+
fail BadRequestError, %{can't delete private chat photo}
|
13
13
|
end
|
14
14
|
|
15
15
|
hash = { chat_id: chat_id }
|
16
16
|
response = http_post('deleteChatPhoto', hash)
|
17
17
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
18
|
-
|
18
|
+
fail PermissionError, response.description
|
19
19
|
end
|
20
20
|
|
21
21
|
response.result
|
@@ -24,13 +24,13 @@ module Telegram
|
|
24
24
|
# Use this method to delete a group sticker set from a supergroup.
|
25
25
|
def delete_chat_sticker_set(chat_id)
|
26
26
|
unless chat_id.to_i.negative?
|
27
|
-
|
27
|
+
fail BadRequestError, %{can' delete sticker set of private chat}
|
28
28
|
end
|
29
29
|
|
30
30
|
hash = { chat_id: chat_id }
|
31
31
|
response = http_post('deleteChatStickerSet', hash)
|
32
32
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
33
|
-
|
33
|
+
fail PermissionError, response.description
|
34
34
|
end
|
35
35
|
|
36
36
|
response.result
|
@@ -41,7 +41,7 @@ module Telegram
|
|
41
41
|
hash = { chat_id: chat_id, message_id: message_id }
|
42
42
|
response = http_post('deleteMessage', hash)
|
43
43
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
44
|
-
|
44
|
+
fail TelegramError, response.description
|
45
45
|
end
|
46
46
|
|
47
47
|
response.result
|
@@ -49,7 +49,7 @@ module Telegram
|
|
49
49
|
|
50
50
|
# Use this method to delete a sticker from a set created by the bot.
|
51
51
|
def delete_sticker_from_set(sticker)
|
52
|
-
|
52
|
+
throw NotImplementedError, 'currently not supported'
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/api/get_apis.rb
CHANGED
@@ -11,14 +11,20 @@ module Telegram
|
|
11
11
|
module GetApis # rubocop:disable Metrics/ModuleLength
|
12
12
|
include CoreApi
|
13
13
|
# Use this method to receive incoming updates using long polling.
|
14
|
-
def get_updates(limit
|
15
|
-
|
16
|
-
if
|
17
|
-
|
14
|
+
def get_updates(limit = 10, &block) # rubocop:disable Metrics/MethodLength
|
15
|
+
blok = {}
|
16
|
+
if block_given?
|
17
|
+
blok = block.call
|
18
|
+
unless blok.instance_of? Hash # rubocop:disable Style/IfUnlessModifier
|
19
|
+
fail ArgumentError, 'expected object is hash'
|
20
|
+
end
|
18
21
|
end
|
22
|
+
|
23
|
+
hash = { 'timeout': 0, 'limit': limit, 'offset': @last_update }
|
24
|
+
hash.merge!(blok)
|
19
25
|
response = http_get('getUpdates', hash)
|
20
26
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
21
|
-
|
27
|
+
fail TelegramError, response.desciption
|
22
28
|
end
|
23
29
|
|
24
30
|
result = response.result
|
@@ -38,7 +44,7 @@ module Telegram
|
|
38
44
|
def get_me
|
39
45
|
response = http_get('getMe')
|
40
46
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
41
|
-
|
47
|
+
fail TokenError, 'incorrect bot token'
|
42
48
|
end
|
43
49
|
BotUser.new(response.result)
|
44
50
|
end
|
@@ -49,7 +55,7 @@ module Telegram
|
|
49
55
|
hash = { file_id: file_id }
|
50
56
|
response = http_get('getFile', hash)
|
51
57
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
52
|
-
|
58
|
+
fail IdError, 'incorrect file id'
|
53
59
|
end
|
54
60
|
TFile.new(response.result)
|
55
61
|
end
|
@@ -57,13 +63,13 @@ module Telegram
|
|
57
63
|
# Use this method to get a list of profile pictures for a user.
|
58
64
|
def get_profile_photos(user_id, params = {}) # rubocop:disable Metrics/MethodLength
|
59
65
|
if user_id.to_i.negative? # rubocop:disable Style/IfUnlessModifier
|
60
|
-
|
66
|
+
fail IdError, 'id must be private chat\'s id'
|
61
67
|
end
|
62
68
|
|
63
69
|
hash = { uesr_id: user_id }.merge!(params)
|
64
70
|
response = http_get('getProfilePhotos', hash)
|
65
71
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
66
|
-
|
72
|
+
fails TelegramError, response.description
|
67
73
|
end
|
68
74
|
|
69
75
|
result = response.result
|
@@ -80,12 +86,12 @@ module Telegram
|
|
80
86
|
# Use this method to get a list of administrators in a chat.
|
81
87
|
def get_chat_admins(chat_id)
|
82
88
|
unless chat_id.to_i.negative? # rubocop:disable Style/IfUnlessModifier
|
83
|
-
|
89
|
+
fail IdError, 'chat id must be supergroup id'
|
84
90
|
end
|
85
91
|
hash = { chat_id: chat_id }
|
86
92
|
response = http_get('getChatAdministrators', hash)
|
87
93
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
88
|
-
|
94
|
+
fail FatalError, 'fatal error'
|
89
95
|
end
|
90
96
|
|
91
97
|
result = response.result
|
@@ -112,7 +118,7 @@ module Telegram
|
|
112
118
|
hash = { chat_id: chat_id, user_id: user_id }
|
113
119
|
response = http_get('getChatMember', hash)
|
114
120
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
115
|
-
|
121
|
+
fail FatalError, response.description
|
116
122
|
end
|
117
123
|
ChatMember.new(response.result)
|
118
124
|
end
|
@@ -122,7 +128,7 @@ module Telegram
|
|
122
128
|
hash = { name: name }
|
123
129
|
response = http_get('getStickerSetName', hash)
|
124
130
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
125
|
-
|
131
|
+
fail Error, %{incorrect sticker set name}
|
126
132
|
end
|
127
133
|
StickerSet.new(response.result)
|
128
134
|
end
|
@@ -132,7 +138,7 @@ module Telegram
|
|
132
138
|
hash = { chat_id: chat_id }
|
133
139
|
response = http_get('getChat', hash)
|
134
140
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
135
|
-
|
141
|
+
fail IdError, %{incorrect chat id}
|
136
142
|
end
|
137
143
|
|
138
144
|
if chat_id.negative?
|
@@ -145,7 +151,7 @@ module Telegram
|
|
145
151
|
def get_my_commands # rubocop:disable Metrics/MethodLength
|
146
152
|
response = http_get('getMyCommands')
|
147
153
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
148
|
-
|
154
|
+
fail TokenError, %{seems bot token error}
|
149
155
|
end
|
150
156
|
|
151
157
|
commands = []
|
@@ -156,7 +162,7 @@ module Telegram
|
|
156
162
|
commands
|
157
163
|
end
|
158
164
|
end
|
159
|
-
# rubocop:enable Metrics/
|
165
|
+
# rubocop:enable Metrics/MethodLength
|
160
166
|
|
161
167
|
# The End!
|
162
168
|
end
|
data/lib/api/nstandard.rb
CHANGED
@@ -2,15 +2,18 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'open-uri'
|
5
|
+
require '../core_api'
|
5
6
|
|
6
7
|
module Telegram
|
7
8
|
module NonStandard
|
9
|
+
include CoreApi
|
8
10
|
def download_file(file_d, dir = Dir.pwd)
|
9
|
-
|
11
|
+
d = Dir.new(dir)
|
10
12
|
end
|
11
13
|
|
12
14
|
def download_file_from(uri, dir = Dir.pwd)
|
13
15
|
uri = URI.parse(uri)
|
16
|
+
|
14
17
|
end
|
15
18
|
|
16
19
|
# use 'markdown'
|
data/lib/api/other_apis.rb
CHANGED
@@ -13,18 +13,18 @@ module Telegram
|
|
13
13
|
hash.merge!(hash2)
|
14
14
|
data = http_post('forwardMessage', hash)
|
15
15
|
unless data.ok # rubocop:disable Style/IfUnlessModifier
|
16
|
-
|
16
|
+
fail TelegramError, data.description
|
17
17
|
end
|
18
18
|
data.result
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
# Use this method to kick a user from a group, a supergroup
|
22
22
|
# or a channel.
|
23
23
|
def kick_chat_member(chat_id, user_id, params = {})
|
24
24
|
hash = { chat_id: chat_id, user_id: user_id }.merge!(params)
|
25
25
|
data = http_post('kickChatMember', hash)
|
26
26
|
unless data.ok # rubocop:disable Style/IfUnlessModifier
|
27
|
-
|
27
|
+
fail TelegramError, data.description
|
28
28
|
end
|
29
29
|
data.result
|
30
30
|
end
|
@@ -35,7 +35,7 @@ module Telegram
|
|
35
35
|
hash = { chat_id: chat_id, user_id: user_id }
|
36
36
|
data = http_post('unbanChatMember', hash)
|
37
37
|
unless data.ok # rubocop:disable Style/IfUnlessModifier
|
38
|
-
|
38
|
+
fail TelegramError, data.description
|
39
39
|
end
|
40
40
|
data.result
|
41
41
|
end
|
@@ -47,7 +47,7 @@ module Telegram
|
|
47
47
|
hash.merge!(hash2)
|
48
48
|
data = http_post('restrictChatMember', hash)
|
49
49
|
unless data.ok # rubocop:disable Style/IfUnlessModifier
|
50
|
-
|
50
|
+
fail TelegramError, data.description
|
51
51
|
end
|
52
52
|
data.result
|
53
53
|
end
|
@@ -58,7 +58,7 @@ module Telegram
|
|
58
58
|
hash = { chat_id: chat_id, user_id: user_id }.merge!(params)
|
59
59
|
data = http_post('promoteChatMember', hash)
|
60
60
|
unless data.ok # rubocop:disable Style/IfUnlessModifier
|
61
|
-
|
61
|
+
fail TelegramError, data.description
|
62
62
|
end
|
63
63
|
data.result
|
64
64
|
end
|
@@ -68,7 +68,7 @@ module Telegram
|
|
68
68
|
hash = { chat_id: chat_id }
|
69
69
|
response = http_post('exportChatInviteLink', hash)
|
70
70
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
71
|
-
|
71
|
+
fail TelegramError, response.description
|
72
72
|
end
|
73
73
|
response.result
|
74
74
|
end
|
@@ -79,7 +79,7 @@ module Telegram
|
|
79
79
|
hash = { chat_id: chat_id, message_id: message_id }.merge!(params)
|
80
80
|
response = http_post('pinChatMessage', hash)
|
81
81
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
82
|
-
|
82
|
+
fail SecurityError, response.description
|
83
83
|
end
|
84
84
|
response.result
|
85
85
|
end
|
@@ -89,7 +89,7 @@ module Telegram
|
|
89
89
|
hash = { chat_id: chat_id, message_id: message_id }.merge!(params)
|
90
90
|
response = http_post('stopPoll', hash)
|
91
91
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
92
|
-
|
92
|
+
fail Error, response.description
|
93
93
|
end
|
94
94
|
response.result
|
95
95
|
end
|
@@ -101,7 +101,7 @@ module Telegram
|
|
101
101
|
hash = { user_id: user_id, png_sticker: png_sticker }
|
102
102
|
response = http_post('uploadStickerFile', hash)
|
103
103
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
104
|
-
|
104
|
+
fail Error, response.description
|
105
105
|
end
|
106
106
|
response.result
|
107
107
|
end
|
@@ -113,7 +113,7 @@ module Telegram
|
|
113
113
|
hash = { user_id: user_id, name: name, title: title }.merge!(params)
|
114
114
|
response = http_post('createNewStickerSet', hash)
|
115
115
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
116
|
-
|
116
|
+
fail Error, response.description
|
117
117
|
end
|
118
118
|
response.result
|
119
119
|
end
|
@@ -123,13 +123,13 @@ module Telegram
|
|
123
123
|
hash = { user_id: user_id, name: name, emojis: emojis }.merge!(params)
|
124
124
|
response = http_post('addStickerToSet', hash)
|
125
125
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
126
|
-
|
126
|
+
throw StandardError, response.description
|
127
127
|
end
|
128
128
|
response.result
|
129
129
|
end
|
130
130
|
|
131
131
|
def edit_message_live_location
|
132
|
-
|
132
|
+
fail NotImplementedError, 'not implemented'
|
133
133
|
end
|
134
134
|
|
135
135
|
# Use this method to send answers to callback queries sent from inline
|
@@ -146,7 +146,7 @@ module Telegram
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def delete_webhook
|
149
|
-
|
149
|
+
fail NotImplementedError, 'not support for now'
|
150
150
|
end
|
151
151
|
|
152
152
|
# Use this method to edit text and game messages. On success,
|
@@ -156,7 +156,7 @@ module Telegram
|
|
156
156
|
hash = { text: text }.merge!(params)
|
157
157
|
response = http_post('editMessageText', hash)
|
158
158
|
unless response.ok
|
159
|
-
|
159
|
+
fail FatalError, response.description
|
160
160
|
end
|
161
161
|
if response.result == true
|
162
162
|
return true
|
@@ -170,7 +170,7 @@ module Telegram
|
|
170
170
|
def edit_message_caption(params = {})
|
171
171
|
response = http_post('editMessageCaption', params)
|
172
172
|
unless response.ok
|
173
|
-
|
173
|
+
fail FatalError, response.description
|
174
174
|
end
|
175
175
|
if response.result == true
|
176
176
|
return true
|
@@ -189,7 +189,7 @@ module Telegram
|
|
189
189
|
hash = { media: media }.merge!(params)
|
190
190
|
response = http_post('editMessageMedia', hash)
|
191
191
|
unless response.ok
|
192
|
-
|
192
|
+
fail FatalError, response.description
|
193
193
|
end
|
194
194
|
if response.result == true
|
195
195
|
return true
|
@@ -203,7 +203,7 @@ module Telegram
|
|
203
203
|
def edit_message_reply_markup(params = {})
|
204
204
|
response = http_post('editMessageReplyMarkup', params)
|
205
205
|
unless response.ok
|
206
|
-
|
206
|
+
fail FatalError, response.description
|
207
207
|
end
|
208
208
|
if response.result == true
|
209
209
|
return true
|
@@ -217,7 +217,7 @@ module Telegram
|
|
217
217
|
hash = { inline_query_id: inline_query_id, result: result }.merge!(params)
|
218
218
|
response = http_post('answerInlineQuery', hash)
|
219
219
|
unless response.ok
|
220
|
-
|
220
|
+
fail FatalError, response.description
|
221
221
|
end
|
222
222
|
response.result
|
223
223
|
end
|
data/lib/api/send_apis.rb
CHANGED
@@ -14,7 +14,7 @@ module Telegram
|
|
14
14
|
hash = { chat_id: chat_id, text: text }.merge!(params)
|
15
15
|
response = http_post('sendMessage', hash)
|
16
16
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
17
|
-
|
17
|
+
fail FatalError, response.description
|
18
18
|
end
|
19
19
|
Message.new(response.result)
|
20
20
|
end
|
@@ -24,7 +24,7 @@ module Telegram
|
|
24
24
|
hash = { chat_id: chat_id, photo: photo }.merge!(params)
|
25
25
|
response = http_post('sendPhoto', hash)
|
26
26
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
27
|
-
|
27
|
+
fail FatalError, response.description
|
28
28
|
end
|
29
29
|
Message.new(response.result)
|
30
30
|
end
|
@@ -34,7 +34,7 @@ module Telegram
|
|
34
34
|
hash = { chat_id: chat_id, audio: audio }.merge!(params)
|
35
35
|
response = http_post('sendAudio', hash)
|
36
36
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
37
|
-
|
37
|
+
fail FatalError, response.description
|
38
38
|
end
|
39
39
|
Message.new(response.result)
|
40
40
|
end
|
@@ -44,7 +44,7 @@ module Telegram
|
|
44
44
|
hash = { chat_id: chat_id, document: document }.merge!(params)
|
45
45
|
response = http_post('sendDocument', hash)
|
46
46
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
47
|
-
|
47
|
+
fail FatalError, response.description
|
48
48
|
end
|
49
49
|
Message.new(response.result)
|
50
50
|
end
|
@@ -55,7 +55,7 @@ module Telegram
|
|
55
55
|
hash = { chat_id: chat_id, video: video }.merge!(params)
|
56
56
|
response = http_post('sendVideo', hash)
|
57
57
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
58
|
-
|
58
|
+
fail FatalError, response.description
|
59
59
|
end
|
60
60
|
Message.new(response.result)
|
61
61
|
end
|
@@ -66,7 +66,7 @@ module Telegram
|
|
66
66
|
hash = { chat_id: chat_id, animation: animation }.merge!(params)
|
67
67
|
response = http_post('sendAnimation', hash)
|
68
68
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
69
|
-
|
69
|
+
fail FatalError, response.description
|
70
70
|
end
|
71
71
|
Message.new(response.result)
|
72
72
|
end
|
@@ -76,7 +76,7 @@ module Telegram
|
|
76
76
|
hash = { chat_id: chat_id, voice: voice }.merge!(params)
|
77
77
|
response = http_post('sendVoice', hash)
|
78
78
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
79
|
-
|
79
|
+
fail FatalError, response.description
|
80
80
|
end
|
81
81
|
Message.new(response.result)
|
82
82
|
end
|
@@ -86,7 +86,7 @@ module Telegram
|
|
86
86
|
hash = { chat_id: chat_id, video_note: video_note }.merge!(params)
|
87
87
|
response = http_post('sendVideoNote', hash)
|
88
88
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
89
|
-
|
89
|
+
fail FatalError, response.description
|
90
90
|
end
|
91
91
|
Message.new(response.result)
|
92
92
|
end
|
@@ -96,7 +96,7 @@ module Telegram
|
|
96
96
|
hash = { chat_id: chat_id, media: media }.merge!(params)
|
97
97
|
response = http_post('sendMediaGroup', hash)
|
98
98
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
99
|
-
|
99
|
+
fail FatalError, response.description
|
100
100
|
end
|
101
101
|
Message.new(response.result)
|
102
102
|
end
|
@@ -107,7 +107,7 @@ module Telegram
|
|
107
107
|
hash.merge!(params)
|
108
108
|
response = http_post('sendLocation', hash)
|
109
109
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
110
|
-
|
110
|
+
fail FatalError, response.description
|
111
111
|
end
|
112
112
|
Message.new(response.result)
|
113
113
|
end
|
@@ -119,7 +119,7 @@ module Telegram
|
|
119
119
|
hash.merge!(hash2)
|
120
120
|
response = http_post('sendVenue', hash)
|
121
121
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
122
|
-
|
122
|
+
throw FatalError, response.description
|
123
123
|
end
|
124
124
|
Message.new(response.result)
|
125
125
|
end
|
@@ -131,7 +131,7 @@ module Telegram
|
|
131
131
|
hash.merge!(hash2)
|
132
132
|
response = http_post('sendContact', hash)
|
133
133
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
134
|
-
|
134
|
+
fail FatalError, response.description
|
135
135
|
end
|
136
136
|
Message.new(response.result)
|
137
137
|
end
|
@@ -143,7 +143,7 @@ module Telegram
|
|
143
143
|
hash.merge!(hash2)
|
144
144
|
response = http_post('sendPoll', hash)
|
145
145
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
146
|
-
|
146
|
+
fail FatalError, response.description
|
147
147
|
end
|
148
148
|
Message.new(response.result)
|
149
149
|
end
|
@@ -154,7 +154,7 @@ module Telegram
|
|
154
154
|
hash = { chat_id: chat_id}.merge!(params)
|
155
155
|
response = http_post('sendDice', hash)
|
156
156
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
157
|
-
|
157
|
+
fail FatalError, response.description
|
158
158
|
end
|
159
159
|
Message.new(response.description)
|
160
160
|
end
|
@@ -168,12 +168,12 @@ module Telegram
|
|
168
168
|
upload_audio upload_document find_location record_video_note
|
169
169
|
upload_video_note }
|
170
170
|
unless actions.include? action # rubocop:disable Style/IfUnlessModifier
|
171
|
-
|
171
|
+
throw Error, 'invalid chat action'
|
172
172
|
end
|
173
173
|
hash = { chat_id: chat_id, action: action }
|
174
174
|
response = http_post('sendChatAction', hash)
|
175
175
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
176
|
-
|
176
|
+
fail IdError, 'incorrect chat id'
|
177
177
|
end
|
178
178
|
response.result
|
179
179
|
end
|
@@ -183,7 +183,7 @@ module Telegram
|
|
183
183
|
hash = { chat_id: chat_id, sticker: file }.merge!(params)
|
184
184
|
response = http_post('sendSticker', hash)
|
185
185
|
unless response.ok # rubocop:disable Style/IfUnlessModifier
|
186
|
-
|
186
|
+
fail FatalError, response.description
|
187
187
|
end
|
188
188
|
Message.new(response.result)
|
189
189
|
end
|