telbe 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 499475c7a996403dfd24966de5fecf052f9acd62c7b49b334ec67b8204cf0b97
4
- data.tar.gz: 4d88cc491dfd65af9c93bcff7413aa4e0d9e5f23859a2913aea971ed68ef30f0
3
+ metadata.gz: fcf64c6457b7403573aabe87dd8c46594cf0ca2db28f3103040cf5234919ef84
4
+ data.tar.gz: d62045d388c68f4676f69e0337f065871912413634c8501ffc6e17afad5b5fdf
5
5
  SHA512:
6
- metadata.gz: b26ef0f8fd374b51269747433d489593c4a1b579dc1106349d8b8dae78574976c52f4b38c51756d6603a1ffd7ced442b774e2a21ca5dc8c58d98ba7213948577
7
- data.tar.gz: 8ef7b347fddc1c797c4aa16a637797cf4b093418573da52085d82fd73a76d9aeb5b08603a4414c9699ebf658fb8c267d41b9efc536358ead84bf655ecab234bd
6
+ metadata.gz: 40866b0b706a7321078df7d7dd586d464953239515dc92b6d45bd92bf02b424525f00058b6e3bb33a3cf90a6b0ad4b0d92161c81eadfba1395290bee68c83ac8
7
+ data.tar.gz: 9211847e1f3a3d50370818a2bdccd7b6231f19b3d88f9e4b7e33b5d359ffd44a366678aedaf05a8f1d5dff57ec34c5aa494a3ae92fb0374878ae2b14c74ae12e
data/lib/telbe/base.rb CHANGED
@@ -25,5 +25,17 @@ module Telbe
25
25
  base.send(:attribute, :caption, String)
26
26
  base.send(:attribute, :parse_mode, String, values: ["Markdown", "HTML"])
27
27
  end
28
- end
28
+ end
29
+
30
+ class InlineQueryResult
31
+ def self.inherited(base)
32
+ base.send(:include, SimplifyApi)
33
+ base.send(:attribute, :type, String, mandatory: true)
34
+ base.send(:attribute, :id, String, mandatory: true)
35
+ base.send(:attribute, :caption, String)
36
+ base.send(:attribute, :parse_mode, String, values: ["Markdown", "HTML"])
37
+ base.send(:attribute, :reply_markup, InlineKeyboardMarkup)
38
+ base.send(:attribute, :input_message_content, Object)
39
+ end
40
+ end
29
41
  end
data/lib/telbe/bot.rb CHANGED
@@ -29,22 +29,28 @@ module Telbe
29
29
  Update.new(update)
30
30
  end
31
31
  end
32
-
33
- def get_chat(chatid_descriptor)
34
- Chat.new(request(:getChat, chatid_descriptor))
35
- end
36
-
37
- def send_chat_action(send_chat_action_descriptor)
38
- request(:sendChatAction, send_chat_action_descriptor)
39
- end
40
32
  end
41
33
 
34
+ # type String Type of the entity. Can be mention (@username), hashtag, cashtag, bot_command, url, email, phone_number, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames)
35
+ # offset Integer Offset in UTF-16 code units to the start of the entity
36
+ # length Integer Length of the entity in UTF-16 code units
37
+ # url String Optional. For “text_link” only, url that will be opened after user taps on the text
38
+ # user User Optional. For “text_mention” only, the mentioned user
42
39
  class MessageEntity
43
40
  include SimplifyApi
41
+ attribute :type, String, mandatory: true
42
+ attribute :offset, Integer, mandatory: true
43
+ attribute :length, Integer, mandatory: true
44
+ attribute :url, String
45
+ attribute :user, User
44
46
  end
45
47
 
48
+ # force_reply True Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'
49
+ # selective Boolean Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
46
50
  class ForceReply
47
51
  include SimplifyApi
52
+ attribute :force_reply, values: [true], mandatory: true
53
+ attribute :selective, values: [true, false]
48
54
  end
49
55
 
50
56
  # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@@ -61,52 +67,7 @@ module Telbe
61
67
  attribute :parse_mode, String, values: ["Markdown", "HTML"]
62
68
  attribute :disable_web_page_preview, values: [true, false]
63
69
  attribute :reply_to_message_id, Integer
64
- attribute :reply_markup , Object
65
- end
66
-
67
- class ChatPhoto
68
- include SimplifyApi
69
- end
70
-
71
- class Message # Dummy
72
- end
73
-
74
- # id Integer Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
75
- # type String Type of chat, can be either “private”, “group”, “supergroup” or “channel”
76
- # title String Optional. Title, for supergroups, channels and group chats
77
- # username String Optional. Username, for private chats, supergroups and channels if available
78
- # first_name String Optional. First name of the other party in a private chat
79
- # last_name String Optional. Last name of the other party in a private chat
80
- # all_members_are_administrators Boolean Optional. True if a group has ‘All Members Are Admins’ enabled.
81
- # photo ChatPhoto Optional. Chat photo. Returned only in getChat.
82
- # description String Optional. Description, for supergroups and channel chats. Returned only in getChat.
83
- # invite_link String Optional. Chat invite link, for supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.
84
- # pinned_message Message Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat.
85
- # sticker_set_name String Optional. For supergroups, name of group sticker set. Returned only in getChat.
86
- # can_set_sticker_set Boolean Optional. True, if the bot can change the group sticker set. Returned only in getChat.
87
- class Chat
88
- include SimplifyApi
89
- attribute :id, Integer, mandatory: true
90
- attribute :type, String, mandatory: true, values: ["private", "group", "supergroup", "channel"]
91
- attribute :title, String
92
- attribute :username, String
93
- attribute :first_name, String
94
- attribute :last_name, String
95
- attribute :all_members_are_administrators, values: [true, false]
96
- attribute :photo, ChatPhoto
97
- attribute :description, String
98
- attribute :invite_link, String
99
- attribute :pinned_message, Message
100
- attribute :sticker_set_name, String
101
- attribute :can_set_sticker_set, values: [true, false]
102
- end
103
-
104
- # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
105
- # action String Yes Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.
106
- class SendChatActionDescriptor
107
- include SimplifyApi
108
- attribute :chat_id, Object, mandatory: true
109
- attribute :action, String, values: ["typing", "upload_photo", "record_video", "upload_video", "record_audio", "upload_audio", "upload_document", "find_location", "record_video_note", "upload_video_note"]
70
+ attribute :reply_markup, Object
110
71
  end
