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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +0 -2
  3. data/lib/api/delete_apis.rb +6 -6
  4. data/lib/api/get_apis.rb +22 -16
  5. data/lib/api/nstandard.rb +4 -1
  6. data/lib/api/other_apis.rb +19 -19
  7. data/lib/api/send_apis.rb +17 -17
  8. data/lib/api/set_apis.rb +14 -15
  9. data/lib/core_api.rb +3 -1
  10. data/lib/teleruby.rb +7 -2
  11. data/teleruby.gemspec +1 -1
  12. metadata +3 -53
  13. data/lib/api/all.rb +0 -12
  14. data/lib/objects/all.rb +0 -42
  15. data/lib/teleruby/all_apis.rb +0 -22
  16. data/lib/teleruby/api/delete_apis.rb +0 -58
  17. data/lib/teleruby/api/get_apis.rb +0 -172
  18. data/lib/teleruby/api/nstandard.rb +0 -27
  19. data/lib/teleruby/api/other_apis.rb +0 -241
  20. data/lib/teleruby/api/send_apis.rb +0 -206
  21. data/lib/teleruby/api/set_apis.rb +0 -137
  22. data/lib/teleruby/core_api.rb +0 -52
  23. data/lib/teleruby/objects/all.rb +0 -42
  24. data/lib/teleruby/objects/animation.rb +0 -40
  25. data/lib/teleruby/objects/audio.rb +0 -39
  26. data/lib/teleruby/objects/bot_command.rb +0 -24
  27. data/lib/teleruby/objects/callback_query.rb +0 -66
  28. data/lib/teleruby/objects/chat.rb +0 -164
  29. data/lib/teleruby/objects/chat_member.rb +0 -142
  30. data/lib/teleruby/objects/chat_permissions.rb +0 -59
  31. data/lib/teleruby/objects/chat_photo.rb +0 -37
  32. data/lib/teleruby/objects/chosen_inline_result.rb +0 -45
  33. data/lib/teleruby/objects/contact.rb +0 -37
  34. data/lib/teleruby/objects/dice.rb +0 -21
  35. data/lib/teleruby/objects/document.rb +0 -29
  36. data/lib/teleruby/objects/file.rb +0 -32
  37. data/lib/teleruby/objects/game.rb +0 -65
  38. data/lib/teleruby/objects/inline_query.rb +0 -44
  39. data/lib/teleruby/objects/inlinekeyboardbutton.rb +0 -59
  40. data/lib/teleruby/objects/inlinekeyboardmarkup.rb +0 -31
  41. data/lib/teleruby/objects/location.rb +0 -21
  42. data/lib/teleruby/objects/mask_position.rb +0 -35
  43. data/lib/teleruby/objects/message.rb +0 -400
  44. data/lib/teleruby/objects/message_entity.rb +0 -95
  45. data/lib/teleruby/objects/order_info.rb +0 -36
  46. data/lib/teleruby/objects/photo_size.rb +0 -14
  47. data/lib/teleruby/objects/poll.rb +0 -97
  48. data/lib/teleruby/objects/poll_answer.rb +0 -29
  49. data/lib/teleruby/objects/poll_option.rb +0 -22
  50. data/lib/teleruby/objects/pre_checkout_query.rb +0 -50
  51. data/lib/teleruby/objects/same/common.rb +0 -31
  52. data/lib/teleruby/objects/same/common_2.rb +0 -32
  53. data/lib/teleruby/objects/shipping_address.rb +0 -39
  54. data/lib/teleruby/objects/shipping_query.rb +0 -32
  55. data/lib/teleruby/objects/sticker.rb +0 -59
  56. data/lib/teleruby/objects/update.rb +0 -207
  57. data/lib/teleruby/objects/user.rb +0 -66
  58. data/lib/teleruby/objects/user_profile_photos.rb +0 -36
  59. data/lib/teleruby/objects/venue.rb +0 -40
  60. data/lib/teleruby/objects/video.rb +0 -39
  61. data/lib/teleruby/objects/video_note.rb +0 -50
  62. data/lib/teleruby/objects/voice.rb +0 -20
  63. data/lib/teleruby/version.rb +0 -3
