dialog_bot_ruby 0.8.7
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 +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +13 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +68 -0
- data/Gemfile +3 -0
- data/LICENSE +14 -0
- data/README.md +197 -0
- data/Rakefile +15 -0
- data/bin/console +6 -0
- data/bin/setup +5 -0
- data/dialog_bot_ruby.gemspec +32 -0
- data/examples/bot.rb +17 -0
- data/lib/telegram/bot/adapters/socks5.rb +24 -0
- data/lib/telegram/bot/api.rb +172 -0
- data/lib/telegram/bot/client.rb +77 -0
- data/lib/telegram/bot/configuration.rb +11 -0
- data/lib/telegram/bot/exceptions/base.rb +7 -0
- data/lib/telegram/bot/exceptions/response_error.rb +32 -0
- data/lib/telegram/bot/exceptions.rb +2 -0
- data/lib/telegram/bot/null_logger.rb +11 -0
- data/lib/telegram/bot/types/animation.rb +13 -0
- data/lib/telegram/bot/types/audio.rb +14 -0
- data/lib/telegram/bot/types/base.rb +10 -0
- data/lib/telegram/bot/types/callback_game.rb +8 -0
- data/lib/telegram/bot/types/callback_query.rb +15 -0
- data/lib/telegram/bot/types/chat.rb +22 -0
- data/lib/telegram/bot/types/chat_member.rb +24 -0
- data/lib/telegram/bot/types/chat_photo.rb +10 -0
- data/lib/telegram/bot/types/chosen_inline_result.rb +15 -0
- data/lib/telegram/bot/types/compactable.rb +26 -0
- data/lib/telegram/bot/types/contact.rb +13 -0
- data/lib/telegram/bot/types/document.rb +13 -0
- data/lib/telegram/bot/types/encrypted_credentials.rb +11 -0
- data/lib/telegram/bot/types/encrypted_passport_element.rb +16 -0
- data/lib/telegram/bot/types/file.rb +11 -0
- data/lib/telegram/bot/types/force_reply.rb +10 -0
- data/lib/telegram/bot/types/game.rb +14 -0
- data/lib/telegram/bot/types/game_high_score.rb +11 -0
- data/lib/telegram/bot/types/inline_keyboard_button.rb +15 -0
- data/lib/telegram/bot/types/inline_keyboard_markup.rb +20 -0
- data/lib/telegram/bot/types/inline_query.rb +15 -0
- data/lib/telegram/bot/types/inline_query_result_article.rb +19 -0
- data/lib/telegram/bot/types/inline_query_result_audio.rb +17 -0
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +14 -0
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +16 -0
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +15 -0
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +15 -0
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +16 -0
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +13 -0
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +16 -0
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +15 -0
- data/lib/telegram/bot/types/inline_query_result_contact.rb +19 -0
- data/lib/telegram/bot/types/inline_query_result_document.rb +20 -0
- data/lib/telegram/bot/types/inline_query_result_game.rb +12 -0
- data/lib/telegram/bot/types/inline_query_result_gif.rb +19 -0
- data/lib/telegram/bot/types/inline_query_result_location.rb +18 -0
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +19 -0
- data/lib/telegram/bot/types/inline_query_result_photo.rb +19 -0
- data/lib/telegram/bot/types/inline_query_result_venue.rb +20 -0
- data/lib/telegram/bot/types/inline_query_result_video.rb +21 -0
- data/lib/telegram/bot/types/inline_query_result_voice.rb +16 -0
- data/lib/telegram/bot/types/input_contact_message_content.rb +12 -0
- data/lib/telegram/bot/types/input_location_message_content.rb +10 -0
- data/lib/telegram/bot/types/input_media_photo.rb +11 -0
- data/lib/telegram/bot/types/input_media_video.rb +14 -0
- data/lib/telegram/bot/types/input_message_content.rb +8 -0
- data/lib/telegram/bot/types/input_text_message_content.rb +11 -0
- data/lib/telegram/bot/types/input_venue_message_content.rb +13 -0
- data/lib/telegram/bot/types/invoice.rb +13 -0
- data/lib/telegram/bot/types/keyboard_button.rb +11 -0
- data/lib/telegram/bot/types/labeled_price.rb +10 -0
- data/lib/telegram/bot/types/location.rb +10 -0
- data/lib/telegram/bot/types/mask_position.rb +12 -0
- data/lib/telegram/bot/types/message.rb +52 -0
- data/lib/telegram/bot/types/message_entity.rb +15 -0
- data/lib/telegram/bot/types/order_info.rb +12 -0
- data/lib/telegram/bot/types/passport_data.rb +10 -0
- data/lib/telegram/bot/types/passport_file.rb +11 -0
- data/lib/telegram/bot/types/photo_size.rb +12 -0
- data/lib/telegram/bot/types/pre_checkout_query.rb +15 -0
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +23 -0
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +10 -0
- data/lib/telegram/bot/types/shipping_address.rb +14 -0
- data/lib/telegram/bot/types/shipping_option.rb +11 -0
- data/lib/telegram/bot/types/shipping_query.rb +12 -0
- data/lib/telegram/bot/types/sticker.rb +16 -0
- data/lib/telegram/bot/types/sticker_set.rb +12 -0
- data/lib/telegram/bot/types/successful_payment.rb +15 -0
- data/lib/telegram/bot/types/update.rb +23 -0
- data/lib/telegram/bot/types/user.rb +14 -0
- data/lib/telegram/bot/types/user_profile_photos.rb +10 -0
- data/lib/telegram/bot/types/venue.rb +12 -0
- data/lib/telegram/bot/types/video.rb +15 -0
- data/lib/telegram/bot/types/video_note.rb +13 -0
- data/lib/telegram/bot/types/voice.rb +12 -0
- data/lib/telegram/bot/types.rb +77 -0
- data/lib/telegram/bot/version.rb +5 -0
- data/lib/telegram/bot.rb +29 -0
- metadata +286 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
class Client
|
|
4
|
+
attr_reader :api, :options
|
|
5
|
+
attr_accessor :logger
|
|
6
|
+
|
|
7
|
+
def self.run(*args, &block)
|
|
8
|
+
new(*args).run(&block)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(token, h = {})
|
|
12
|
+
@options = default_options.merge(h)
|
|
13
|
+
@api = Api.new(token)
|
|
14
|
+
@logger = options.delete(:logger)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run
|
|
18
|
+
yield self
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def listen(&block)
|
|
22
|
+
logger.info('Starting bot')
|
|
23
|
+
catch(:stop) {
|
|
24
|
+
loop { fetch_updates(&block) }
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# This can also be written in any calling code (the throw does not have to appear
|
|
29
|
+
# within the static scope of the catch), but is included here for completeness
|
|
30
|
+
def stop
|
|
31
|
+
throw :stop
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Listen for a given period of time (in minutes)
|
|
35
|
+
def listen_for(minutes = 15, &block)
|
|
36
|
+
counter = 15 * 60
|
|
37
|
+
interval = 5 # Check every 5 seconds
|
|
38
|
+
interval_timer = 1 # must start at 1
|
|
39
|
+
now = Time.now
|
|
40
|
+
while Time.now - now < counter
|
|
41
|
+
if interval_timer % interval == 0 #Every 5 attempts the activity will process
|
|
42
|
+
fetch_updates(&block)
|
|
43
|
+
end
|
|
44
|
+
interval_timer = interval_timer + 1
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def fetch_updates
|
|
49
|
+
response = api.getUpdates(options)
|
|
50
|
+
return unless response['ok']
|
|
51
|
+
|
|
52
|
+
response['result'].each do |data|
|
|
53
|
+
update = Types::Update.new(data)
|
|
54
|
+
@options[:offset] = update.update_id.next
|
|
55
|
+
message = update.current_message
|
|
56
|
+
log_incoming_message(message)
|
|
57
|
+
yield message
|
|
58
|
+
end
|
|
59
|
+
rescue Faraday::Error::TimeoutError
|
|
60
|
+
retry
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
def default_options
|
|
66
|
+
{ offset: 0, timeout: 20, logger: NullLogger.new }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def log_incoming_message(message)
|
|
70
|
+
uid = message.from ? message.from.id : nil
|
|
71
|
+
logger.info(
|
|
72
|
+
format('Incoming message: text="%s" uid=%s', message, uid)
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Exceptions
|
|
4
|
+
class ResponseError < Base
|
|
5
|
+
attr_reader :response
|
|
6
|
+
|
|
7
|
+
def initialize(response)
|
|
8
|
+
@response = response
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def to_s
|
|
12
|
+
super +
|
|
13
|
+
format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', '))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def error_code
|
|
17
|
+
data[:error_code] || data['error_code']
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def data
|
|
23
|
+
@data ||= begin
|
|
24
|
+
JSON.parse(response.body)
|
|
25
|
+
rescue JSON::ParserError
|
|
26
|
+
{ error_code: response.status, uri: response.env.url.to_s }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class Audio < Base
|
|
5
|
+
attribute :file_id, String
|
|
6
|
+
attribute :duration, Integer
|
|
7
|
+
attribute :performer, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :mime_type, String
|
|
10
|
+
attribute :file_size, Integer
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class CallbackQuery < Base
|
|
5
|
+
attribute :id, String
|
|
6
|
+
attribute :from, User
|
|
7
|
+
attribute :message, Message
|
|
8
|
+
attribute :inline_message_id, String
|
|
9
|
+
attribute :chat_instance, String
|
|
10
|
+
attribute :data, String
|
|
11
|
+
attribute :game_short_name, String
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class Chat < Base
|
|
5
|
+
include Virtus.model(finalize: false)
|
|
6
|
+
include Compactable
|
|
7
|
+
|
|
8
|
+
attribute :id, Integer
|
|
9
|
+
attribute :type, String
|
|
10
|
+
attribute :title, String
|
|
11
|
+
attribute :username, String
|
|
12
|
+
attribute :first_name, String
|
|
13
|
+
attribute :last_name, String
|
|
14
|
+
attribute :all_members_are_administrators, Boolean
|
|
15
|
+
attribute :photo, ChatPhoto
|
|
16
|
+
attribute :description, String
|
|
17
|
+
attribute :invite_link, String
|
|
18
|
+
attribute :pinned_message, 'Telegram::Bot::Types::Message'
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class ChatMember < Base
|
|
5
|
+
attribute :user, User
|
|
6
|
+
attribute :status, String
|
|
7
|
+
attribute :until_date, Integer
|
|
8
|
+
attribute :can_be_edited, Boolean
|
|
9
|
+
attribute :can_change_info, Boolean
|
|
10
|
+
attribute :can_post_messages, Boolean
|
|
11
|
+
attribute :can_edit_messages, Boolean
|
|
12
|
+
attribute :can_delete_messages, Boolean
|
|
13
|
+
attribute :can_invite_users, Boolean
|
|
14
|
+
attribute :can_restrict_members, Boolean
|
|
15
|
+
attribute :can_pin_messages, Boolean
|
|
16
|
+
attribute :can_promote_members, Boolean
|
|
17
|
+
attribute :can_send_messages, Boolean
|
|
18
|
+
attribute :can_send_media_messages, Boolean
|
|
19
|
+
attribute :can_send_other_messages, Boolean
|
|
20
|
+
attribute :can_add_web_page_previews, Boolean
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class ChosenInlineResult < Base
|
|
5
|
+
attribute :result_id, String
|
|
6
|
+
attribute :from, User
|
|
7
|
+
attribute :location, Location
|
|
8
|
+
attribute :inline_message_id, String
|
|
9
|
+
attribute :query, String
|
|
10
|
+
|
|
11
|
+
alias to_s query
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
module Compactable
|
|
5
|
+
def to_compact_hash
|
|
6
|
+
Hash[attributes.dup.delete_if { |_, v| v.nil? }.map do |key, value|
|
|
7
|
+
value = recursive_hash_conversion(value)
|
|
8
|
+
[key, value]
|
|
9
|
+
end]
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def recursive_hash_conversion(value)
|
|
15
|
+
if value.class.ancestors.include?(Telegram::Bot::Types::Base)
|
|
16
|
+
value.to_compact_hash
|
|
17
|
+
elsif value.is_a?(Array)
|
|
18
|
+
value.map { |arr_content| recursive_hash_conversion(arr_content) }
|
|
19
|
+
else
|
|
20
|
+
value
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class EncryptedPassportElement < Base
|
|
5
|
+
attribute :type, String
|
|
6
|
+
attribute :data, String
|
|
7
|
+
attribute :phone_number, String
|
|
8
|
+
attribute :email, String
|
|
9
|
+
attribute :files, Array[PassportFile]
|
|
10
|
+
attribute :front_side, PassportFile
|
|
11
|
+
attribute :reverse_side, PassportFile
|
|
12
|
+
attribute :selfie, PassportFile
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class Game < Base
|
|
5
|
+
attribute :title, String
|
|
6
|
+
attribute :description, String
|
|
7
|
+
attribute :photo, Array[PhotoSize]
|
|
8
|
+
attribute :text, String
|
|
9
|
+
attribute :text_entities, Array[MessageEntity]
|
|
10
|
+
attribute :animation, Animation
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineKeyboardButton < Base
|
|
5
|
+
attribute :text, String
|
|
6
|
+
attribute :url, String
|
|
7
|
+
attribute :callback_data, String
|
|
8
|
+
attribute :switch_inline_query, String
|
|
9
|
+
attribute :switch_inline_query_current_chat, String
|
|
10
|
+
attribute :callback_game, CallbackGame
|
|
11
|
+
attribute :pay, Boolean
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineKeyboardMarkup < Base
|
|
5
|
+
attribute :inline_keyboard, Array[Array[InlineKeyboardButton]]
|
|
6
|
+
|
|
7
|
+
def to_compact_hash
|
|
8
|
+
hsh = super
|
|
9
|
+
hsh[:inline_keyboard].map! do |arr|
|
|
10
|
+
arr.map do |item|
|
|
11
|
+
item.is_a?(InlineKeyboardButton) ? item.to_compact_hash : item
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
hsh
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQuery < Base
|
|
5
|
+
attribute :id, String
|
|
6
|
+
attribute :from, User
|
|
7
|
+
attribute :location, Location
|
|
8
|
+
attribute :query, String
|
|
9
|
+
attribute :offset, String
|
|
10
|
+
|
|
11
|
+
alias to_s query
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultArticle < Base
|
|
5
|
+
attribute :type, String, default: 'article'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :title, String
|
|
8
|
+
attribute :input_message_content, InputMessageContent
|
|
9
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
10
|
+
attribute :url, String
|
|
11
|
+
attribute :hide_url, Boolean
|
|
12
|
+
attribute :description, String
|
|
13
|
+
attribute :thumb_url, String
|
|
14
|
+
attribute :thumb_width, Integer
|
|
15
|
+
attribute :thumb_height, Integer
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultAudio < Base
|
|
5
|
+
attribute :type, String, default: 'audio'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :audio_url, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :caption, String
|
|
10
|
+
attribute :performer, String
|
|
11
|
+
attribute :audio_duration, Integer
|
|
12
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
13
|
+
attribute :input_message_content, InputMessageContent
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedAudio < Base
|
|
5
|
+
attribute :type, String, default: 'audio'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :audio_file_id, String
|
|
8
|
+
attribute :caption, String
|
|
9
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
10
|
+
attribute :input_message_content, InputMessageContent
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedDocument < Base
|
|
5
|
+
attribute :type, String, default: 'document'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :title, String
|
|
8
|
+
attribute :document_file_id, String
|
|
9
|
+
attribute :description, String
|
|
10
|
+
attribute :caption, String
|
|
11
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
12
|
+
attribute :input_message_content, InputMessageContent
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedGif < Base
|
|
5
|
+
attribute :type, String, default: 'gif'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :gif_file_id, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :caption, String
|
|
10
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
11
|
+
attribute :input_message_content, InputMessageContent
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedMpeg4Gif < Base
|
|
5
|
+
attribute :type, String, default: 'mpeg4_gif'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :mpeg4_file_id, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :caption, String
|
|
10
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
11
|
+
attribute :input_message_content, InputMessageContent
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedPhoto < Base
|
|
5
|
+
attribute :type, String, default: 'photo'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :photo_file_id, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :description, String
|
|
10
|
+
attribute :caption, String
|
|
11
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
12
|
+
attribute :input_message_content, InputMessageContent
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedSticker < Base
|
|
5
|
+
attribute :type, String, default: 'sticker'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :sticker_file_id, String
|
|
8
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
9
|
+
attribute :input_message_content, InputMessageContent
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedVideo < Base
|
|
5
|
+
attribute :type, String, default: 'video'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :video_file_id, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :description, String
|
|
10
|
+
attribute :caption, String
|
|
11
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
12
|
+
attribute :input_message_content, InputMessageContent
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Telegram
|
|
2
|
+
module Bot
|
|
3
|
+
module Types
|
|
4
|
+
class InlineQueryResultCachedVoice < Base
|
|
5
|
+
attribute :type, String, default: 'voice'
|
|
6
|
+
attribute :id, String
|
|
7
|
+
attribute :voice_file_id, String
|
|
8
|
+
attribute :title, String
|
|
9
|
+
attribute :caption, String
|
|
10
|
+
attribute :reply_markup, InlineKeyboardMarkup
|
|
11
|
+
attribute :input_message_content, InputMessageContent
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|