111
72
 
112
73
  # message_id Integer Unique message identifier inside this chat
data/lib/telbe/chat.rb ADDED
@@ -0,0 +1,238 @@
1
+ module Telbe
2
+ class Bot
3
+ def get_chat(get_chat_descriptor)
4
+ Chat.new(request(:getChat, get_chat_descriptor))
5
+ end
6
+
7
+ def get_chat_administrators(get_chat_descriptor)
8
+ request(:getChatAdministrators, get_chat_descriptor).collect! do |chat_administrator|
9
+ ChatMember.new(chat_administrator)
10
+ end
11
+ end
12
+
13
+ def get_chat_members_count(get_chat_descriptor)
14
+ request(:getChatMembersCount, get_chat_descriptor)
15
+ end
16
+
17
+ def get_chat_member(chat_member_descriptor)
18
+ ChatMember.new(request(:getChatMember, chat_member_descriptor))
19
+ end
20
+
21
+ def send_chat_action(send_chat_action_descriptor)
22
+ request(:sendChatAction, send_chat_action_descriptor)
23
+ end
24
+
25
+ def kick_chat_member(kick_chat_member_descriptor)
26
+ request(:kickChatMember, kick_chat_member_descriptor)
27
+ end
28
+
29
+ def unban_chat_member(chat_member_descriptor)
30
+ request(:unbanChatMember, chat_member_descriptor)
31
+ end
32
+
33
+ def restrict_chat_member(restrict_chat_member_descriptor)
34
+ request(:restrictChatMember, restrict_chat_member_descriptor)
35
+ end
36
+
37
+ def promote_chat_member(promote_chat_member_descriptor)
38
+ request(:promoteChatMember, promote_chat_member_descriptor)
39
+ end
40
+
41
+ def export_chat_invite_link(get_chat_descriptor)
42
+ request(:exportChatInviteLink, get_chat_descriptor)
43
+ end
44
+
45
+ def set_chat_photo(set_chat_photo_descriptor)
46
+ request(:setChatPhoto, set_chat_photo_descriptor)
47
+ end
48
+
49
+ def delete_chat_photo(get_chat_descriptor)
50
+ request(:deleteChatPhoto, get_chat_descriptor)
51
+ end
52
+
53
+ def set_chat_title(set_chat_title_descriptor)
54
+ request(:setChatTitle, set_chat_title_descriptor)
55
+ end
56
+
57
+ def set_chat_description(set_chat_description_descriptor)
58
+ request(:setChatDescription, set_chat_description_descriptor)
59
+ end
60
+
61
+ def pin_chat_message(pin_chat_message_descriptor)
62
+ request(:pinChatMessage, pin_chat_message_descriptor)
63
+ end
64
+
65
+ def unpin_chat_message(get_chat_descriptor)
66
+ request(:unpinChatMessage, get_chat_descriptor)
67
+ end
68
+
69
+ def leave_chat(get_chat_descriptor)
70
+ request(:leaveChat, get_chat_descriptor)
71
+ end
72
+
73
+ def set_chat_sticker_set(set_chat_sticker_set_descriptor)
74
+ request(:setChatStickerSet, set_chat_sticker_set_descriptor)
75
+ end
76
+
77
+ def delete_chat_sticker_set(get_chat_descriptor)
78
+ request(:deleteChatStickerSet, get_chat_descriptor)
79
+ end
80
+ end
81
+
82
+ # small_file_id String Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download.
83
+ # big_file_id String Unique file identifier of big (640x640) chat photo. This file_id can be used only for photo download.
84
+ class ChatPhoto
85
+ include SimplifyApi
86
+ attribute :small_file_id, String, mandatory: true
87
+ attribute :big_file_id, String, mandatory: true
88
+ end
89
+
90
+ class Message # Dummy
91
+ end
92
+
93
+ # id Integer Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
94
+ # type String Type of chat, can be either “private”, “group”, “supergroup” or “channel”
95
+ # title String Optional. Title, for supergroups, channels and group chats
96
+ # username String Optional. Username, for private chats, supergroups and channels if available
97
+ # first_name String Optional. First name of the other party in a private chat
98
+ # last_name String Optional. Last name of the other party in a private chat
99
+ # all_members_are_administrators Boolean Optional. True if a group has ‘All Members Are Admins’ enabled.
100
+ # photo ChatPhoto Optional. Chat photo. Returned only in getChat.
101
+ # description String Optional. Description, for supergroups and channel chats. Returned only in getChat.
102
+ # invite_link String Optional. Chat invite link, for supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.
103
+ # pinned_message Message Optional. Pinned message, for groups, supergroups and channels. Returned only in getChat.
104
+ # sticker_set_name String Optional. For supergroups, name of group sticker set. Returned only in getChat.
105
+ # can_set_sticker_set Boolean Optional. True, if the bot can change the group sticker set. Returned only in getChat.
106
+ class Chat
107
+ include SimplifyApi
108
+ attribute :id, Integer, mandatory: true
109
+ attribute :type, String, mandatory: true, values: ["private", "group", "supergroup", "channel"]
110
+ attribute :title, String
111
+ attribute :username, String
112
+ attribute :first_name, String
113
+ attribute :last_name, String
114
+ attribute :all_members_are_administrators, values: [true, false]
115
+ attribute :photo, ChatPhoto
116
+ attribute :description, String
117
+ attribute :invite_link, String
118
+ attribute :pinned_message, Message
119
+ attribute :sticker_set_name, String
120
+ attribute :can_set_sticker_set, values: [true, false]
121
+ end
122
+
123
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
124
+ # action String Yes Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.
125
+ class SendChatActionDescriptor
126
+ include SimplifyApi
127
+ attribute :chat_id, Object, mandatory: true
128
+ attribute :action, String, values: ["typing", "upload_photo", "record_video", "upload_video", "record_audio", "upload_audio", "upload_document", "find_location", "record_video_note", "upload_video_note"]
129
+ end
130
+
131
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
132
+ class GetChatDescriptor
133
+ include SimplifyApi
134
+ attribute :chat_id, Object, mandatory: true
135
+ end
136
+
137
+ # chat_id Integer or String Yes Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
138
+ # user_id Integer Yes Unique identifier of the target user
139
+ # until_date Integer Optional Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
140
+ class KickChatMemberDescriptor
141
+ include SimplifyApi
142
+ attribute :chat_id, Object, mandatory: true
143
+ attribute :user_id, Integer, mandatory: true
144
+ attribute :until_date, Integer
145
+ end
146
+
147
+ # chat_id Integer or String Yes Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
148
+ # user_id Integer Yes Unique identifier of the target user
149
+ class ChatMemberDescriptor
150
+ include SimplifyApi
151
+ attribute :chat_id, Object, mandatory: true
152
+ attribute :user_id, Integer, mandatory: true
153
+ end
154
+
155
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
156
+ # user_id Integer Yes Unique identifier of the target user
157
+ # until_date Integer Optional Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
158
+ # can_send_messages Boolean Optional Pass True, if the user can send text messages, contacts, locations and venues
159
+ # can_send_media_messages Boolean Optional Pass True, if the user can send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
160
+ # can_send_other_messages Boolean Optional Pass True, if the user can send animations, games, stickers and use inline bots, implies can_send_media_messages
161
+ # can_add_web_page_previews Boolean Optional Pass True, if the user may add web page previews to their messages, implies can_send_media_messages
162
+ class RestrictChatMemberDescriptor
163
+ include SimplifyApi
164
+ attribute :chat_id, Object, mandatory: true
165
+ attribute :user_id, Integer, mandatory: true
166
+ attribute :until_date, Integer
167
+ attribute :can_send_messages, values: [true, false]
168
+ attribute :can_send_media_messages, values: [true, false]
169
+ attribute :can_send_other_messages, values: [true, false]
170
+ attribute :can_add_web_page_previews, values: [true, false]
171
+ end
172
+
173
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
174
+ # user_id Integer Yes Unique identifier of the target user
175
+ # can_change_info Boolean Optional Pass True, if the administrator can change chat title, photo and other settings
176
+ # can_post_messages Boolean Optional Pass True, if the administrator can create channel posts, channels only
177
+ # can_edit_messages Boolean Optional Pass True, if the administrator can edit messages of other users and can pin messages, channels only
178
+ # can_delete_messages Boolean Optional Pass True, if the administrator can delete messages of other users
179
+ # can_invite_users Boolean Optional Pass True, if the administrator can invite new users to the chat
180
+ # can_restrict_members Boolean Optional Pass True, if the administrator can restrict, ban or unban chat members
181
+ # can_pin_messages Boolean Optional Pass True, if the administrator can pin messages, supergroups only
182
+ # can_promote_members Boolean Optional Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
183
+ class PromoteChatMemberDescriptor
184
+ include SimplifyApi
185
+ attribute :chat_id, Object, mandatory: true
186
+ attribute :user_id, Integer, mandatory: true
187
+ attribute :can_change_info, values: [true, false]
188
+ attribute :can_post_messages, values: [true, false]
189
+ attribute :can_edit_messages, values: [true, false]
190
+ attribute :can_delete_messages, values: [true, false]
191
+ attribute :can_invite_users, values: [true, false]
192
+ attribute :can_restrict_members, values: [true, false]
193
+ attribute :can_pin_messages, values: [true, false]
194
+ attribute :can_promote_members, values: [true, false]
195
+ end
196
+
197
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
198
+ # photo InputFile Yes New chat photo, uploaded using multipart/form-data
199
+ class SetChatPhotoDescriptor
200
+ include SimplifyApi
201
+ attribute :chat_id, Object, mandatory: true
202
+ attribute :photo, InputFile, mandatory: true
203
+ end
204
+
205
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
206
+ # title String Yes New chat title, 1-255 characters
207
+ class SetChatTitleDescriptor
208
+ include SimplifyApi
209
+ attribute :chat_id, Object, mandatory: true
210
+ attribute :title, String, mandatory: true
211
+ end
212
+
213
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
214
+ # description String Optional New chat description, 0-255 characters
215
+ class SetChatDescriptionDescriptor
216
+ include SimplifyApi
217
+ attribute :chat_id, Object, mandatory: true
218
+ attribute :description, String, mandatory: true
219
+ end
220
+
221
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
222
+ # message_id Integer Yes Identifier of a message to pin
223
+ # disable_notification Boolean Optional Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels.
224
+ class PinChatMessageDescriptor
225
+ include SimplifyApi
226
+ attribute :chat_id, Object, mandatory: true
227
+ attribute :message_id, Integer, mandatory: true
228
+ attribute :disable_notification, values: [true, false]
229
+ end
230
+
231
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
232
+ # sticker_set_name String Yes Name of the sticker set to be set as the group sticker set
233
+ class SetChatStickerSetDescriptor
234
+ include SimplifyApi
235
+ attribute :chat_id, Object, mandatory: true
236
+ attribute :sticker_set_name, String, mandatory: true
237
+ end
238
+ end
data/lib/telbe/inline.rb CHANGED
@@ -1,9 +1,458 @@
1
1
  module Telbe