@@ -1,44 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative 'user'
5
- require_relative 'location'
6
-
7
- # This object represents an incoming inline query. When the user sends
8
- # an empty query, your bot could return some default or trending results.
9
- class InlineQuery
10
- def initialize(query) # :nodoc:
11
- @query = query
12
- end
13
-
14
- # Unique identifier for this query
15
- def id
16
- @query.id
17
- end
18
-
19
- # Sender.
20
- # User object
21
- def from
22
- User.new(@query.from)
23
- end
24
-
25
- # +Optional+. Sender location, only for bots that request user location,
26
- def location
27
- lcation = @query.location
28
- unless lcation.nil?
29
- return Location.new(lcation)
30
- end
31
-
32
- false
33
- end
34
-
35
- # Text of the query (up to 256 characters)
36
- def query
37
- @query.query
38
- end
39
-
40
- # Offset of the results to be returned, can be controlled by the bot.
41
- def offset
42
- @query.offset
43
- end
44
- end
@@ -1,59 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- # ===This object represents one button of an inline keyboard.
5
- # You must use exactly one of the optional fields.
6
- class InlineKeyboardButton
7
- def initialize(button) # :nodoc:
8
- @button = button
9
- end
10
-
11
- # Label text on the button.
12
- def text
13
- @button.text
14
- end
15
-
16
- # +Optional+. HTTP or tg:// url to be opened when button is pressed
17
- def url
18
- @button.url
19
- end
20
-
21
- # +Optional+. An HTTP URL used to automatically authorize the user.
22
- # Can be used as a replacement for the Telegram
23
- # {Login Widget.}[https://core.telegram.org/widgets/login]
24
- def login_url
25
- @button.login_url
26
- end
27
-
28
- # +Optional+. Data to be sent in a CallbackQuery to the bot when
29
- # button is pressed, 1-64 bytes.
30
- def callback_data
31
- @button.callback_data
32
- end
33
-
34
- # +Optional+. If set, pressing the button will prompt the user to
35
- # select one of their chats, open that chat and insert the bot's
36
- # username and the specified inline query in the input field.
37
- # Can be empty, in which case just the bot's username will be inserted.
38
- def switch_inline_query
39
- @button.switch_inline_query
40
- end
41
-
42
- # +Optional.+ If set, pressing the button will insert the bot's username
43
- # and the specified inline query in the current chat's input field.
44
- # Can be empty, in which case only the bot's username will be inserted.
45
- def switch_inline_query_current_chat
46
- @button.switch_inline_query_current_chat
47
- end
48
-
49
- # +Optional+. Description of the game that will be launched when the
50
- # user presses the button.
51
- def callback_game
52
- @button.callback_game
53
- end
54
-
55
- # +Optional+. Specify True, to send a Pay button.
56
- def pay?
57
- @button.pay
58
- end
59
- end
@@ -1,31 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative 'inlinekeyboardbutton'
5
-
6
- # This object represents an inline keyboard that appears
7
- # right next to the message it belongs to.
8
- class InlineKeyboardMarkup
9
- def initialize(mup) # :nodoc:
10
- @mup = mup
11
- end
12
-
13
- # Array of button rows, each represented by an Array of
14
- # InlineKeyboardButton objects.
15
- def inline_keyboard
16
- data = @mup.inline_keyboard
17
- unless data.empty?
18
- ary = []
19
- data.each do |e|
20
- ary2 = []
21
- e.each do |f|
22
- ary2 << InlineKeyboardButton.new(f)
23
- end
24
- ary << ary2
25
- end
26
- return ary
27
- end
28
-
29
- false
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- ##
5
- # +Monday+, +August+ +24+ +2020+ +EAT+
6
- # ===This object represents a point on the map
7
- class Location
8
- def initialize(location) # :nodoc:
9
- @loc = location
10
- end
11
-
12
- # Longitude as defined by sender.
13
- def longitude
14
- @loc.longitude
15
- end
16
-
17
- # Latitude as defined by sender.
18
- def latitude
19
- @loc.latitude
20
- end
21
- end
@@ -1,35 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- # This object describes the position on faces where a mask should be
5
- # placed by default.
6
- class MaskPosition
7
- def initialize(pos) # :nodoc:
8
- @pos = pos
9
- end
10
-
11
- # The part of the face relative to which the mask should be placed.
12
- # One of “forehead”, “eyes”, “mouth”, or “chin”.
13
- def point
14
- @pos.point
15
- end
16
-
17
- # Shift by X-axis measured in widths of the mask scaled to the face size,
18
- # from left to right. For example, choosing -1.0 will place mask just to
19
- # the left of the default mask position.
20
- def x_shift
21
- @pos.x_shift
22
- end
23
-
24
- # Shift by Y-axis measured in heights of the mask scaled to the face size,
25
- # from top to bottom. For example, 1.0 will place the mask just below the
26
- # default mask position.
27
- def y_shift
28
- @pos.y_shift
29
- end
30
-
31
- # Mask scaling coefficient. For example, 2.0 means double size.
32
- def scale
33
- @pos.scale
34
- end
35
- end
@@ -1,400 +0,0 @@
1
- #!/usr/bin/ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative 'user'
5
- require_relative 'chat'
6
- require_relative 'message_entity'
7
- require_relative 'animation'
8
- require_relative 'audio'
9
- require_relative 'document'
10
- require_relative 'photo_size'
11
- require_relative 'sticker'
12
- require_relative 'video'
13
- require_relative 'contact'
14
- require_relative 'dice'
15
- require_relative 'venue'
16
- require_relative 'game'
17
- require_relative 'location'
18
- require_relative 'inlinekeyboardmarkup'
19
-
20
- ##
21
- # +Monday+, +August+ +24+ +2020+ +EAT+
22
- # ===This object represents a message.
23
- class Message
24
- def initialize(msg) # :nodoc:
25
- @message = msg
26
- end
27
-
28
- # Unique message identifier inside the chat.
29
- def message_id
30
- @message.message_id
31
- end
32
-
33
- # +Optional.+ Sender, empty for messages sent to channels.
34
- # Returns User object.
35
- def from
36
- frm = @message.from
37
- unless frm.nil?
38
- return User.new(frm)
39
- end
40
-
41
- false
42
- end
43
-
44
- # TDate Object the message was sent in Unix time
45
- def date
46
- return TDate.new(@message.date)
47
- end
48
-
49
- # Conversation the message belongs to.
50
- # Returns Chat object
51
- def chat
52
- Chat.new(@message.chat)
53
- end
54
-
55
- # +Optional.+ For forwarded messages, sender of the original message.
56
- # Returns Chat object
57
- def forward_from
58
- f_from = @message.forward_from
59
- unless f_from.nil?
60
- return User.new(f_from)
61
- end
62
-
63
- false
64
- end
65
-
66
- # +Optional.+ For messages forwarded from channels, information about
67
- # the original channel.
68
- # Returns Chat object.
69
- def forward_from_chat
70
- ff_chat = @message.forward_from_chat
71
- unless ff_chat.nil?
72
- return Chat.new(ff_chat)
73
- end
74
-
75
- false
76
- end
77
-
78
- # +Optional.+ For messages forwarded from channels, identifier of the
79
- # original message in the channel.
80
- def forward_from_message_id
81
- @message.forward_from_message_id
82
- end
83
-
84
- # +Optional.+ For messages forwarded from channels, signature of the
85
- # post author if present.
86
- def forward_signature
87
- @message.forward_signature
88
- end
89
-
90
- # +Optional+. Sender's name for messages forwarded from users who
91
- # disallow adding a link to their account in forwarded messages.
92
- def forward_sender_name
93
- @message.forward_sender_name
94
- end
95
-
96
- # +Optional.+ For forwarded messages, date the original message was
97
- # sent in Unix time.
98
- # Returns TDate object.
99
- def forward_date
100
- TDate.new(@message.forward_date)
101
- end
102
-
103
- # +Optional.+ For replies, the original message. Note that the Message
104
- # object in this field will not contain further #reply_to_message
105
- # fields even if it itself is a reply.
106
- # Returns Message object
107
- def reply_to_message
108
- r_t_msg = @message.reply_to_message
109
- unless r_t_msg.nil?
110
- return Message.new(r_t_msg)
111
- end
112
-
113
- false
114
- end
115
-
116
- # +Optional+. Bot through which the message was sent.
117
- # Returns User object.
118
- def via_bot
119
- v_bot = @message.via_bot
120
- unless v_bot.nil?
121
- return User.new(v_bot)
122
- end
123
-
124
- false
125
- end
126
-
127
- # +Optional+. Retuns TDate object.
128
- def edit_date
129
- TDate.new(@messag.edit_date)
130
- end
131
-
132
- # +Optional+. The unique identifier of a media message group this
133
- # message belongs to.
134
- def media_group_id
135
- @message.media_group_id
136
- end
137
-
138
- # +Optional.+ Signature of the post author for messages in channels.
139
- def author_signature
140
- @message.author_signature
141
- end
142
-
143
- # +Optional+. For text messages, the actual UTF-8 text of the message,
144
- # 0-4096 characters
145
- def text
146
- @message.text
147
- end
148
-
149
- # +Optional.+ For text messages, special entities like usernames,
150
- # URLs, bot commands, etc. that appear in the text.
151
- # Returns array of MessageEntity object
152
- def entities
153
- empty_entity = []
154
- entitys = @message.entities
155
- unless entitys.empty?
156
- entitys.each do |ent|
157
- empty_entity << MessageEntity.new(ent)
158
- end
159
- return empty_entity
160
- end
161
-
162
- false
163
- end
164
-
165
- # +Optional.+ Message is an animation, information about the animation.
166
- # For backward compatibility, when this field is set, the document
167
- # field will also be set.
168
- # Returns Animation object
169
- def animation
170
- an = @message.animation
171
- unless an.nil?
172
- return Animation.new(an)
173
- end
174
-
175
- false
176
- end
177
-
178
- # +Optional+. message is an Audio file, information about the file.
179
- def audio
180
- ad = @message.audio
181
- if ad
182
- return Audio.new(ad)
183
- end
184
-
185
- false
186
- end
187
-
188
- # +Optional+. message is a general file, information about the file.
189
- # Returns Document object.
190
- def document
191
- doc = @message.document
192
- unless doc.nil?
193
- return Document.new(doc)
194
- end
195
-
196
- false
197
- end
198
-
199
- # +Optional+. message is a Photo, available sizes of the photo.
200
- # returns array of PhotoSize object
201
- def photo
202
- poto = @message.photo
203
- e_photo = []
204
- unless poto.empty?
205
- poto.each do
206
- e_photo << PhotoSize.new(e_photo)
207
- end
208
- return e_photo
209
- end
210
-
211
- false
212
- end
213
-
214
- # +Optional.+ Message is a sticker, information about the sticker
215
- # returns Sticker object
216
- def sticker
217
- stiker = @message.sticker
218
- unless stiker.nil?
219
- return Sticker.new(stiker)
220
- end
221
-
222
- false
223
- end
224
-
225
- # +Optional.+ Message is a Video, information about the video.
226
- def video
227
- vd = @message.video
228
- unless vd.nil?
229
- return Video.new(vd)
230
- end
231
-
232
- false
233
- end
234
-
235
- # +Optional.+ Message is a VideoNote, information about the video message.
236
- def video_note
237
- vnot = @message.video_note
238
- unless vnot.nil?
239
- return VideoNote.new(vnot)
240
- end
241
-
242
- false
243
- end
244
-
245
- # +Optional+. message is a Voice message, information about the file.
246
- def voice
247
- vc = @message.voice
248
- unless vc.nil?
249
- return Voice.new(vc)
250
- end
251
-
252
- false
253
- end
254
-
255
- # +Optional+. Caption for the animation, audio, document, photo, video
256
- # or voice, 0-1024 characters.
257
- def caption
258
- @message.caption
259
- end
260
-
261
- # +Optional.+ For messages with a caption, special entities like
262
- # usernames, URLs, bot commands, etc. that appear in the caption.
263
- def caption_entities
264
- c_entitys = @message.caption_entities
265
- empty_ent = []
266
- unless c_entitys.empty?
267
- c_entitys.each do |ent|
268
- empty_ent << MessageEntity.new(ent)
269
- end
270
- return empty_ent
271
- end
272
-
273
- false
274
- end
275
-
276
- # +Optional+. Message is a shared contact, information about the contact.
277
- def contact
278
- kontakt = @message.contact
279
- unless kontakt.nil?
280
- return Contact.new(kontakt)
281
- end
282
-
283
- false
284
- end
285
-
286
- # +Optional+. Message is a Dice with random value from 1 to 6.
287
- def dice
288
- dis = @message.dice
289
- unless dis.nil?
290
- return Dice.new(dis)
291
- end
292
-
293
- false
294
- end
295
-
296
- # +Optional+. Message is a Game, information about the game.
297
- def game
298
- gam = @message.game
299
- unless gam.nil?
300
- return Game.new(gam)
301
- end
302
-
303
- false
304
- end
305
-
306
- def text_msg?
307
- !text.nil?
308
- end
309
-
310
- # returns true if the update is for replied msg
311
- def reply_msg?
312
- !@message.reply_to_message.nil?
313
- end
314
-
315
- def video_msg?
316
- !@message.video.nil?
317
- end
318
-
319
- def audio_msg?
320
- !@message.audio.nil?
321
- end
322
-
323
- def document_msg?
324
- !@message.document.nil?
325
- end
326
-
327
- def contact_msg?
328
- !@message.contact.nil?
329
- end
330
-
331
- def forward_msg?
332
- !(@update.forward_from) || (@update.forward_from_chat).nil?
333
- end
334
-
335
- def animation_msg?
336
- !@message.animation.nil?
337
- end
338
-
339
- def photo_msg?
340
- !(@message.photo).empty?
341
- end
342
-
343
- def voice_msg?
344
- !@message.voice.nil?
345
- end
346
-
347
- def video_note_msg?
348
- !@message.video_note.nil?
349
- end
350
-
351
- def sticker_msg?
352
- !@message.sticker.nil?
353
- end
354
-
355
- def game_msg?
356
- !@message.game.nil?
357
- end
358
-
359
- def poll_msg?
360
- !@message.poll.nil?
361
- end
362
-
363
- def venue_msg?
364
- !@message.venue.nil?
365
- end
366
-
367
- def location_msg?
368
- !@message.location.nil?
369
- end
370
-
371
- def new_chat_member?
372
- !@message.new_chat_member.nil?
373
- end
374
-
375
- def left_chat_member?
376
- !@message.left_chat_member.nil?
377
- end
378
-
379
- def new_chat_title?
380
- !@message.new_chat_title.nil?
381
- end
382
-
383
- def new_chat_photo?
384
- !@message.new_chat_photo.nil?
385
- end
386
-
387
- def pinned_msg?
388
- !@message.pinned_message.nil?
389
- end
390
-
391
- def delete_chat_photo?
392
- !@message.delete_chat_photo.nil?
393
- end
394
-
395
- def reply_markup?
396
- !@message.reply_markup.nil?
397
- end
398
- end
399
-
400
- # ughhhhh God!