rbender 0.4.97 → 0.5.1
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/lib/rbender.rb +1 -1
- data/lib/rbender/methods.rb +268 -17
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b87a6e8247553462fc13653986bfd04271ace3dd
|
|
4
|
+
data.tar.gz: ac5cd960c69eb6a092ac357fc21fa594908b61cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50ce484bc121cefb24e04ebc139472f8615fe0de81118025eda139d9f7c7bbb20f0e09cbea343e7f7ff480b5569fee84c455241d7a8db9df58891eb3618bb6b9
|
|
7
|
+
data.tar.gz: 8b69df3a95f933ef6f5f654b1968065bea321e8a3da0de6d5cfde94c15dda3d2106360a8a25786bb43b1935f980c4350292001e2133f83fbb9f57ca0d59ab0d8
|
data/lib/rbender.rb
CHANGED
data/lib/rbender/methods.rb
CHANGED
|
@@ -2,7 +2,7 @@ class RBender::Methods
|
|
|
2
2
|
|
|
3
3
|
def initialize(message, api, session)
|
|
4
4
|
@message = message
|
|
5
|
-
@api
|
|
5
|
+
@api = api
|
|
6
6
|
@session = session
|
|
7
7
|
end
|
|
8
8
|
|
|
@@ -93,37 +93,288 @@ class RBender::Methods
|
|
|
93
93
|
|
|
94
94
|
def edit_message_text(inline_message_id: nil,
|
|
95
95
|
text:,
|
|
96
|
+
chat_id: @message.from.id,
|
|
96
97
|
message_id: @message.message.message_id,
|
|
97
98
|
parse_mode: nil,
|
|
98
99
|
disable_web_page_preview: nil,
|
|
99
100
|
reply_markup: nil)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
if text.strip.empty?
|
|
102
|
+
raise "A text can't be empty or consists of space symbols only"
|
|
103
|
+
end
|
|
104
|
+
@api.edit_message_text chat_id: chat_id,
|
|
105
|
+
message_id: message_id,
|
|
106
|
+
text: text,
|
|
107
|
+
inline_message_id: inline_message_id,
|
|
108
|
+
parse_mode: parse_mode,
|
|
109
|
+
disable_web_page_preview: disable_web_page_preview,
|
|
110
|
+
reply_markup: reply_markup
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def edit_message_caption(inline_message_id: nil,
|
|
114
|
+
caption: nil,
|
|
115
|
+
chat_id: @message.from.id,
|
|
116
|
+
message_id: @message.message.message_id,
|
|
117
|
+
reply_markup: nil)
|
|
118
|
+
if text.strip.empty?
|
|
119
|
+
raise "A text can't be empty or consists of space symbols only"
|
|
109
120
|
end
|
|
121
|
+
@api.edit_message_text chat_id: chat_id,
|
|
122
|
+
message_id: message_id,
|
|
123
|
+
caption: caption,
|
|
124
|
+
inline_message_id: inline_message_id,
|
|
125
|
+
reply_markup: reply_markup
|
|
110
126
|
end
|
|
111
127
|
|
|
112
128
|
def edit_message_reply_markup(chat_id: @message.from.id,
|
|
113
129
|
message_id: @message.message.message_id,
|
|
114
130
|
inline_message_id: nil,
|
|
115
131
|
reply_markup: nil)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
132
|
+
@api.edit_message_reply_markup chat_id: chat_id,
|
|
133
|
+
message_id: message_id,
|
|
134
|
+
inline_message_id: inline_message_id,
|
|
135
|
+
reply_markup: reply_markup
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def delete_message(chat_id: @message.from.id,
|
|
139
|
+
message_id:)
|
|
140
|
+
@api.delete_message(chat_id: chat_id,
|
|
141
|
+
message_id: message_id)
|
|
123
142
|
end
|
|
124
143
|
|
|
144
|
+
|
|
125
145
|
def get_file(file_id:)
|
|
126
146
|
@api.get_file file_id: file_id
|
|
127
147
|
end
|
|
148
|
+
|
|
149
|
+
def get_me()
|
|
150
|
+
@api.get_me
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def forward_message(chat_id:,
|
|
154
|
+
from_chat_id: @message.from.id,
|
|
155
|
+
disable_notification: false,
|
|
156
|
+
message_id:)
|
|
157
|
+
@api.forward_message(chat_id: chat_id,
|
|
158
|
+
from_chat_id: from_chat_id,
|
|
159
|
+
disable_notification: disable_notification,
|
|
160
|
+
message_id: message_id)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def send_photo(chat_id: @message.from.id,
|
|
164
|
+
photo:,
|
|
165
|
+
caption: nil,
|
|
166
|
+
disable_notification: false,
|
|
167
|
+
reply_to_message_id: nil,
|
|
168
|
+
reply_markup: nil)
|
|
169
|
+
@api.send_photo(chat_id: chat_id,
|
|
170
|
+
photo: photo,
|
|
171
|
+
caption: caption,
|
|
172
|
+
disable_notification: disable_notification,
|
|
173
|
+
reply_to_message_id: reply_to_message_id,
|
|
174
|
+
reply_markup: reply_markup)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def send_audio(chat_id: @message.from.to,
|
|
178
|
+
audio:,
|
|
179
|
+
caption: nil,
|
|
180
|
+
duration: nil,
|
|
181
|
+
performer: nil,
|
|
182
|
+
title: nil,
|
|
183
|
+
disable_notification: false,
|
|
184
|
+
reply_to_message_id: nil,
|
|
185
|
+
reply_markup: nil)
|
|
186
|
+
|
|
187
|
+
@api.send_audio(chat_id: chat_id,
|
|
188
|
+
audio: audio,
|
|
189
|
+
caption: caption,
|
|
190
|
+
duration: duration,
|
|
191
|
+
performer: performer,
|
|
192
|
+
title: title,
|
|
193
|
+
disable_notification: disable_notification,
|
|
194
|
+
reply_to_message_id: reply_to_message_id,
|
|
195
|
+
reply_markup: reply_markup)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def send_document(chat_id: @message.from.id,
|
|
199
|
+
document:,
|
|
200
|
+
caption: nil,
|
|
201
|
+
disable_notification: false,
|
|
202
|
+
reply_to_message_id: nil,
|
|
203
|
+
reply_markup: nil)
|
|
204
|
+
@api.send_document(chat_id: chat_id,
|
|
205
|
+
document: document,
|
|
206
|
+
caption: caption,
|
|
207
|
+
disable_notification: disable_notification,
|
|
208
|
+
reply_to_message_id: reply_to_message_id,
|
|
209
|
+
reply_markup: reply_markup)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def send_sticker(chat_id: @message.from.id,
|
|
213
|
+
sticker:,
|
|
214
|
+
caption: nil,
|
|
215
|
+
disable_notification: false,
|
|
216
|
+
reply_to_message_id: nil,
|
|
217
|
+
reply_markup: nil)
|
|
218
|
+
@api.send_sticker(chat_id: chat_id,
|
|
219
|
+
sticker: sticker,
|
|
220
|
+
caption: caption,
|
|
221
|
+
disable_notification: disable_notification,
|
|
222
|
+
reply_to_message_id: reply_to_message_id,
|
|
223
|
+
reply_markup: reply_markup)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def send_video(chat_id: @message.from.id,
|
|
227
|
+
video:,
|
|
228
|
+
width: nil,
|
|
229
|
+
height: nil,
|
|
230
|
+
caption: nil,
|
|
231
|
+
duration: nil,
|
|
232
|
+
disable_notification: false,
|
|
233
|
+
reply_to_message_id: nil,
|
|
234
|
+
reply_markup: nil)
|
|
235
|
+
@api.send_video(chat_id: chat_id,
|
|
236
|
+
video: video,
|
|
237
|
+
width: width,
|
|
238
|
+
height: height,
|
|
239
|
+
caption: caption,
|
|
240
|
+
duration: duration,
|
|
241
|
+
disable_notification: disable_notification,
|
|
242
|
+
reply_to_message_id: reply_to_message_id,
|
|
243
|
+
reply_markup: reply_markup)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def send_voice(chat_id: @message.from.to,
|
|
247
|
+
voice:,
|
|
248
|
+
caption: nil,
|
|
249
|
+
duration: nil,
|
|
250
|
+
disable_notification: false,
|
|
251
|
+
reply_to_message_id: nil,
|
|
252
|
+
reply_markup: nil)
|
|
253
|
+
|
|
254
|
+
@api.send_voice(chat_id: chat_id,
|
|
255
|
+
voice: voice,
|
|
256
|
+
caption: caption,
|
|
257
|
+
duration: duration,
|
|
258
|
+
disable_notification: disable_notification,
|
|
259
|
+
reply_to_message_id: reply_to_message_id,
|
|
260
|
+
reply_markup: reply_markup)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def send_video_note(chat_id: @message.from.id,
|
|
264
|
+
video_note:,
|
|
265
|
+
length: nil,
|
|
266
|
+
duration: nil,
|
|
267
|
+
disable_notification: false,
|
|
268
|
+
reply_to_message_id: nil,
|
|
269
|
+
reply_markup: nil)
|
|
270
|
+
@api.send_video_note(chat_id: chat_id,
|
|
271
|
+
video_note: video_note,
|
|
272
|
+
length: length,
|
|
273
|
+
duration: duration,
|
|
274
|
+
disable_notification: disable_notification,
|
|
275
|
+
reply_to_message_id: reply_to_message_id,
|
|
276
|
+
reply_markup: reply_markup)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
def send_location(chat_id: @message.from.to,
|
|
280
|
+
latitude:,
|
|
281
|
+
longitude:,
|
|
282
|
+
disable_notification: false,
|
|
283
|
+
reply_to_message_id: nil,
|
|
284
|
+
reply_markup: nil)
|
|
285
|
+
|
|
286
|
+
@api.send_location(chat_id: chat_id,
|
|
287
|
+
latitude: latitude,
|
|
288
|
+
longitude: longitude,
|
|
289
|
+
disable_notification: disable_notification,
|
|
290
|
+
reply_to_message_id: reply_to_message_id,
|
|
291
|
+
reply_markup: reply_markup)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def send_venue(chat_id: @message.from.to,
|
|
295
|
+
latitude:,
|
|
296
|
+
longitude:,
|
|
297
|
+
title:,
|
|
298
|
+
address:,
|
|
299
|
+
foursquare_id: nil,
|
|
300
|
+
disable_notification: false,
|
|
301
|
+
reply_to_message_id: nil,
|
|
302
|
+
reply_markup: nil)
|
|
303
|
+
|
|
304
|
+
@api.send_venue(chat_id: chat_id,
|
|
305
|
+
latitude: latitude,
|
|
306
|
+
longitude: longitude,
|
|
307
|
+
title: title,
|
|
308
|
+
address: address,
|
|
309
|
+
foursquare_id: foursquare_id,
|
|
310
|
+
disable_notification: disable_notification,
|
|
311
|
+
reply_to_message_id: reply_to_message_id,
|
|
312
|
+
reply_markup: reply_markup)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def send_contact(chat_id: @message.from.to,
|
|
316
|
+
phone_number:,
|
|
317
|
+
first_name:,
|
|
318
|
+
last_name: nil,
|
|
319
|
+
disable_notification: false,
|
|
320
|
+
reply_to_message_id: nil,
|
|
321
|
+
reply_markup: nil)
|
|
322
|
+
|
|
323
|
+
@api.send_contact(chat_id: chat_id,
|
|
324
|
+
phone_number: phone_number,
|
|
325
|
+
first_name: first_name,
|
|
326
|
+
last_name: last_name,
|
|
327
|
+
disable_notification: disable_notification,
|
|
328
|
+
reply_to_message_id: reply_to_message_id,
|
|
329
|
+
reply_markup: reply_markup)
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
def send_chat_action(chat_id: @message.from.id,
|
|
333
|
+
action:)
|
|
334
|
+
@api.send_chat_action(chat_id: chat_id,
|
|
335
|
+
action: action)
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def get_user_profile_photos(chat_id: @message.from.id,
|
|
339
|
+
offset: nil,
|
|
340
|
+
limit: nil)
|
|
341
|
+
@api.get_user_profile_photos(chat_id: chat_id,
|
|
342
|
+
offset: offset,
|
|
343
|
+
limit: limit)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def kick_chat_member(chat_id:,
|
|
347
|
+
user_id:)
|
|
348
|
+
@api.kick_chat_member(chat_id: chat_id,
|
|
349
|
+
user_id: user_id)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def unban_chat_member(chat_id:,
|
|
353
|
+
user_id:)
|
|
354
|
+
@api.unban_chat_member(chat_id: chat_id,
|
|
355
|
+
user_id: user_id)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def leave_chat(chat_id:)
|
|
359
|
+
@api.leave_chat(chat_id: chat_id)
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def get_chat(chat_id:)
|
|
363
|
+
@api.get_chat(chat_id: chat_id)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def get_chat_administrators(chat_id:)
|
|
367
|
+
@api.get_chat_administrators(chat_id: chat_id)
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def get_chat_members_count(chat_id:)
|
|
371
|
+
@api.get_chat_members_count(chat_id: chat_id)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
def get_chat_member(chat_id:, user_id:)
|
|
375
|
+
@api.get_chat_member(chat_id: chat_id,
|
|
376
|
+
user_id: user_id)
|
|
377
|
+
end
|
|
378
|
+
|
|
128
379
|
end
|
|
129
380
|
|