2
+ class Bot
3
+ def answer_inline_query(answer_inline_query_descriptor)
4
+ request(:answerInlineQuery, answer_inline_query_descriptor)
5
+ end
6
+ end
7
+
8
+ # id String Unique identifier for this query
9
+ # from User Sender
10
+ # location Location Optional. Sender location, only for bots that request user location
11
+ # query String Text of the query (up to 512 characters)
12
+ # offset String Offset of the results to be returned, can be controlled by the bot
2
13
  class InlineQuery
3
14
  include SimplifyApi
15
+ attribute :id, String
16
+ attribute :from, User
17
+ attribute :location, Location
18
+ attribute :query, String
19
+ attribute :offset, String
20
+ end
21
+
22
+ # inline_query_id String Yes Unique identifier for the answered query
23
+ # results Array of InlineQueryResult Yes A JSON-serialized array of results for the inline query
24
+ # cache_time Integer Optional The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
25
+ # is_personal Boolean Optional Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
26
+ # next_offset String Optional Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
27
+ # switch_pm_text String Optional If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter
28
+ # switch_pm_parameter String Optional Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
29
+ class AnswerInlineQueryDescriptor
30
+ include SimplifyApi
31
+ attribute :inline_query_id, String, mandatory: true
32
+ attribute :results, [Object], mandatory: true
33
+ attribute :cache_time, Integer
34
+ attribute :is_personal, values: [true, false]
35
+ attribute :next_offset, String
36
+ attribute :switch_pm_text, String
37
+ attribute :switch_pm_parameter, String
38
+ end
39
+
40
+ # result_id String The unique identifier for the result that was chosen
41
+ # from User The user that chose the result
42
+ # location Location Optional. Sender location, only for bots that require user location
43
+ # inline_message_id String Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
44
+ # query String The query that was used to obtain the result
45
+ class ChosenInlineResult
46
+ include SimplifyApi
47
+ attribute :result_id, String, mandatory: true
48
+ attribute :from, User, mandatory: true
49
+ attribute :location, Location
50
+ attribute :inline_message_id, String
51
+ attribute :query, String, mandatory: true
52
+ end
53
+
54
+ # type String Type of the result, must be audio
55
+ # id String Unique identifier for this result, 1-64 bytes
56
+ # audio_file_id String A valid file identifier for the audio file
57
+ # caption String Optional. Caption, 0-1024 characters
58
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
59
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
60
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the audio
61
+ class InlineQueryResultCachedAudio < InlineQueryResult
62
+ attribute :audio_file_id, String, mandatory: true
63
+ end
64
+
65
+ # type String Type of the result, must be document
66
+ # id String Unique identifier for this result, 1-64 bytes
67
+ # title String Title for the result
68
+ # document_file_id String A valid file identifier for the file
69
+ # description String Optional. Short description of the result
70
+ # caption String Optional. Caption of the document to be sent, 0-1024 characters
71
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
72
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
73
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the file
74
+ class InlineQueryResultCachedDocument < InlineQueryResult
75
+ attribute :title, String, mandatory: true
76
+ attribute :document_file_id, String, mandatory: true
77
+ attribute :description, String
78
+ end
79
+
80
+ # type String Type of the result, must be gif
81
+ # id String Unique identifier for this result, 1-64 bytes
82
+ # gif_file_id String A valid file identifier for the GIF file
83
+ # title String Optional. Title for the result
84
+ # caption String Optional. Caption of the GIF file to be sent, 0-1024 characters
85
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
86
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
87
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the GIF animation
88
+ class InlineQueryResultCachedGif < InlineQueryResult
89
+ attribute :gif_file_id, String, mandatory: true
90
+ attribute :title, String
91
+ end
92
+
93
+ # type String Type of the result, must be mpeg4_gif
94
+ # id String Unique identifier for this result, 1-64 bytes
95
+ # mpeg4_file_id String A valid file identifier for the MP4 file
96
+ # title String Optional. Title for the result
97
+ # caption String Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters
98
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
99
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
100
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the video animation
101
+ class InlineQueryResultCachedMpeg4Gif < InlineQueryResult
102
+ attribute :mpeg4_file_id, String, mandatory: true
103
+ attribute :title, String
104
+ end
105
+
106
+ # type String Type of the result, must be photo
107
+ # id String Unique identifier for this result, 1-64 bytes
108
+ # photo_file_id String A valid file identifier of the photo
109
+ # title String Optional. Title for the result
110
+ # description String Optional. Short description of the result
111
+ # caption String Optional. Caption of the photo to be sent, 0-1024 characters
112
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
113
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
114
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the photo
115
+ class InlineQueryResultCachedPhoto < InlineQueryResult
116
+ attribute :photo_file_id, String, mandatory: true
117
+ attribute :title, String
118
+ attribute :description, String
119
+ end
120
+
121
+ # type String Type of the result, must be sticker
122
+ # id String Unique identifier for this result, 1-64 bytes
123
+ # sticker_file_id String A valid file identifier of the sticker
124
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
125
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the sticker
126
+ class InlineQueryResultCachedSticker < InlineQueryResult
127
+ attribute :sticker_file_id, String, mandatory: true
128
+ end
129
+
130
+ # type String Type of the result, must be video
131
+ # id String Unique identifier for this result, 1-64 bytes
132
+ # video_file_id String A valid file identifier for the video file
133
+ # title String Title for the result
134
+ # description String Optional. Short description of the result
135
+ # caption String Optional. Caption of the video to be sent, 0-1024 characters
136
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
137
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
138
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the video
139
+ class InlineQueryResultCachedVideo < InlineQueryResult
140
+ attribute :video_file_id, String, mandatory: true
141
+ attribute :title, String, mandatory: true
142
+ attribute :description, String
143
+ end
144
+
145
+ # type String Type of the result, must be voice
146
+ # id String Unique identifier for this result, 1-64 bytes
147
+ # voice_file_id String A valid file identifier for the voice message
148
+ # title String Voice message title
149
+ # caption String Optional. Caption, 0-1024 characters
150
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
151
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
152
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the voice message
153
+ class InlineQueryResultCachedVoice < InlineQueryResult
154
+ attribute :voice_file_id, String, mandatory: true
155
+ attribute :title, String, mandatory: true
156
+ end
157
+
158
+ # type String Type of the result, must be article
159
+ # id String Unique identifier for this result, 1-64 Bytes
160
+ # title String Title of the result
161
+ # input_message_content InputMessageContent Content of the message to be sent
162
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
163
+ # url String Optional. URL of the result
164
+ # hide_url Boolean Optional. Pass True, if you don't want the URL to be shown in the message
165
+ # description String Optional. Short description of the result
166
+ # thumb_url String Optional. Url of the thumbnail for the result
167
+ # thumb_width Integer Optional. Thumbnail width
168
+ # thumb_height Integer Optional. Thumbnail height
169
+ class InlineQueryResultArticle < InlineQueryResult
170
+ attribute :title, String, mandatory: true
171
+ attribute :url, String
172
+ attribute :hide_url, values: [true, false]
173
+ attribute :description, String
174
+ attribute :thumb_url, String
175
+ attribute :thumb_width, Integer
176
+ attribute :thumb_height, Integer
177
+ end
178
+
179
+ # type String Type of the result, must be audio
180
+ # id String Unique identifier for this result, 1-64 bytes
181
+ # audio_url String A valid URL for the audio file
182
+ # title String Title
183
+ # caption String Optional. Caption, 0-1024 characters
184
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
185
+ # performer String Optional. Performer
186
+ # audio_duration Integer Optional. Audio duration in seconds
187
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
188
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the audio
189
+ class InlineQueryResultAudio < InlineQueryResult
190
+ attribute :audio_url, String, mandatory: true
191
+ attribute :title, String, mandatory: true
192
+ attribute :performer, String
193
+ attribute :audio_duration, Integer
194
+ end
195
+
196
+ # type String Type of the result, must be contact
197
+ # id String Unique identifier for this result, 1-64 Bytes
198
+ # phone_number String Contact's phone number
199
+ # first_name String Contact's first name
200
+ # last_name String Optional. Contact's last name
201
+ # vcard String Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
202
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
203
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the contact
204
+ # thumb_url String Optional. Url of the thumbnail for the result
205
+ # thumb_width Integer Optional. Thumbnail width
206
+ # thumb_height Integer Optional. Thumbnail height
207
+ class InlineQueryResultContact < InlineQueryResult
208
+ attribute :phone_number, String, mandatory: true
209
+ attribute :first_name, String, mandatory: true
210
+ attribute :last_name, String
211
+ attribute :vcard, String
212
+ attribute :thumb_url, String
213
+ attribute :thumb_width, Integer
214
+ attribute :thumb_height, Integer
215
+ end
216
+
217
+ # type String Type of the result, must be game
218
+ # id String Unique identifier for this result, 1-64 bytes
219
+ # game_short_name String Short name of the game
220
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
221
+ class InlineQueryResultGame < InlineQueryResult
222
+ attribute :game_short_name, String, mandatory: true
223
+ end
224
+
225
+ # type String Type of the result, must be document
226
+ # id String Unique identifier for this result, 1-64 bytes
227
+ # title String Title for the result
228
+ # caption String Optional. Caption of the document to be sent, 0-1024 characters
229
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
230
+ # document_url String A valid URL for the file
231
+ # mime_type String Mime type of the content of the file, either “application/pdf” or “application/zip”
232
+ # description String Optional. Short description of the result
233
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
234
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the file
235
+ # thumb_url String Optional. URL of the thumbnail (jpeg only) for the file
236
+ # thumb_width Integer Optional. Thumbnail width
237
+ # thumb_height Integer Optional. Thumbnail height
238
+ class InlineQueryResultDocument < InlineQueryResult
239
+ attribute :title, String, mandatory: true
240
+ attribute :document_url, String, mandatory: true
241
+ attribute :mime_type, String, mandatory: true
242
+ attribute :description, String
243
+ attribute :thumb_url, String
244
+ attribute :thumb_width, Integer
245
+ attribute :thumb_height, Integer
246
+ end
247
+
248
+ # type String Type of the result, must be gif
249
+ # id String Unique identifier for this result, 1-64 bytes
250
+ # gif_url String A valid URL for the GIF file. File size must not exceed 1MB
251
+ # gif_width Integer Optional. Width of the GIF
252
+ # gif_height Integer Optional. Height of the GIF
253
+ # gif_duration Integer Optional. Duration of the GIF
254
+ # thumb_url String URL of the static thumbnail for the result (jpeg or gif)
255
+ # title String Optional. Title for the result
256
+ # caption String Optional. Caption of the GIF file to be sent, 0-1024 characters
257
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
258
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
259
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the GIF animation
260
+ class InlineQueryResultGif < InlineQueryResult
261
+ attribute :gif_url, String, mandatory: true
262
+ attribute :gif_width, Integer
263
+ attribute :gif_height, Integer
264
+ attribute :gif_duration, Integer
265
+ attribute :thumb_url, String, mandatory: true
266
+ attribute :title, String
267
+ end
268
+
269
+ # type String Type of the result, must be location
270
+ # id String Unique identifier for this result, 1-64 Bytes
271
+ # latitude Float number Location latitude in degrees
272
+ # longitude Float number Location longitude in degrees
273
+ # title String Location title
274
+ # live_period Integer Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
275
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
276
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the location
277
+ # thumb_url String Optional. Url of the thumbnail for the result
278
+ # thumb_width Integer Optional. Thumbnail width
279
+ # thumb_height Integer Optional. Thumbnail height
280
+ class InlineQueryResultLocation < InlineQueryResult
281
+ attribute :latitude, Float, mandatory: true
282
+ attribute :longitude, Float, mandatory: true
283
+ attribute :title, String, mandatory: true
284
+ attribute :live_period, Integer
285
+ attribute :thumb_url, String
286
+ attribute :thumb_width, Integer
287
+ attribute :thumb_height, Integer
288
+ end
289
+
290
+ # type String Type of the result, must be mpeg4_gif
291
+ # id String Unique identifier for this result, 1-64 bytes
292
+ # mpeg4_url String A valid URL for the MP4 file. File size must not exceed 1MB
293
+ # mpeg4_width Integer Optional. Video width
294
+ # mpeg4_height Integer Optional. Video height
295
+ # mpeg4_duration Integer Optional. Video duration
296
+ # thumb_url String URL of the static thumbnail (jpeg or gif) for the result
297
+ # title String Optional. Title for the result
298
+ # caption String Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters
299
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
300
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
301
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the video animation
302
+ class InlineQueryResultMpeg4Gif < InlineQueryResult
303
+ attribute :mpeg4_url, String, mandatory: true
304
+ attribute :mpeg4_width, Integer
305
+ attribute :mpeg4_height, Integer
306
+ attribute :mpeg4_duration, Integer
307
+ attribute :thumb_url, String, mandatory: true
308
+ attribute :title, String
309
+ end
310
+
311
+ # type String Type of the result, must be photo
312
+ # id String Unique identifier for this result, 1-64 bytes
313
+ # photo_url String A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
314
+ # thumb_url String URL of the thumbnail for the photo
315
+ # photo_width Integer Optional. Width of the photo
316
+ # photo_height Integer Optional. Height of the photo
317
+ # title String Optional. Title for the result
318
+ # description String Optional. Short description of the result
319
+ # caption String Optional. Caption of the photo to be sent, 0-1024 characters
320
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
321
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
322
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the photo
323
+ class InlineQueryResultPhoto < InlineQueryResult
324
+ attribute :photo_url, String, mandatory: true
325
+ attribute :thumb_url, String, mandatory: true
326
+ attribute :photo_width, Integer
327
+ attribute :photo_height, Integer
328
+ attribute :title, String
329
+ attribute :description, String
330
+ end
331
+
332
+ # type String Type of the result, must be venue
333
+ # id String Unique identifier for this result, 1-64 Bytes
334
+ # latitude Float Latitude of the venue location in degrees
335
+ # longitude Float Longitude of the venue location in degrees
336
+ # title String Title of the venue
337
+ # address String Address of the venue
338
+ # foursquare_id String Optional. Foursquare identifier of the venue if known
339
+ # foursquare_type String Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
340
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
341
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the venue
342
+ # thumb_url String Optional. Url of the thumbnail for the result
343
+ # thumb_width Integer Optional. Thumbnail width
344
+ # thumb_height Integer Optional. Thumbnail height
345
+ class InlineQueryResultVenue < InlineQueryResult
346
+ attribute :latitude, Float, mandatory: true
347
+ attribute :longitude, Float, mandatory: true
348
+ attribute :title, String, mandatory: true
349
+ attribute :address, String, mandatory: true
350
+ attribute :foursquare_id, String
351
+ attribute :foursquare_type, String
352
+ attribute :thumb_url, String
353
+ attribute :thumb_width, Integer
354
+ attribute :thumb_height, Integer
355
+ end
356
+
357
+ # type String Type of the result, must be video
358
+ # id String Unique identifier for this result, 1-64 bytes
359
+ # video_url String A valid URL for the embedded video player or video file
360
+ # mime_type String Mime type of the content of video url, “text/html” or “video/mp4”
361
+ # thumb_url String URL of the thumbnail (jpeg only) for the video
362
+ # title String Title for the result
363
+ # caption String Optional. Caption of the video to be sent, 0-1024 characters
364
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
365
+ # video_width Integer Optional. Video width
366
+ # video_height Integer Optional. Video height
367
+ # video_duration Integer Optional. Video duration in seconds
368
+ # description String Optional. Short description of the result
369
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
370
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
371
+ class InlineQueryResultVideo < InlineQueryResult
372
+ attribute :video_url, String, mandatory: true
373
+ attribute :mime_type, String, mandatory: true
374
+ attribute :thumb_url, String, mandatory: true
375
+ attribute :title, String, mandatory: true
376
+ attribute :video_width, Integer
377
+ attribute :video_height, Integer
378
+ attribute :video_duration, Integer
379
+ attribute :description, String
380
+ end
381
+
382
+ # type String Type of the result, must be voice
383
+ # id String Unique identifier for this result, 1-64 bytes
384
+ # voice_url String A valid URL for the voice recording
385
+ # title String Recording title
386
+ # caption String Optional. Caption, 0-1024 characters
387
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
388
+ # voice_duration Integer Optional. Recording duration in seconds
389
+ # reply_markup InlineKeyboardMarkup Optional. Inline keyboard attached to the message
390
+ # input_message_content InputMessageContent Optional. Content of the message to be sent instead of the voice recording
391
+ class InlineQueryResultVoice < InlineQueryResult
392
+ attribute :voice_url, String, mandatory: true
393
+ attribute :title, String, mandatory: true
394
+ attribute :voice_duration, Integer
395
+ end
396
+
397
+ # message_text String Text of the message to be sent, 1-4096 characters
398
+ # parse_mode String Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
399
+ # disable_web_page_preview Boolean Optional. Disables link previews for links in the sent message
400
+ class InputMessageContent
401
+ include SimplifyApi
402
+ attribute :message_text, String, mandatory: true
403
+ attribute :parse_mode, String, values: ["Markdown", "HTML"]
404
+ attribute :disable_web_page_preview, values: [true, false]
405
+ end
406
+
407
+ # latitude Float Latitude of the location in degrees
408
+ # longitude Float Longitude of the location in degrees
409
+ # live_period Integer Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
410
+ class InputLocationMessageContent
411
+ include SimplifyApi
412
+ attribute :latitude, Float, mandatory: true
413
+ attribute :longitude, Float, mandatory: true
414
+ attribute :live_period, Integer
415
+ end
416
+
417
+ # latitude Float Latitude of the venue in degrees
418
+ # longitude Float Longitude of the venue in degrees
419
+ # title String Name of the venue
420
+ # address String Address of the venue
421
+ # foursquare_id String Optional. Foursquare identifier of the venue, if known
422
+ # foursquare_type String Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
423
+ class InputVenueMessageContent
424
+ include SimplifyApi
425
+ attribute :latitude, Float, mandatory: true
426
+ attribute :longitude, Float, mandatory: true
427
+ attribute :title, String, mandatory: true
428
+ attribute :address, String, mandatory: true
429
+ attribute :foursquare_id, String
430
+ attribute :foursquare_type, String
431
+ end
432
+
433
+ # phone_number String Contact's phone number
434
+ # first_name String Contact's first name
435
+ # last_name String Optional. Contact's last name
436
+ # vcard String Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
437
+ class InputContactMessageContent
438
+ include SimplifyApi
439
+ attribute :phone_number, String, mandatory: true
440
+ attribute :first_name, String, mandatory: true
441
+ attribute :last_name, String
442
+ attribute :vcard, String
4
443
  end
