telegram-bot-ruby 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -0
- data/.github/workflows/ci.yml +0 -3
- data/.github/workflows/stale.yml +19 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -7
- data/CHANGELOG.md +16 -0
- data/Gemfile +11 -3
- data/LICENSE +0 -1
- data/README.md +64 -20
- data/Rakefile +0 -43
- data/bin/console +4 -1
- data/lib/telegram/bot/api/endpoints.rb +124 -0
- data/lib/telegram/bot/api.rb +20 -44
- data/lib/telegram/bot/client.rb +9 -10
- data/lib/telegram/bot/exceptions/response_error.rb +2 -8
- data/lib/telegram/bot/types/animation.rb +1 -1
- data/lib/telegram/bot/types/audio.rb +1 -1
- data/lib/telegram/bot/types/background_fill.rb +16 -0
- data/lib/telegram/bot/types/background_fill_freeform_gradient.rb +12 -0
- data/lib/telegram/bot/types/background_fill_gradient.rb +14 -0
- data/lib/telegram/bot/types/background_fill_solid.rb +12 -0
- data/lib/telegram/bot/types/background_type.rb +17 -0
- data/lib/telegram/bot/types/background_type_chat_theme.rb +12 -0
- data/lib/telegram/bot/types/background_type_fill.rb +13 -0
- data/lib/telegram/bot/types/background_type_pattern.rb +16 -0
- data/lib/telegram/bot/types/background_type_wallpaper.rb +15 -0
- data/lib/telegram/bot/types/birthdate.rb +13 -0
- data/lib/telegram/bot/types/bot_command.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope.rb +20 -0
- data/lib/telegram/bot/types/bot_command_scope_all_chat_administrators.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_group_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_all_private_chats.rb +1 -1
- data/lib/telegram/bot/types/bot_command_scope_chat.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_administrators.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_chat_member.rb +2 -2
- data/lib/telegram/bot/types/bot_command_scope_default.rb +1 -1
- data/lib/telegram/bot/types/bot_description.rb +11 -0
- data/lib/telegram/bot/types/bot_name.rb +11 -0
- data/lib/telegram/bot/types/bot_short_description.rb +11 -0
- data/lib/telegram/bot/types/business_connection.rb +16 -0
- data/lib/telegram/bot/types/business_intro.rb +13 -0
- data/lib/telegram/bot/types/business_location.rb +12 -0
- data/lib/telegram/bot/types/business_messages_deleted.rb +13 -0
- data/lib/telegram/bot/types/business_opening_hours.rb +12 -0
- data/lib/telegram/bot/types/business_opening_hours_interval.rb +12 -0
- data/lib/telegram/bot/types/callback_query.rb +1 -1
- data/lib/telegram/bot/types/chat.rb +1 -22
- data/lib/telegram/bot/types/chat_administrator_rights.rb +3 -0
- data/lib/telegram/bot/types/chat_background.rb +11 -0
- data/lib/telegram/bot/types/chat_boost.rb +14 -0
- data/lib/telegram/bot/types/chat_boost_added.rb +11 -0
- data/lib/telegram/bot/types/chat_boost_removed.rb +14 -0
- data/lib/telegram/bot/types/chat_boost_source.rb +16 -0
- data/lib/telegram/bot/types/chat_boost_source_gift_code.rb +12 -0
- data/lib/telegram/bot/types/chat_boost_source_giveaway.rb +15 -0
- data/lib/telegram/bot/types/chat_boost_source_premium.rb +12 -0
- data/lib/telegram/bot/types/chat_boost_updated.rb +12 -0
- data/lib/telegram/bot/types/chat_full_info.rb +54 -0
- data/lib/telegram/bot/types/chat_invite_link.rb +2 -0
- data/lib/telegram/bot/types/chat_location.rb +1 -1
- data/lib/telegram/bot/types/chat_member.rb +11 -2
- data/lib/telegram/bot/types/chat_member_administrator.rb +8 -5
- data/lib/telegram/bot/types/chat_member_banned.rb +2 -2
- data/lib/telegram/bot/types/chat_member_left.rb +2 -2
- data/lib/telegram/bot/types/chat_member_member.rb +3 -2
- data/lib/telegram/bot/types/chat_member_owner.rb +2 -2
- data/lib/telegram/bot/types/chat_member_restricted.rb +2 -2
- data/lib/telegram/bot/types/chat_member_updated.rb +2 -0
- data/lib/telegram/bot/types/chat_shared.rb +3 -0
- data/lib/telegram/bot/types/compactable.rb +2 -7
- data/lib/telegram/bot/types/copy_text_button.rb +11 -0
- data/lib/telegram/bot/types/document.rb +1 -1
- data/lib/telegram/bot/types/error.rb +14 -0
- data/lib/telegram/bot/types/external_reply_info.rb +34 -0
- data/lib/telegram/bot/types/force_reply.rb +3 -3
- data/lib/telegram/bot/types/gift.rb +15 -0
- data/lib/telegram/bot/types/gifts.rb +11 -0
- data/lib/telegram/bot/types/giveaway.rb +19 -0
- data/lib/telegram/bot/types/giveaway_completed.rb +14 -0
- data/lib/telegram/bot/types/giveaway_created.rb +11 -0
- data/lib/telegram/bot/types/giveaway_winners.rb +22 -0
- data/lib/telegram/bot/types/inaccessible_message.rb +13 -0
- data/lib/telegram/bot/types/inline_keyboard_button.rb +2 -0
- data/lib/telegram/bot/types/inline_query_result.rb +33 -0
- data/lib/telegram/bot/types/inline_query_result_article.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_audio.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_document.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_gif.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_mpeg4_gif.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_photo.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_sticker.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_cached_video.rb +2 -1
- data/lib/telegram/bot/types/inline_query_result_cached_voice.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_contact.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_document.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_game.rb +1 -1
- data/lib/telegram/bot/types/inline_query_result_gif.rb +4 -3
- data/lib/telegram/bot/types/inline_query_result_location.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_mpeg4_gif.rb +4 -3
- data/lib/telegram/bot/types/inline_query_result_photo.rb +3 -2
- data/lib/telegram/bot/types/inline_query_result_venue.rb +4 -4
- data/lib/telegram/bot/types/inline_query_result_video.rb +3 -2
- data/lib/telegram/bot/types/inline_query_result_voice.rb +1 -1
- data/lib/telegram/bot/types/inline_query_results_button.rb +13 -0
- data/lib/telegram/bot/types/input_contact_message_content.rb +1 -1
- data/lib/telegram/bot/types/input_invoice_message_content.rb +5 -5
- data/lib/telegram/bot/types/input_location_message_content.rb +1 -1
- data/lib/telegram/bot/types/input_media.rb +18 -0
- data/lib/telegram/bot/types/input_media_animation.rb +3 -2
- data/lib/telegram/bot/types/input_media_audio.rb +2 -2
- data/lib/telegram/bot/types/input_media_document.rb +2 -2
- data/lib/telegram/bot/types/input_media_photo.rb +2 -1
- data/lib/telegram/bot/types/input_media_video.rb +3 -2
- data/lib/telegram/bot/types/input_message_content.rb +10 -2
- data/lib/telegram/bot/types/input_paid_media.rb +15 -0
- data/lib/telegram/bot/types/input_paid_media_photo.rb +12 -0
- data/lib/telegram/bot/types/input_paid_media_video.rb +17 -0
- data/lib/telegram/bot/types/input_poll_option.rb +13 -0
- data/lib/telegram/bot/types/input_sticker.rb +15 -0
- data/lib/telegram/bot/types/input_text_message_content.rb +3 -3
- data/lib/telegram/bot/types/input_venue_message_content.rb +1 -1
- data/lib/telegram/bot/types/keyboard_button.rb +1 -1
- data/lib/telegram/bot/types/keyboard_button_request_chat.rb +3 -0
- data/lib/telegram/bot/types/keyboard_button_request_users.rb +17 -0
- data/lib/telegram/bot/types/link_preview_options.rb +15 -0
- data/lib/telegram/bot/types/location.rb +1 -1
- data/lib/telegram/bot/types/maybe_inaccessible_message.rb +15 -0
- data/lib/telegram/bot/types/menu_button.rb +16 -0
- data/lib/telegram/bot/types/menu_button_commands.rb +1 -1
- data/lib/telegram/bot/types/menu_button_default.rb +1 -1
- data/lib/telegram/bot/types/menu_button_web_app.rb +1 -1
- data/lib/telegram/bot/types/message.rb +30 -16
- data/lib/telegram/bot/types/message_id.rb +11 -0
- data/lib/telegram/bot/types/message_origin.rb +17 -0
- data/lib/telegram/bot/types/message_origin_channel.rb +15 -0
- data/lib/telegram/bot/types/message_origin_chat.rb +14 -0
- data/lib/telegram/bot/types/message_origin_hidden_user.rb +13 -0
- data/lib/telegram/bot/types/message_origin_user.rb +13 -0
- data/lib/telegram/bot/types/message_reaction_count_updated.rb +14 -0
- data/lib/telegram/bot/types/message_reaction_updated.rb +17 -0
- data/lib/telegram/bot/types/paid_media.rb +16 -0
- data/lib/telegram/bot/types/paid_media_info.rb +12 -0
- data/lib/telegram/bot/types/paid_media_photo.rb +12 -0
- data/lib/telegram/bot/types/paid_media_preview.rb +14 -0
- data/lib/telegram/bot/types/paid_media_purchased.rb +12 -0
- data/lib/telegram/bot/types/paid_media_video.rb +12 -0
- data/lib/telegram/bot/types/passport_element_error.rb +22 -0
- data/lib/telegram/bot/types/passport_element_error_data_field.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_front_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_reverse_side.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_selfie.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_file.rb +1 -1
- data/lib/telegram/bot/types/passport_element_error_translation_files.rb +2 -2
- data/lib/telegram/bot/types/passport_element_error_unspecified.rb +1 -1
- data/lib/telegram/bot/types/poll.rb +2 -1
- data/lib/telegram/bot/types/poll_answer.rb +2 -1
- data/lib/telegram/bot/types/poll_option.rb +2 -1
- data/lib/telegram/bot/types/prepared_inline_message.rb +12 -0
- data/lib/telegram/bot/types/reaction_count.rb +12 -0
- data/lib/telegram/bot/types/reaction_type.rb +16 -0
- data/lib/telegram/bot/types/reaction_type_custom_emoji.rb +12 -0
- data/lib/telegram/bot/types/reaction_type_emoji.rb +12 -0
- data/lib/telegram/bot/types/reaction_type_paid.rb +11 -0
- data/lib/telegram/bot/types/refunded_payment.rb +15 -0
- data/lib/telegram/bot/types/reply_keyboard_markup.rb +2 -2
- data/lib/telegram/bot/types/reply_keyboard_remove.rb +2 -2
- data/lib/telegram/bot/types/reply_parameters.rb +17 -0
- data/lib/telegram/bot/types/response_parameters.rb +12 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state.rb +16 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_failed.rb +11 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_pending.rb +11 -0
- data/lib/telegram/bot/types/revenue_withdrawal_state_succeeded.rb +13 -0
- data/lib/telegram/bot/types/shared_user.rb +15 -0
- data/lib/telegram/bot/types/star_transaction.rb +15 -0
- data/lib/telegram/bot/types/star_transactions.rb +11 -0
- data/lib/telegram/bot/types/sticker.rb +2 -1
- data/lib/telegram/bot/types/sticker_set.rb +1 -3
- data/lib/telegram/bot/types/story.rb +12 -0
- data/lib/telegram/bot/types/successful_payment.rb +3 -0
- data/lib/telegram/bot/types/switch_inline_query_chosen_chat.rb +15 -0
- data/lib/telegram/bot/types/text_quote.rb +14 -0
- data/lib/telegram/bot/types/transaction_partner.rb +18 -0
- data/lib/telegram/bot/types/transaction_partner_fragment.rb +12 -0
- data/lib/telegram/bot/types/transaction_partner_other.rb +11 -0
- data/lib/telegram/bot/types/transaction_partner_telegram_ads.rb +11 -0
- data/lib/telegram/bot/types/transaction_partner_telegram_api.rb +12 -0
- data/lib/telegram/bot/types/transaction_partner_user.rb +17 -0
- data/lib/telegram/bot/types/update.rb +9 -0
- data/lib/telegram/bot/types/user.rb +4 -2
- data/lib/telegram/bot/types/user_chat_boosts.rb +11 -0
- data/lib/telegram/bot/types/{user_shared.rb → users_shared.rb} +2 -2
- data/lib/telegram/bot/types/video.rb +1 -1
- data/lib/telegram/bot/types/video_note.rb +1 -1
- data/lib/telegram/bot/types/webhook_info.rb +1 -1
- data/lib/telegram/bot/types/write_access_allowed.rb +3 -0
- data/lib/telegram/bot/version.rb +1 -1
- data/lib/telegram/bot.rb +1 -0
- data/rakelib/parse_schema.rake +73 -0
- data/rakelib/rebuild_types.rake +90 -0
- data/telegram-bot-ruby.gemspec +1 -4
- data/utility/empty_type.erb +14 -0
- data/utility/type.erb +13 -0
- data/utility/type_attributes.json +5138 -0
- metadata +105 -5
- data/lib/telegram/bot/types/keyboard_button_request_user.rb +0 -13
@@ -3,8 +3,17 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
|
7
|
-
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
ChatMember = (
|
9
|
+
ChatMemberOwner |
|
10
|
+
ChatMemberAdministrator |
|
11
|
+
ChatMemberMember |
|
12
|
+
ChatMemberRestricted |
|
13
|
+
ChatMemberLeft |
|
14
|
+
ChatMemberBanned
|
15
|
+
)
|
16
|
+
# rubocop:enable Naming/ConstantName
|
8
17
|
end
|
9
18
|
end
|
10
19
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class ChatMemberAdministrator <
|
7
|
-
attribute :status, Types::String
|
6
|
+
class ChatMemberAdministrator < Base
|
7
|
+
attribute :status, Types::String.constrained(eql: 'administrator').default('administrator')
|
8
8
|
attribute :user, User
|
9
9
|
attribute :can_be_edited, Types::Bool
|
10
10
|
attribute :is_anonymous, Types::Bool
|
@@ -15,10 +15,13 @@ module Telegram
|
|
15
15
|
attribute :can_promote_members, Types::Bool
|
16
16
|
attribute :can_change_info, Types::Bool
|
17
17
|
attribute :can_invite_users, Types::Bool
|
18
|
+
attribute :can_post_stories, Types::Bool
|
19
|
+
attribute :can_edit_stories, Types::Bool
|
20
|
+
attribute :can_delete_stories, Types::Bool
|
18
21
|
attribute? :can_post_messages, Types::Bool
|
19
|
-
attribute? :can_edit_messages, Types::
|
20
|
-
attribute? :can_pin_messages, Types::
|
21
|
-
attribute? :can_manage_topics, Types::
|
22
|
+
attribute? :can_edit_messages, Types::Bool
|
23
|
+
attribute? :can_pin_messages, Types::Bool
|
24
|
+
attribute? :can_manage_topics, Types::Bool
|
22
25
|
attribute? :custom_title, Types::String
|
23
26
|
end
|
24
27
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class ChatMemberBanned <
|
7
|
-
attribute :status, Types::String
|
6
|
+
class ChatMemberBanned < Base
|
7
|
+
attribute :status, Types::String.constrained(eql: 'kicked').default('kicked')
|
8
8
|
attribute :user, User
|
9
9
|
attribute :until_date, Types::Integer
|
10
10
|
end
|
@@ -3,9 +3,10 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class ChatMemberMember <
|
7
|
-
attribute :status, Types::String
|
6
|
+
class ChatMemberMember < Base
|
7
|
+
attribute :status, Types::String.constrained(eql: 'member').default('member')
|
8
8
|
attribute :user, User
|
9
|
+
attribute? :until_date, Types::Integer
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class ChatMemberOwner <
|
7
|
-
attribute :status, Types::String
|
6
|
+
class ChatMemberOwner < Base
|
7
|
+
attribute :status, Types::String.constrained(eql: 'creator').default('creator')
|
8
8
|
attribute :user, User
|
9
9
|
attribute :is_anonymous, Types::Bool
|
10
10
|
attribute? :custom_title, Types::String
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Telegram
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
|
-
class ChatMemberRestricted <
|
7
|
-
attribute :status, Types::String
|
6
|
+
class ChatMemberRestricted < Base
|
7
|
+
attribute :status, Types::String.constrained(eql: 'restricted').default('restricted')
|
8
8
|
attribute :user, User
|
9
9
|
attribute :is_member, Types::Bool
|
10
10
|
attribute :can_send_messages, Types::Bool
|
@@ -10,6 +10,8 @@ module Telegram
|
|
10
10
|
attribute :old_chat_member, ChatMember
|
11
11
|
attribute :new_chat_member, ChatMember
|
12
12
|
attribute? :invite_link, ChatInviteLink
|
13
|
+
attribute? :via_join_request, Types::Bool
|
14
|
+
attribute? :via_chat_folder_invite_link, Types::Bool
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -5,13 +5,8 @@ module Telegram
|
|
5
5
|
module Types
|
6
6
|
module Compactable
|
7
7
|
def to_compact_hash
|
8
|
-
attributes.dup.
|
9
|
-
value =
|
10
|
-
if value.respond_to?(:to_compact_hash)
|
11
|
-
value.to_compact_hash
|
12
|
-
else
|
13
|
-
value
|
14
|
-
end
|
8
|
+
attributes.dup.compact.to_h do |key, value|
|
9
|
+
value = value.to_compact_hash if value.respond_to?(:to_compact_hash)
|
15
10
|
|
16
11
|
[key, value]
|
17
12
|
end
|
@@ -6,7 +6,7 @@ module Telegram
|
|
6
6
|
class Document < Base
|
7
7
|
attribute :file_id, Types::String
|
8
8
|
attribute :file_unique_id, Types::String
|
9
|
-
attribute? :
|
9
|
+
attribute? :thumbnail, PhotoSize
|
10
10
|
attribute? :file_name, Types::String
|
11
11
|
attribute? :mime_type, Types::String
|
12
12
|
attribute? :file_size, Types::Integer
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class Error < Base
|
7
|
+
attribute :ok, Types::Bool
|
8
|
+
attribute :error_code, Types::Integer
|
9
|
+
attribute :description, Types::String
|
10
|
+
attribute? :parameters, ResponseParameters
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class ExternalReplyInfo < Base
|
7
|
+
attribute :origin, MessageOrigin
|
8
|
+
attribute? :chat, Chat
|
9
|
+
attribute? :message_id, Types::Integer
|
10
|
+
attribute? :link_preview_options, LinkPreviewOptions
|
11
|
+
attribute? :animation, Animation
|
12
|
+
attribute? :audio, Audio
|
13
|
+
attribute? :document, Document
|
14
|
+
attribute? :paid_media, PaidMediaInfo
|
15
|
+
attribute? :photo, Types::Array.of(PhotoSize)
|
16
|
+
attribute? :sticker, Sticker
|
17
|
+
attribute? :story, Story
|
18
|
+
attribute? :video, Video
|
19
|
+
attribute? :video_note, VideoNote
|
20
|
+
attribute? :voice, Voice
|
21
|
+
attribute? :has_media_spoiler, Types::True
|
22
|
+
attribute? :contact, Contact
|
23
|
+
attribute? :dice, Dice
|
24
|
+
attribute? :game, Game
|
25
|
+
attribute? :giveaway, Giveaway
|
26
|
+
attribute? :giveaway_winners, GiveawayWinners
|
27
|
+
attribute? :invoice, Invoice
|
28
|
+
attribute? :location, Location
|
29
|
+
attribute? :poll, Poll
|
30
|
+
attribute? :venue, Venue
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -4,9 +4,9 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class ForceReply < Base
|
7
|
-
attribute :force_reply, Types::
|
8
|
-
attribute? :input_field_placeholder, Types::String
|
9
|
-
attribute? :selective, Types::Bool
|
7
|
+
attribute :force_reply, Types::True
|
8
|
+
attribute? :input_field_placeholder, Types::String.constrained(min_size: 1, max_size: 64)
|
9
|
+
attribute? :selective, Types::Bool
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class Gift < Base
|
7
|
+
attribute :id, Types::String
|
8
|
+
attribute :sticker, Sticker
|
9
|
+
attribute :star_count, Types::Integer
|
10
|
+
attribute? :total_count, Types::Integer
|
11
|
+
attribute? :remaining_count, Types::Integer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class Giveaway < Base
|
7
|
+
attribute :chats, Types::Array.of(Chat)
|
8
|
+
attribute :winners_selection_date, Types::Integer
|
9
|
+
attribute :winner_count, Types::Integer
|
10
|
+
attribute? :only_new_members, Types::True
|
11
|
+
attribute? :has_public_winners, Types::True
|
12
|
+
attribute? :prize_description, Types::String
|
13
|
+
attribute? :country_codes, Types::Array.of(Types::String)
|
14
|
+
attribute? :prize_star_count, Types::Integer
|
15
|
+
attribute? :premium_subscription_month_count, Types::Integer
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class GiveawayCompleted < Base
|
7
|
+
attribute :winner_count, Types::Integer
|
8
|
+
attribute? :unclaimed_prize_count, Types::Integer
|
9
|
+
attribute? :giveaway_message, Message
|
10
|
+
attribute? :is_star_giveaway, Types::True
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
class GiveawayWinners < Base
|
7
|
+
attribute :chat, Chat
|
8
|
+
attribute :giveaway_message_id, Types::Integer
|
9
|
+
attribute :winners_selection_date, Types::Integer
|
10
|
+
attribute :winner_count, Types::Integer
|
11
|
+
attribute :winners, Types::Array.of(User)
|
12
|
+
attribute? :additional_chat_count, Types::Integer
|
13
|
+
attribute? :prize_star_count, Types::Integer
|
14
|
+
attribute? :premium_subscription_month_count, Types::Integer
|
15
|
+
attribute? :unclaimed_prize_count, Types::Integer
|
16
|
+
attribute? :only_new_members, Types::True
|
17
|
+
attribute? :was_refunded, Types::True
|
18
|
+
attribute? :prize_description, Types::String
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -11,6 +11,8 @@ module Telegram
|
|
11
11
|
attribute? :login_url, LoginUrl
|
12
12
|
attribute? :switch_inline_query, Types::String
|
13
13
|
attribute? :switch_inline_query_current_chat, Types::String
|
14
|
+
attribute? :switch_inline_query_chosen_chat, SwitchInlineQueryChosenChat
|
15
|
+
attribute? :copy_text, CopyTextButton
|
14
16
|
attribute? :callback_game, CallbackGame
|
15
17
|
attribute? :pay, Types::Bool
|
16
18
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Telegram
|
4
|
+
module Bot
|
5
|
+
module Types
|
6
|
+
## Just for classes consistency
|
7
|
+
# rubocop:disable Naming/ConstantName
|
8
|
+
InlineQueryResult = (
|
9
|
+
InlineQueryResultCachedAudio |
|
10
|
+
InlineQueryResultCachedDocument |
|
11
|
+
InlineQueryResultCachedGif |
|
12
|
+
InlineQueryResultCachedMpeg4Gif |
|
13
|
+
InlineQueryResultCachedPhoto |
|
14
|
+
InlineQueryResultCachedSticker |
|
15
|
+
InlineQueryResultCachedVideo |
|
16
|
+
InlineQueryResultCachedVoice |
|
17
|
+
InlineQueryResultArticle |
|
18
|
+
InlineQueryResultAudio |
|
19
|
+
InlineQueryResultContact |
|
20
|
+
InlineQueryResultGame |
|
21
|
+
InlineQueryResultDocument |
|
22
|
+
InlineQueryResultGif |
|
23
|
+
InlineQueryResultLocation |
|
24
|
+
InlineQueryResultMpeg4Gif |
|
25
|
+
InlineQueryResultPhoto |
|
26
|
+
InlineQueryResultVenue |
|
27
|
+
InlineQueryResultVideo |
|
28
|
+
InlineQueryResultVoice
|
29
|
+
)
|
30
|
+
# rubocop:enable Naming/ConstantName
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultArticle < Base
|
7
|
-
attribute :type, Types::String.default('article')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'article').default('article')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :title, Types::String
|
10
10
|
attribute :input_message_content, InputMessageContent
|
@@ -12,9 +12,9 @@ module Telegram
|
|
12
12
|
attribute? :url, Types::String
|
13
13
|
attribute? :hide_url, Types::Bool
|
14
14
|
attribute? :description, Types::String
|
15
|
-
attribute? :
|
16
|
-
attribute? :
|
17
|
-
attribute? :
|
15
|
+
attribute? :thumbnail_url, Types::String
|
16
|
+
attribute? :thumbnail_width, Types::Integer
|
17
|
+
attribute? :thumbnail_height, Types::Integer
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultAudio < Base
|
7
|
-
attribute :type, Types::String.default('audio')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'audio').default('audio')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :audio_url, Types::String
|
10
10
|
attribute :title, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedAudio < Base
|
7
|
-
attribute :type, Types::String.default('audio')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'audio').default('audio')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :audio_file_id, Types::String
|
10
10
|
attribute? :caption, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedDocument < Base
|
7
|
-
attribute :type, Types::String.default('document')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'document').default('document')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :title, Types::String
|
10
10
|
attribute :document_file_id, Types::String
|
@@ -4,13 +4,14 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedGif < Base
|
7
|
-
attribute :type, Types::String.default('gif')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'gif').default('gif')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :gif_file_id, Types::String
|
10
10
|
attribute? :title, Types::String
|
11
11
|
attribute? :caption, Types::String
|
12
12
|
attribute? :parse_mode, Types::String
|
13
13
|
attribute? :caption_entities, Types::Array.of(MessageEntity)
|
14
|
+
attribute? :show_caption_above_media, Types::Bool
|
14
15
|
attribute? :reply_markup, InlineKeyboardMarkup
|
15
16
|
attribute? :input_message_content, InputMessageContent
|
16
17
|
end
|
@@ -4,13 +4,14 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedMpeg4Gif < Base
|
7
|
-
attribute :type, Types::String.default('mpeg4_gif')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'mpeg4_gif').default('mpeg4_gif')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :mpeg4_file_id, Types::String
|
10
10
|
attribute? :title, Types::String
|
11
11
|
attribute? :caption, Types::String
|
12
12
|
attribute? :parse_mode, Types::String
|
13
13
|
attribute? :caption_entities, Types::Array.of(MessageEntity)
|
14
|
+
attribute? :show_caption_above_media, Types::Bool
|
14
15
|
attribute? :reply_markup, InlineKeyboardMarkup
|
15
16
|
attribute? :input_message_content, InputMessageContent
|
16
17
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedPhoto < Base
|
7
|
-
attribute :type, Types::String.default('photo')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'photo').default('photo')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :photo_file_id, Types::String
|
10
10
|
attribute? :title, Types::String
|
@@ -12,6 +12,7 @@ module Telegram
|
|
12
12
|
attribute? :caption, Types::String
|
13
13
|
attribute? :parse_mode, Types::String
|
14
14
|
attribute? :caption_entities, Types::Array.of(MessageEntity)
|
15
|
+
attribute? :show_caption_above_media, Types::Bool
|
15
16
|
attribute? :reply_markup, InlineKeyboardMarkup
|
16
17
|
attribute? :input_message_content, InputMessageContent
|
17
18
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedSticker < Base
|
7
|
-
attribute :type, Types::String.default('sticker')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'sticker').default('sticker')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :sticker_file_id, Types::String
|
10
10
|
attribute? :reply_markup, InlineKeyboardMarkup
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedVideo < Base
|
7
|
-
attribute :type, Types::String.default('video')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'video').default('video')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :video_file_id, Types::String
|
10
10
|
attribute :title, Types::String
|
@@ -12,6 +12,7 @@ module Telegram
|
|
12
12
|
attribute? :caption, Types::String
|
13
13
|
attribute? :parse_mode, Types::String
|
14
14
|
attribute? :caption_entities, Types::Array.of(MessageEntity)
|
15
|
+
attribute? :show_caption_above_media, Types::Bool
|
15
16
|
attribute? :reply_markup, InlineKeyboardMarkup
|
16
17
|
attribute? :input_message_content, InputMessageContent
|
17
18
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultCachedVoice < Base
|
7
|
-
attribute :type, Types::String.default('voice')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'voice').default('voice')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :voice_file_id, Types::String
|
10
10
|
attribute :title, Types::String
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultContact < Base
|
7
|
-
attribute :type, Types::String.default('contact')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'contact').default('contact')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :phone_number, Types::String
|
10
10
|
attribute :first_name, Types::String
|
@@ -12,9 +12,9 @@ module Telegram
|
|
12
12
|
attribute? :vcard, Types::String
|
13
13
|
attribute? :reply_markup, InlineKeyboardMarkup
|
14
14
|
attribute? :input_message_content, InputMessageContent
|
15
|
-
attribute? :
|
16
|
-
attribute? :
|
17
|
-
attribute? :
|
15
|
+
attribute? :thumbnail_url, Types::String
|
16
|
+
attribute? :thumbnail_width, Types::Integer
|
17
|
+
attribute? :thumbnail_height, Types::Integer
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultDocument < Base
|
7
|
-
attribute :type, Types::String.default('document')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'document').default('document')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :title, Types::String
|
10
10
|
attribute? :caption, Types::String
|
@@ -15,9 +15,9 @@ module Telegram
|
|
15
15
|
attribute? :description, Types::String
|
16
16
|
attribute? :reply_markup, InlineKeyboardMarkup
|
17
17
|
attribute? :input_message_content, InputMessageContent
|
18
|
-
attribute? :
|
19
|
-
attribute? :
|
20
|
-
attribute? :
|
18
|
+
attribute? :thumbnail_url, Types::String
|
19
|
+
attribute? :thumbnail_width, Types::Integer
|
20
|
+
attribute? :thumbnail_height, Types::Integer
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultGame < Base
|
7
|
-
attribute :type, Types::String.default('game')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'game').default('game')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :game_short_name, Types::String
|
10
10
|
attribute? :reply_markup, InlineKeyboardMarkup
|
@@ -4,18 +4,19 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultGif < Base
|
7
|
-
attribute :type, Types::String.default('gif')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'gif').default('gif')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :gif_url, Types::String
|
10
10
|
attribute? :gif_width, Types::Integer
|
11
11
|
attribute? :gif_height, Types::Integer
|
12
12
|
attribute? :gif_duration, Types::Integer
|
13
|
-
attribute :
|
14
|
-
attribute? :
|
13
|
+
attribute :thumbnail_url, Types::String
|
14
|
+
attribute? :thumbnail_mime_type, Types::String.default('image/jpeg')
|
15
15
|
attribute? :title, Types::String
|
16
16
|
attribute? :caption, Types::String
|
17
17
|
attribute? :parse_mode, Types::String
|
18
18
|
attribute? :caption_entities, Types::Array.of(MessageEntity)
|
19
|
+
attribute? :show_caption_above_media, Types::Bool
|
19
20
|
attribute? :reply_markup, InlineKeyboardMarkup
|
20
21
|
attribute? :input_message_content, InputMessageContent
|
21
22
|
end
|
@@ -4,7 +4,7 @@ module Telegram
|
|
4
4
|
module Bot
|
5
5
|
module Types
|
6
6
|
class InlineQueryResultLocation < Base
|
7
|
-
attribute :type, Types::String.default('location')
|
7
|
+
attribute :type, Types::String.constrained(eql: 'location').default('location')
|
8
8
|
attribute :id, Types::String
|
9
9
|
attribute :latitude, Types::Float
|
10
10
|
attribute :longitude, Types::Float
|
@@ -15,9 +15,9 @@ module Telegram
|
|
15
15
|
attribute? :proximity_alert_radius, Types::Integer
|
16
16
|
attribute? :reply_markup, InlineKeyboardMarkup
|
17
17
|
attribute? :input_message_content, InputMessageContent
|
18
|
-
attribute? :
|
19
|
-
attribute? :
|
20
|
-
attribute? :
|
18
|
+
attribute? :thumbnail_url, Types::String
|
19
|
+
attribute? :thumbnail_width, Types::Integer
|
20
|
+
attribute? :thumbnail_height, Types::Integer
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|