-
Notifications
You must be signed in to change notification settings - Fork 6
/
types_inline.go
432 lines (378 loc) · 19.8 KB
/
types_inline.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
package micha
const (
INLINE_TYPE_RESULT_ARTICLE InlineResultType = "article"
INLINE_TYPE_RESULT_PHOTO InlineResultType = "photo"
INLINE_TYPE_RESULT_GIF InlineResultType = "gif"
INLINE_TYPE_RESULT_MPEG4_GIF InlineResultType = "mpeg4_gif"
INLINE_TYPE_RESULT_VIDEO InlineResultType = "video"
INLINE_TYPE_RESULT_AUDIO InlineResultType = "audio"
INLINE_TYPE_RESULT_VOICE InlineResultType = "voice"
INLINE_TYPE_RESULT_DOCUMENT InlineResultType = "document"
INLINE_TYPE_RESULT_LOCATION InlineResultType = "location"
INLINE_TYPE_RESULT_VENUE InlineResultType = "venue"
INLINE_TYPE_RESULT_CONTACT InlineResultType = "contact"
INLINE_TYPE_RESULT_STICKER InlineResultType = "sticker"
INLINE_TYPE_RESULT_GAME InlineResultType = "game"
)
// InlineQuery object represents an incoming inline query.
// When the user sends an empty query, your bot could return some default or trending results.
type InlineQuery struct {
ID string `json:"id"`
From User `json:"from"`
Location *Location `json:"location,omitempty"`
Query string `json:"query"`
Offset string `json:"offset"`
}
type InlineResultType string
type InlineQueryResults []InlineQueryResult
type InlineQueryResult interface {
itsInlineQueryResult()
}
type inlineQueryResultImplementation struct{}
func (i inlineQueryResultImplementation) itsInlineQueryResult() {}
// Represents a link to an article or web page.
type InlineQueryResultArticle struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Title string `json:"title"`
// Optional
URL string `json:"url,omitempty"`
HideURL bool `json:"hide_url,omitempty"`
Description string `json:"description,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
ThumbWidth int `json:"thumb_width,omitempty"`
ThumbHeight int `json:"thumb_height,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a photo.
// By default, this photo will be sent by the user with optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
type InlineQueryResultPhoto struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
PhotoURL string `json:"photo_url"`
// Optional
MimeType string `json:"mime_type,omitempty"`
PhotoWidth int `json:"photo_width,omitempty"`
PhotoHeight int `json:"photo_height,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a photo stored on the Telegram servers.
// By default, this photo will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
type InlineQueryResultCachedPhoto struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
PhotoFileID string `json:"photo_file_id"`
// Optional
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to an animated GIF file.
// By default, this animated GIF file will be sent by the user with optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
type InlineQueryResultGif struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
GifURL string `json:"gif_url"`
// Optional
GifWidth int `json:"gif_width,omitempty"`
GifHeight int `json:"gif_height,omitempty"`
GifDuration int `json:"gif_duration"`
ThumbURL string `json:"thumb_url,omitempty"`
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to an animated GIF file stored on the Telegram servers.
// By default, this animated GIF file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
type InlineQueryResultCachedGif struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
GifFileID string `json:"gif_file_id"`
// Optional
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound).
// By default, this animated MPEG-4 file will be sent by the user with optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
type InlineQueryResultMpeg4Gif struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Mpeg4URL string `json:"mpeg4_url"`
// Optional
Mpeg4Width int `json:"mpeg4_width,omitempty"`
Mpeg4Height int `json:"mpeg4_height,omitempty"`
Mpeg4Duration int `json:"mpeg4_duration,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers.
// By default, this animated MPEG-4 file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
type InlineQueryResultCachedMpeg4Gif struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Mpeg4FileID string `json:"mpeg4_file_id"`
// Optional
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a page containing an embedded video player or a video file.
// By default, this video file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
type InlineQueryResultVideo struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
VideoURL string `json:"video_url"`
MimeType string `json:"mime_type"`
// Optional
ThumbURL string `json:"thumb_url,omitempty"`
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
VideoWidth int `json:"video_width,omitempty"`
VideoHeight int `json:"video_height,omitempty"`
VideoDuration int `json:"video_duration,omitempty"`
Description string `json:"description,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a video file stored on the Telegram servers.
// By default, this video file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
type InlineQueryResultCachedVideo struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
VideoFileID string `json:"video_file_id"`
// Optional
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to an mp3 audio file.
// By default, this audio file will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
type InlineQueryResultAudio struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
AudioURL string `json:"audio_url"`
Title string `json:"title"`
// Optional
Performer string `json:"performer,omitempty"`
AudioDuration int `json:"audio_duration,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to an mp3 audio file stored on the Telegram servers.
// By default, this audio file will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
type InlineQueryResultCachedAudio struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
AudioFileID string `json:"audio_file_id"`
// Optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a voice recording in an .ogg container encoded with OPUS.
// By default, this voice recording will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
type InlineQueryResultVoice struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
VoiceURL string `json:"voice_url"`
Title string `json:"title"`
// Optional
VoiceDuration int `json:"voice_duration,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a voice message stored on the Telegram servers.
// By default, this voice message will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
type InlineQueryResultCachedVoice struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
VoiceFileID string `json:"voice_file_id"`
// Optional
Title string `json:"title"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a file.
// By default, this file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
type InlineQueryResultDocument struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Title string `json:"title"`
DocumentURL string `json:"document_url"`
MimeType string `json:"mime_type"`
// Optional
Caption string `json:"caption,omitempty"`
Description string `json:"description,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
ThumbWidth int `json:"thumb_width,omitempty"`
ThumbHeight int `json:"thumb_height,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a file stored on the Telegram servers.
// By default, this file will be sent by the user with an optional caption.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
// Currently, only pdf-files and zip archives can be sent using this method.
type InlineQueryResultCachedDocument struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Title string `json:"title"`
DocumentFileID string `json:"document_file_id"`
// Optional
Description string `json:"description,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a location on a map.
// By default, the location will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
type InlineQueryResultLocation struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Title string `json:"title"`
// Optional
ThumbURL string `json:"thumb_url,omitempty"`
ThumbWidth int `json:"thumb_width,omitempty"`
ThumbHeight int `json:"thumb_height,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a venue.
// By default, the venue will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
type InlineQueryResultVenue struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Title string `json:"title"`
Address string `json:"address"`
// Optional
FoursquareID string `json:"foursquare_id,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
ThumbWidth int `json:"thumb_width,omitempty"`
ThumbHeight int `json:"thumb_height,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a link to a sticker stored on the Telegram servers.
// By default, this sticker will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
type InlineQueryResultCachedSticker struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
StickerFileID string `json:"sticker_file_id"`
// Optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a contact with a phone number.
// By default, this contact will be sent by the user.
// Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
type InlineQueryResultContact struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
// Optional
LastName string `json:"last_name,omitempty"`
ThumbURL string `json:"thumb_url,omitempty"`
ThumbWidth int `json:"thumb_width,omitempty"`
ThumbHeight int `json:"thumb_height,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent InputMessageContent `json:"input_message_content,omitempty"`
}
// Represents a Game.
type InlineQueryResultGame struct {
inlineQueryResultImplementation
Type InlineResultType `json:"type"`
ID string `json:"id"`
GameShortName string `json:"game_short_name"`
// Optional
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
type InputMessageContent interface {
itsInputMessageContent()
}
type inputMessageContentImplementation struct{}
func (i inputMessageContentImplementation) itsInputMessageContent() {}
// InputTextMessageContent contains text for displaying as an inline query result.
type InputTextMessageContent struct {
inputMessageContentImplementation
MessageText string `json:"message_text"`
ParseMode ParseMode `json:"parse_mode"`
DisableWebPagePreview bool `json:"disable_web_page_preview"`
}
// InputLocationMessageContent contains a location for displaying as an inline query result.
type InputLocationMessageContent struct {
inputMessageContentImplementation
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
}
// InputVenueMessageContent contains a venue for displaying an inline query result.
type InputVenueMessageContent struct {
inputMessageContentImplementation
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Title string `json:"title"`
Address string `json:"address"`
FoursquareID string `json:"foursquare_id"`
}
// InputContactMessageContent contains a contact for displaying as an inline query result.
type InputContactMessageContent struct {
inputMessageContentImplementation
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
}