5
444
 
445
+ # result_id String The unique identifier for the result that was chosen
446
+ # from User The user that chose the result
447
+ # location Location Optional. Sender location, only for bots that require user location
448
+ # inline_message_id String Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
449
+ # query String The query that was used to obtain the result
6
450
  class ChosenInlineResult
7
451
  include SimplifyApi
452
+ attribute :result_id, String, mandatory: true
453
+ attribute :from, User, mandatory: true
454
+ attribute :location, Location
455
+ attribute :inline_message_id
456
+ attribute :query, String, mandatory: true
8
457
  end
9
458
  end
@@ -1,4 +1,10 @@
1
1
  module Telbe
2
+ class Bot
3
+ def answer_callback_query(answer_callback_query_descriptor)
4
+ request(:answerCallbackQuery, answer_callback_query_descriptor)
5
+ end
6
+ end
7
+
2
8
  # text String Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
3
9
  # request_contact Boolean Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only
4
10
  # request_location Boolean Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
@@ -12,11 +18,7 @@ module Telbe
12
18
  # Created to nest the arrays in ReplyKeyboardMarkup
13
19
  class KeyboardButtons
14
20
  include SimplifyApi
15
- attribute :keyboard_button, [KeyboardButton]
16
- end
17
-
18
- class ReplyKeyboardRemove
19
- include SimplifyApi
21
+ attribute :keyboard_button, [KeyboardButton], mandatory: true, invisible: true
20
22
  end
21
23
 
22
24
  # keyboard Array of Array of KeyboardButton Array of button rows, each represented by an Array of KeyboardButton objects
@@ -31,15 +33,73 @@ module Telbe
31
33
  attribute :selective, values: [true, false]
32
34
  end
33
35
 
34
- class InlineKeyboardMarkup
36
+ class ReplyKeyboardRemove
35
37
  include SimplifyApi
36
38
  end
37
39
 
40
+ # text String Label text on the button
41
+ # url String Optional. HTTP or tg:// url to be opened when button is pressed
42
+ # callback_data String Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
43
+ # switch_inline_query String Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.
44
+ # switch_inline_query_current_chat String Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.
45
+ # callback_game CallbackGame Optional. Description of the game that will be launched when the user presses the button.
46
+ # pay Boolean Optional. Specify True, to send a Pay button.
38
47
  class InlineKeyboardButton
39
48
  include SimplifyApi
49
+ attribute :text, String, mandatory: true
50
+ attribute :url, String
51
+ attribute :callback_data, String
52
+ attribute :switch_inline_query, String
53
+ attribute :switch_inline_query_current_chat, String
54
+ # attribute :callback_game, CallbackGame
55
+ attribute :pay, values: [true, false]
40
56
  end
41
57
 
58
+ # Created to nest the arrays in InlineKeyboardMarkup
59
+ class InlineKeyboardLine
60
+ include SimplifyApi
61
+ attribute :inline_keyboard_buttons, [InlineKeyboardButton], mandatory: true, invisible: true
62
+ end
63
+
64
+ # inline_keyboard Array of Array of InlineKeyboardButton Array of button rows, each represented by an Array of InlineKeyboardButton objects
65
+ class InlineKeyboardMarkup
66
+ include SimplifyApi
67
+ attribute :inline_keyboard, [InlineKeyboardLine], mandatory: true
68
+ end
69
+
70
+ # Dummy
71
+ class Message
72
+ end
73
+
74
+ # id String Unique identifier for this query
75
+ # from User Sender
76
+ # message Message Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old
77
+ # inline_message_id String Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
78
+ # chat_instance String Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
79
+ # data String Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
80
+ # game_short_name String Optional. Short name of a Game to be returned, serves as the unique identifier for the game
42
81
  class CallbackQuery
43
82
  include SimplifyApi
83
+ attribute :id, String, mandatory: true
84
+ attribute :from, User, mandatory: true
85
+ attribute :message, Message
86
+ attribute :inline_message_id, String
87
+ attribute :chat_instance, String, mandatory: true
88
+ attribute :data, String
89
+ attribute :game_short_name, String
90
+ end
91
+
92
+ # callback_query_id String Yes Unique identifier for the query to be answered
93
+ # text String Optional Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
94
+ # show_alert Boolean Optional If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
95
+ # url String Optional URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button.
96
+ # cache_time Integer Optional The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
97
+ class AnswerCallBackQueryDescriptor
98
+ include SimplifyApi
99
+ attribute :callback_query_id, String, mandatory: true
100
+ attribute :text, String
101
+ attribute :show_alert, values: [true, false]
102
+ attribute :url, String
103
+ attribute :cache_time, Integer
44
104
  end
45
105
  end
data/lib/telbe/media.rb CHANGED
@@ -4,6 +4,10 @@ module Telbe
4
4
  "https://api.telegram.org/file/bot#{@token}/#{file.file_path}"
5
5
  end
6
6
 
7
+ def get_file(get_file_descriptor)
8
+ File.new(request(:getFile, get_file_descriptor))
9
+ end
10
+
7
11
  def send_photo(send_photo_descriptor)
8
12
  Message.new(request(:sendPhoto, send_photo_descriptor))
9
13
  end
data/lib/telbe/poll.rb CHANGED
@@ -3,6 +3,10 @@ module Telbe
3
3
  def send_poll(poll_descriptor)
4
4
  Message.new(request(:sendPoll, poll_descriptor))
5
5
  end
6
+
7
+ def stop_poll(stop_poll_descriptor)
8
+ Poll.new(request(:stopPoll, stop_poll_descriptor))
9
+ end
6
10
  end
7
11
 
8
12
  # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.
@@ -40,4 +44,14 @@ module Telbe
40
44
  attribute :options, [PollOption]
41
45
  attribute :is_closed, values: [true, false]
42
46
  end
47
+
48
+ # chat_id Integer or String Yes Unique identifier for the target chat or username of the target channel (in the format @channelusername)
49
+ # message_id Integer Yes Identifier of the original message with the poll
50
+ # reply_markup InlineKeyboardMarkup Optional A JSON-serialized object for a new message inline keyboard.
51
+ class StopPollDescriptor
52
+ include SimplifyApi
53
+ attribute :chat_id, Object, mandatory: true # Integer or String
54
+ attribute :message_id, Integer
55
+ attribute :reply_markup, Object
56
+ end
43
57
  end
data/lib/telbe/user.rb CHANGED
@@ -2,24 +2,13 @@ module Telbe
2
2
  CHAT_MEMBER_STATUS = ["creator", "administrator", "member", "restricted", "left", "kicked"]
3
3
 
4
4
  class Bot
5
- def get_chat_administrators(chatid_descriptor)
6
- request(:getChatAdministrators, chatid_descriptor).collect do |member_hash|
7
- ChatMember.new(member_hash)
8
- end
9
- end
10
-
11
- def get_chat_members_count(chatid_descriptor)
12
- request(:getChatMembersCount, chatid_descriptor)
13
- end
14
-
15
5
  def get_me
16
6
  User.new(request(:getMe))
17
7
  end
18
- end
19
8
 
20
- class ChatIdDescriptor
21
- include SimplifyApi
22
- attribute :chat_id, Integer, mandatory: true
9
+ def get_user_profile_photos(get_user_profile_photos_descriptor)
10
+ UserProfilePhotos.new(request(:getUserProfilePhotos, get_user_profile_photos_descriptor))
11
+ end
23
12
  end
24
13
 
25
14
  # id Integer Unique identifier for this user or bot
@@ -41,15 +30,25 @@ module Telbe
41
30
  # Created to nest the arrays in UserProfilePhotos
42
31
  class UserProfilePhoto
43
32
  include SimplifyApi
44
- attribute :photo, [PhotoSize]
33
+ attribute :photo, [PhotoSize], mandatory: true, invisible: true
45
34
  end
46
35
 
47
36
  # total_count Integer Total number of profile pictures the target user has
48
37
  # photos Array of Array of PhotoSize Requested profile pictures (in up to 4 sizes each)
49
38
  class UserProfilePhotos
50
39
  include SimplifyApi
51
- attribute :total_count, Integer
52
- attribute :photos, [UserProfilePhoto]
40
+ attribute :total_count, Integer, mandatory: true
41
+ attribute :photos, [UserProfilePhoto], mandatory: true
42
+ end
43
+
44
+ # user_id Integer Yes Unique identifier of the target user
45
+ # offset Integer Optional Sequential number of the first photo to be returned. By default, all photos are returned.
46
+ # limit Integer Optional Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.
47
+ def GetUserProfilePhotosDescriptor
48
+ include SimplifyApi
49
+ attribute :user_id, Integer, mandatory: true
50
+ attribute :offset, Integer
51
+ attribute :limit, Integer
53
52
  end
54
53
 
55
54
  # user User Information about the user
data/lib/telbe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Telbe
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/telbe.rb CHANGED
@@ -4,12 +4,13 @@ require 'simplify_api'
4
4
 
5
5
  require 'telbe/base'
6
6
  require 'telbe/contact'
7
- require 'telbe/keyboard'
8
- require 'telbe/inline'
9
7
  require 'telbe/poll'
10
8
  require 'telbe/media'
11
9
  require 'telbe/user'
10
+ require 'telbe/keyboard'
12
11
  require 'telbe/sticker'
13
12
  require 'telbe/location'
13
+ require 'telbe/inline'
14
14
  require 'telbe/webhook'
15
+ require 'telbe/chat'
15
16
  require 'telbe/bot'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Garcia Couto
@@ -66,6 +66,7 @@ files:
66
66
  - lib/telbe.rb
67
67
  - lib/telbe/base.rb
68
68
  - lib/telbe/bot.rb
69
+ - lib/telbe/chat.rb
69
70
  - lib/telbe/contact.rb
70
71
  - lib/telbe/inline.rb
71
72
  - lib/telbe/keyboard.rb