@im-more/dsh-telegram 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/cordis.patch.yml +10 -0
  3. package/lib/index.js +2067 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/types/bot.d.ts +70 -0
  6. package/lib/types/bot.d.ts.map +1 -0
  7. package/lib/types/bot.js +231 -0
  8. package/lib/types/bot.js.map +1 -0
  9. package/lib/types/config.d.ts +34 -0
  10. package/lib/types/config.d.ts.map +1 -0
  11. package/lib/types/config.js +41 -0
  12. package/lib/types/config.js.map +1 -0
  13. package/lib/types/decode.d.ts +39 -0
  14. package/lib/types/decode.d.ts.map +1 -0
  15. package/lib/types/decode.js +382 -0
  16. package/lib/types/decode.js.map +1 -0
  17. package/lib/types/errors.d.ts +33 -0
  18. package/lib/types/errors.d.ts.map +1 -0
  19. package/lib/types/errors.js +89 -0
  20. package/lib/types/errors.js.map +1 -0
  21. package/lib/types/identity.d.ts +19 -0
  22. package/lib/types/identity.d.ts.map +1 -0
  23. package/lib/types/identity.js +34 -0
  24. package/lib/types/identity.js.map +1 -0
  25. package/lib/types/index.d.ts +10 -0
  26. package/lib/types/index.d.ts.map +1 -0
  27. package/lib/types/index.js +8 -0
  28. package/lib/types/index.js.map +1 -0
  29. package/lib/types/media.d.ts +38 -0
  30. package/lib/types/media.d.ts.map +1 -0
  31. package/lib/types/media.js +65 -0
  32. package/lib/types/media.js.map +1 -0
  33. package/lib/types/modes/html.d.ts +16 -0
  34. package/lib/types/modes/html.d.ts.map +1 -0
  35. package/lib/types/modes/html.js +155 -0
  36. package/lib/types/modes/html.js.map +1 -0
  37. package/lib/types/modes/plain.d.ts +14 -0
  38. package/lib/types/modes/plain.d.ts.map +1 -0
  39. package/lib/types/modes/plain.js +56 -0
  40. package/lib/types/modes/plain.js.map +1 -0
  41. package/lib/types/modes/shared.d.ts +140 -0
  42. package/lib/types/modes/shared.d.ts.map +1 -0
  43. package/lib/types/modes/shared.js +405 -0
  44. package/lib/types/modes/shared.js.map +1 -0
  45. package/lib/types/polling.d.ts +26 -0
  46. package/lib/types/polling.d.ts.map +1 -0
  47. package/lib/types/polling.js +149 -0
  48. package/lib/types/polling.js.map +1 -0
  49. package/lib/types/request.d.ts +67 -0
  50. package/lib/types/request.d.ts.map +1 -0
  51. package/lib/types/request.js +158 -0
  52. package/lib/types/request.js.map +1 -0
  53. package/lib/types/secret.d.ts +27 -0
  54. package/lib/types/secret.d.ts.map +1 -0
  55. package/lib/types/secret.js +39 -0
  56. package/lib/types/secret.js.map +1 -0
  57. package/lib/types/send.d.ts +48 -0
  58. package/lib/types/send.d.ts.map +1 -0
  59. package/lib/types/send.js +326 -0
  60. package/lib/types/send.js.map +1 -0
  61. package/lib/types/types/game.d.ts +102 -0
  62. package/lib/types/types/game.d.ts.map +1 -0
  63. package/lib/types/types/game.js +5 -0
  64. package/lib/types/types/game.js.map +1 -0
  65. package/lib/types/types/index.d.ts +2751 -0
  66. package/lib/types/types/index.d.ts.map +1 -0
  67. package/lib/types/types/index.js +88 -0
  68. package/lib/types/types/index.js.map +1 -0
  69. package/lib/types/types/inline.d.ts +796 -0
  70. package/lib/types/types/inline.d.ts.map +1 -0
  71. package/lib/types/types/inline.js +4 -0
  72. package/lib/types/types/inline.js.map +1 -0
  73. package/lib/types/types/internal.d.ts +32 -0
  74. package/lib/types/types/internal.d.ts.map +1 -0
  75. package/lib/types/types/internal.js +30 -0
  76. package/lib/types/types/internal.js.map +1 -0
  77. package/lib/types/types/passport.d.ts +229 -0
  78. package/lib/types/types/passport.d.ts.map +1 -0
  79. package/lib/types/types/passport.js +3 -0
  80. package/lib/types/types/passport.js.map +1 -0
  81. package/lib/types/types/payment.d.ts +285 -0
  82. package/lib/types/types/payment.d.ts.map +1 -0
  83. package/lib/types/types/payment.js +6 -0
  84. package/lib/types/types/payment.js.map +1 -0
  85. package/lib/types/types/sticker.d.ts +221 -0
  86. package/lib/types/types/sticker.d.ts.map +1 -0
  87. package/lib/types/types/sticker.js +11 -0
  88. package/lib/types/types/sticker.js.map +1 -0
  89. package/lib/types/types/update.d.ts +97 -0
  90. package/lib/types/types/update.d.ts.map +1 -0
  91. package/lib/types/types/update.js +6 -0
  92. package/lib/types/types/update.js.map +1 -0
  93. package/lib/types/webhook.d.ts +29 -0
  94. package/lib/types/webhook.d.ts.map +1 -0
  95. package/lib/types/webhook.js +129 -0
  96. package/lib/types/webhook.js.map +1 -0
  97. package/package.json +61 -3
  98. package/src/bot.ts +349 -0
  99. package/src/config.ts +73 -0
  100. package/src/decode.ts +472 -0
  101. package/src/errors.ts +103 -0
  102. package/src/identity.ts +41 -0
  103. package/src/index.ts +14 -0
  104. package/src/media.ts +79 -0
  105. package/src/modes/html.ts +193 -0
  106. package/src/modes/plain.ts +75 -0
  107. package/src/modes/shared.ts +505 -0
  108. package/src/polling.ts +176 -0
  109. package/src/request.ts +224 -0
  110. package/src/secret.ts +46 -0
  111. package/src/send.ts +454 -0
  112. package/src/types/.eslintrc.yml +2 -0
  113. package/src/types/game.ts +112 -0
  114. package/src/types/index.ts +3028 -0
  115. package/src/types/inline.ts +857 -0
  116. package/src/types/internal.ts +64 -0
  117. package/src/types/passport.ts +256 -0
  118. package/src/types/payment.ts +304 -0
  119. package/src/types/sticker.ts +244 -0
  120. package/src/types/update.ts +107 -0
  121. package/src/webhook.ts +168 -0
  122. package/README.md +0 -3
@@ -0,0 +1,857 @@
1
+ import { Float, InlineKeyboardMarkup, Integer, Internal, LabeledPrice, Location, MessageEntity, User } from './index.ts'
2
+
3
+ /**
4
+ * This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
5
+ * @see https://core.telegram.org/bots/api#inlinequery
6
+ */
7
+ export interface InlineQuery {
8
+ /** Unique identifier for this query */
9
+ id?: string
10
+ /** Sender */
11
+ from?: User
12
+ /** Text of the query (up to 256 characters) */
13
+ query?: string
14
+ /** Offset of the results to be returned, can be controlled by the bot */
15
+ offset?: string
16
+ /** Optional. Type of the chat, from which the inline query was sent. Can be either "sender" for a private chat with the inline query sender, "private", "group", "supergroup", or "channel". The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */
17
+ chat_type?: string
18
+ /** Optional. Sender location, only for bots that request user location */
19
+ location?: Location
20
+ }
21
+
22
+ export interface AnswerInlineQueryPayload {
23
+ /** Unique identifier for the answered query */
24
+ inline_query_id?: string
25
+ /** A JSON-serialized array of results for the inline query */
26
+ results?: InlineQueryResult[]
27
+ /** The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. */
28
+ cache_time?: Integer
29
+ /** 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 */
30
+ is_personal?: boolean
31
+ /** 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. */
32
+ next_offset?: string
33
+ /** 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 */
34
+ switch_pm_text?: string
35
+ /**
36
+ * 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.
37
+ *
38
+ * Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
39
+ */
40
+ switch_pm_parameter?: string
41
+ }
42
+
43
+ /**
44
+ * This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
45
+ * - InlineQueryResultCachedAudio
46
+ * - InlineQueryResultCachedDocument
47
+ * - InlineQueryResultCachedGif
48
+ * - InlineQueryResultCachedMpeg4Gif
49
+ * - InlineQueryResultCachedPhoto
50
+ * - InlineQueryResultCachedSticker
51
+ * - InlineQueryResultCachedVideo
52
+ * - InlineQueryResultCachedVoice
53
+ * - InlineQueryResultArticle
54
+ * - InlineQueryResultAudio
55
+ * - InlineQueryResultContact
56
+ * - InlineQueryResultGame
57
+ * - InlineQueryResultDocument
58
+ * - InlineQueryResultGif
59
+ * - InlineQueryResultLocation
60
+ * - InlineQueryResultMpeg4Gif
61
+ * - InlineQueryResultPhoto
62
+ * - InlineQueryResultVenue
63
+ * - InlineQueryResultVideo
64
+ * - InlineQueryResultVoice
65
+ * Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.
66
+ * @see https://core.telegram.org/bots/api#inlinequeryresult
67
+ */
68
+ export type InlineQueryResult =
69
+ | InlineQueryResultCachedAudio
70
+ | InlineQueryResultCachedDocument
71
+ | InlineQueryResultCachedGif
72
+ | InlineQueryResultCachedMpeg4Gif
73
+ | InlineQueryResultCachedPhoto
74
+ | InlineQueryResultCachedSticker
75
+ | InlineQueryResultCachedVideo
76
+ | InlineQueryResultCachedVoice
77
+ | InlineQueryResultArticle
78
+ | InlineQueryResultAudio
79
+ | InlineQueryResultContact
80
+ | InlineQueryResultGame
81
+ | InlineQueryResultDocument
82
+ | InlineQueryResultGif
83
+ | InlineQueryResultLocation
84
+ | InlineQueryResultMpeg4Gif
85
+ | InlineQueryResultPhoto
86
+ | InlineQueryResultVenue
87
+ | InlineQueryResultVideo
88
+ | InlineQueryResultVoice
89
+
90
+ /**
91
+ * Represents a link to an article or web page.
92
+ * @see https://core.telegram.org/bots/api#inlinequeryresultarticle
93
+ */
94
+ export interface InlineQueryResultArticle {
95
+ /** Type of the result, must be article */
96
+ type?: string
97
+ /** Unique identifier for this result, 1-64 Bytes */
98
+ id?: string
99
+ /** Title of the result */
100
+ title?: string
101
+ /** Content of the message to be sent */
102
+ input_message_content?: InputMessageContent
103
+ /** Optional. Inline keyboard attached to the message */
104
+ reply_markup?: InlineKeyboardMarkup
105
+ /** Optional. URL of the result */
106
+ url?: string
107
+ /** Optional. Pass True, if you don't want the URL to be shown in the message */
108
+ hide_url?: boolean
109
+ /** Optional. Short description of the result */
110
+ description?: string
111
+ /** Optional. Url of the thumbnail for the result */
112
+ thumb_url?: string
113
+ /** Optional. Thumbnail width */
114
+ thumb_width?: Integer
115
+ /** Optional. Thumbnail height */
116
+ thumb_height?: Integer
117
+ }
118
+
119
+ /**
120
+ * 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.
121
+ * @see https://core.telegram.org/bots/api#inlinequeryresultphoto
122
+ */
123
+ export interface InlineQueryResultPhoto {
124
+ /** Type of the result, must be photo */
125
+ type?: string
126
+ /** Unique identifier for this result, 1-64 bytes */
127
+ id?: string
128
+ /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */
129
+ photo_url?: string
130
+ /** URL of the thumbnail for the photo */
131
+ thumb_url?: string
132
+ /** Optional. Width of the photo */
133
+ photo_width?: Integer
134
+ /** Optional. Height of the photo */
135
+ photo_height?: Integer
136
+ /** Optional. Title for the result */
137
+ title?: string
138
+ /** Optional. Short description of the result */
139
+ description?: string
140
+ /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */
141
+ caption?: string
142
+ /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */
143
+ parse_mode?: string
144
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
145
+ caption_entities?: MessageEntity[]
146
+ /** Optional. Inline keyboard attached to the message */
147
+ reply_markup?: InlineKeyboardMarkup
148
+ /** Optional. Content of the message to be sent instead of the photo */
149
+ input_message_content?: InputMessageContent
150
+ }
151
+
152
+ /**
153
+ * 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.
154
+ * @see https://core.telegram.org/bots/api#inlinequeryresultgif
155
+ */
156
+ export interface InlineQueryResultGif {
157
+ /** Type of the result, must be gif */
158
+ type?: string
159
+ /** Unique identifier for this result, 1-64 bytes */
160
+ id?: string
161
+ /** A valid URL for the GIF file. File size must not exceed 1MB */
162
+ gif_url?: string
163
+ /** Optional. Width of the GIF */
164
+ gif_width?: Integer
165
+ /** Optional. Height of the GIF */
166
+ gif_height?: Integer
167
+ /** Optional. Duration of the GIF in seconds */
168
+ gif_duration?: Integer
169
+ /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
170
+ thumb_url?: string
171
+ /** Optional. MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg" */
172
+ thumb_mime_type?: string
173
+ /** Optional. Title for the result */
174
+ title?: string
175
+ /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
176
+ caption?: string
177
+ /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */
178
+ parse_mode?: string
179
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
180
+ caption_entities?: MessageEntity[]
181
+ /** Optional. Inline keyboard attached to the message */
182
+ reply_markup?: InlineKeyboardMarkup
183
+ /** Optional. Content of the message to be sent instead of the GIF animation */
184
+ input_message_content?: InputMessageContent
185
+ }
186
+
187
+ /**
188
+ * 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.
189
+ * @see https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
190
+ */
191
+ export interface InlineQueryResultMpeg4Gif {
192
+ /** Type of the result, must be mpeg4_gif */
193
+ type?: string
194
+ /** Unique identifier for this result, 1-64 bytes */
195
+ id?: string
196
+ /** A valid URL for the MP4 file. File size must not exceed 1MB */
197
+ mpeg4_url?: string
198
+ /** Optional. Video width */
199
+ mpeg4_width?: Integer
200
+ /** Optional. Video height */
201
+ mpeg4_height?: Integer
202
+ /** Optional. Video duration in seconds */
203
+ mpeg4_duration?: Integer
204
+ /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
205
+ thumb_url?: string
206
+ /** Optional. MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg" */
207
+ thumb_mime_type?: string
208
+ /** Optional. Title for the result */
209
+ title?: string
210
+ /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
211
+ caption?: string
212
+ /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */
213
+ parse_mode?: string
214
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
215
+ caption_entities?: MessageEntity[]
216
+ /** Optional. Inline keyboard attached to the message */
217
+ reply_markup?: InlineKeyboardMarkup
218
+ /** Optional. Content of the message to be sent instead of the video animation */
219
+ input_message_content?: InputMessageContent
220
+ }
221
+
222
+ /**
223
+ * 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.
224
+ * If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content.
225
+ * @see https://core.telegram.org/bots/api#inlinequeryresultvideo
226
+ */
227
+ export interface InlineQueryResultVideo {
228
+ /** Type of the result, must be video */
229
+ type?: string
230
+ /** Unique identifier for this result, 1-64 bytes */
231
+ id?: string
232
+ /** A valid URL for the embedded video player or video file */
233
+ video_url?: string
234
+ /** Mime type of the content of video url, "text/html" or "video/mp4" */
235
+ mime_type?: string
236
+ /** URL of the thumbnail (JPEG only) for the video */
237
+ thumb_url?: string
238
+ /** Title for the result */
239
+ title?: string
240
+ /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */
241
+ caption?: string
242
+ /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */
243
+ parse_mode?: string
244
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
245
+ caption_entities?: MessageEntity[]
246
+ /** Optional. Video width */
247
+ video_width?: Integer
248
+ /** Optional. Video height */
249
+ video_height?: Integer
250
+ /** Optional. Video duration in seconds */
251
+ video_duration?: Integer
252
+ /** Optional. Short description of the result */
253
+ description?: string
254
+ /** Optional. Inline keyboard attached to the message */
255
+ reply_markup?: InlineKeyboardMarkup
256
+ /** 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). */
257
+ input_message_content?: InputMessageContent
258
+ }
259
+
260
+ /**
261
+ * 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.
262
+ * @see https://core.telegram.org/bots/api#inlinequeryresultaudio
263
+ */
264
+ export interface InlineQueryResultAudio {
265
+ /** Type of the result, must be audio */
266
+ type?: string
267
+ /** Unique identifier for this result, 1-64 bytes */
268
+ id?: string
269
+ /** A valid URL for the audio file */
270
+ audio_url?: string
271
+ /** Title */
272
+ title?: string
273
+ /** Optional. Caption, 0-1024 characters after entities parsing */
274
+ caption?: string
275
+ /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */
276
+ parse_mode?: string
277
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
278
+ caption_entities?: MessageEntity[]
279
+ /** Optional. Performer */
280
+ performer?: string
281
+ /** Optional. Audio duration in seconds */
282
+ audio_duration?: Integer
283
+ /** Optional. Inline keyboard attached to the message */
284
+ reply_markup?: InlineKeyboardMarkup
285
+ /** Optional. Content of the message to be sent instead of the audio */
286
+ input_message_content?: InputMessageContent
287
+ }
288
+
289
+ /**
290
+ * 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.
291
+ * @see https://core.telegram.org/bots/api#inlinequeryresultvoice
292
+ */
293
+ export interface InlineQueryResultVoice {
294
+ /** Type of the result, must be voice */
295
+ type?: string
296
+ /** Unique identifier for this result, 1-64 bytes */
297
+ id?: string
298
+ /** A valid URL for the voice recording */
299
+ voice_url?: string
300
+ /** Recording title */
301
+ title?: string
302
+ /** Optional. Caption, 0-1024 characters after entities parsing */
303
+ caption?: string
304
+ /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */
305
+ parse_mode?: string
306
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
307
+ caption_entities?: MessageEntity[]
308
+ /** Optional. Recording duration in seconds */
309
+ voice_duration?: Integer
310
+ /** Optional. Inline keyboard attached to the message */
311
+ reply_markup?: InlineKeyboardMarkup
312
+ /** Optional. Content of the message to be sent instead of the voice recording */
313
+ input_message_content?: InputMessageContent
314
+ }
315
+
316
+ /**
317
+ * 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.
318
+ * @see https://core.telegram.org/bots/api#inlinequeryresultdocument
319
+ */
320
+ export interface InlineQueryResultDocument {
321
+ /** Type of the result, must be document */
322
+ type?: string
323
+ /** Unique identifier for this result, 1-64 bytes */
324
+ id?: string
325
+ /** Title for the result */
326
+ title?: string
327
+ /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */
328
+ caption?: string
329
+ /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */
330
+ parse_mode?: string
331
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
332
+ caption_entities?: MessageEntity[]
333
+ /** A valid URL for the file */
334
+ document_url?: string
335
+ /** Mime type of the content of the file, either "application/pdf" or "application/zip" */
336
+ mime_type?: string
337
+ /** Optional. Short description of the result */
338
+ description?: string
339
+ /** Optional. Inline keyboard attached to the message */
340
+ reply_markup?: InlineKeyboardMarkup
341
+ /** Optional. Content of the message to be sent instead of the file */
342
+ input_message_content?: InputMessageContent
343
+ /** Optional. URL of the thumbnail (JPEG only) for the file */
344
+ thumb_url?: string
345
+ /** Optional. Thumbnail width */
346
+ thumb_width?: Integer
347
+ /** Optional. Thumbnail height */
348
+ thumb_height?: Integer
349
+ }
350
+
351
+ /**
352
+ * 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.
353
+ * @see https://core.telegram.org/bots/api#inlinequeryresultlocation
354
+ */
355
+ export interface InlineQueryResultLocation {
356
+ /** Type of the result, must be location */
357
+ type?: string
358
+ /** Unique identifier for this result, 1-64 Bytes */
359
+ id?: string
360
+ /** Location latitude in degrees */
361
+ latitude?: Float
362
+ /** Location longitude in degrees */
363
+ longitude?: Float
364
+ /** Location title */
365
+ title?: string
366
+ /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */
367
+ horizontal_accuracy?: Float
368
+ /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */
369
+ live_period?: Integer
370
+ /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
371
+ heading?: Integer
372
+ /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
373
+ proximity_alert_radius?: Integer
374
+ /** Optional. Inline keyboard attached to the message */
375
+ reply_markup?: InlineKeyboardMarkup
376
+ /** Optional. Content of the message to be sent instead of the location */
377
+ input_message_content?: InputMessageContent
378
+ /** Optional. Url of the thumbnail for the result */
379
+ thumb_url?: string
380
+ /** Optional. Thumbnail width */
381
+ thumb_width?: Integer
382
+ /** Optional. Thumbnail height */
383
+ thumb_height?: Integer
384
+ }
385
+
386
+ /**
387
+ * 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.
388
+ * @see https://core.telegram.org/bots/api#inlinequeryresultvenue
389
+ */
390
+ export interface InlineQueryResultVenue {
391
+ /** Type of the result, must be venue */
392
+ type?: string
393
+ /** Unique identifier for this result, 1-64 Bytes */
394
+ id?: string
395
+ /** Latitude of the venue location in degrees */
396
+ latitude?: Float
397
+ /** Longitude of the venue location in degrees */
398
+ longitude?: Float
399
+ /** Title of the venue */
400
+ title?: string
401
+ /** Address of the venue */
402
+ address?: string
403
+ /** Optional. Foursquare identifier of the venue if known */
404
+ foursquare_id?: string
405
+ /** Optional. Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
406
+ foursquare_type?: string
407
+ /** Optional. Google Places identifier of the venue */
408
+ google_place_id?: string
409
+ /** Optional. Google Places type of the venue. (See supported types.) */
410
+ google_place_type?: string
411
+ /** Optional. Inline keyboard attached to the message */
412
+ reply_markup?: InlineKeyboardMarkup
413
+ /** Optional. Content of the message to be sent instead of the venue */
414
+ input_message_content?: InputMessageContent
415
+ /** Optional. Url of the thumbnail for the result */
416
+ thumb_url?: string
417
+ /** Optional. Thumbnail width */
418
+ thumb_width?: Integer
419
+ /** Optional. Thumbnail height */
420
+ thumb_height?: Integer
421
+ }
422
+
423
+ /**
424
+ * 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.
425
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcontact
426
+ */
427
+ export interface InlineQueryResultContact {
428
+ /** Type of the result, must be contact */
429
+ type?: string
430
+ /** Unique identifier for this result, 1-64 Bytes */
431
+ id?: string
432
+ /** Contact's phone number */
433
+ phone_number?: string
434
+ /** Contact's first name */
435
+ first_name?: string
436
+ /** Optional. Contact's last name */
437
+ last_name?: string
438
+ /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */
439
+ vcard?: string
440
+ /** Optional. Inline keyboard attached to the message */
441
+ reply_markup?: InlineKeyboardMarkup
442
+ /** Optional. Content of the message to be sent instead of the contact */
443
+ input_message_content?: InputMessageContent
444
+ /** Optional. Url of the thumbnail for the result */
445
+ thumb_url?: string
446
+ /** Optional. Thumbnail width */
447
+ thumb_width?: Integer
448
+ /** Optional. Thumbnail height */
449
+ thumb_height?: Integer
450
+ }
451
+
452
+ /**
453
+ * Represents a Game.
454
+ * @see https://core.telegram.org/bots/api#inlinequeryresultgame
455
+ */
456
+ export interface InlineQueryResultGame {
457
+ /** Type of the result, must be game */
458
+ type?: string
459
+ /** Unique identifier for this result, 1-64 bytes */
460
+ id?: string
461
+ /** Short name of the game */
462
+ game_short_name?: string
463
+ /** Optional. Inline keyboard attached to the message */
464
+ reply_markup?: InlineKeyboardMarkup
465
+ }
466
+
467
+ /**
468
+ * 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.
469
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
470
+ */
471
+ export interface InlineQueryResultCachedPhoto {
472
+ /** Type of the result, must be photo */
473
+ type?: string
474
+ /** Unique identifier for this result, 1-64 bytes */
475
+ id?: string
476
+ /** A valid file identifier of the photo */
477
+ photo_file_id?: string
478
+ /** Optional. Title for the result */
479
+ title?: string
480
+ /** Optional. Short description of the result */
481
+ description?: string
482
+ /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */
483
+ caption?: string
484
+ /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */
485
+ parse_mode?: string
486
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
487
+ caption_entities?: MessageEntity[]
488
+ /** Optional. Inline keyboard attached to the message */
489
+ reply_markup?: InlineKeyboardMarkup
490
+ /** Optional. Content of the message to be sent instead of the photo */
491
+ input_message_content?: InputMessageContent
492
+ }
493
+
494
+ /**
495
+ * 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.
496
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedgif
497
+ */
498
+ export interface InlineQueryResultCachedGif {
499
+ /** Type of the result, must be gif */
500
+ type?: string
501
+ /** Unique identifier for this result, 1-64 bytes */
502
+ id?: string
503
+ /** A valid file identifier for the GIF file */
504
+ gif_file_id?: string
505
+ /** Optional. Title for the result */
506
+ title?: string
507
+ /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
508
+ caption?: string
509
+ /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */
510
+ parse_mode?: string
511
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
512
+ caption_entities?: MessageEntity[]
513
+ /** Optional. Inline keyboard attached to the message */
514
+ reply_markup?: InlineKeyboardMarkup
515
+ /** Optional. Content of the message to be sent instead of the GIF animation */
516
+ input_message_content?: InputMessageContent
517
+ }
518
+
519
+ /**
520
+ * 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.
521
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
522
+ */
523
+ export interface InlineQueryResultCachedMpeg4Gif {
524
+ /** Type of the result, must be mpeg4_gif */
525
+ type?: string
526
+ /** Unique identifier for this result, 1-64 bytes */
527
+ id?: string
528
+ /** A valid file identifier for the MP4 file */
529
+ mpeg4_file_id?: string
530
+ /** Optional. Title for the result */
531
+ title?: string
532
+ /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
533
+ caption?: string
534
+ /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */
535
+ parse_mode?: string
536
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
537
+ caption_entities?: MessageEntity[]
538
+ /** Optional. Inline keyboard attached to the message */
539
+ reply_markup?: InlineKeyboardMarkup
540
+ /** Optional. Content of the message to be sent instead of the video animation */
541
+ input_message_content?: InputMessageContent
542
+ }
543
+
544
+ /**
545
+ * 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.
546
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedsticker
547
+ */
548
+ export interface InlineQueryResultCachedSticker {
549
+ /** Type of the result, must be sticker */
550
+ type?: string
551
+ /** Unique identifier for this result, 1-64 bytes */
552
+ id?: string
553
+ /** A valid file identifier of the sticker */
554
+ sticker_file_id?: string
555
+ /** Optional. Inline keyboard attached to the message */
556
+ reply_markup?: InlineKeyboardMarkup
557
+ /** Optional. Content of the message to be sent instead of the sticker */
558
+ input_message_content?: InputMessageContent
559
+ }
560
+
561
+ /**
562
+ * 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.
563
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcacheddocument
564
+ */
565
+ export interface InlineQueryResultCachedDocument {
566
+ /** Type of the result, must be document */
567
+ type?: string
568
+ /** Unique identifier for this result, 1-64 bytes */
569
+ id?: string
570
+ /** Title for the result */
571
+ title?: string
572
+ /** A valid file identifier for the file */
573
+ document_file_id?: string
574
+ /** Optional. Short description of the result */
575
+ description?: string
576
+ /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */
577
+ caption?: string
578
+ /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */
579
+ parse_mode?: string
580
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
581
+ caption_entities?: MessageEntity[]
582
+ /** Optional. Inline keyboard attached to the message */
583
+ reply_markup?: InlineKeyboardMarkup
584
+ /** Optional. Content of the message to be sent instead of the file */
585
+ input_message_content?: InputMessageContent
586
+ }
587
+
588
+ /**
589
+ * 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.
590
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
591
+ */
592
+ export interface InlineQueryResultCachedVideo {
593
+ /** Type of the result, must be video */
594
+ type?: string
595
+ /** Unique identifier for this result, 1-64 bytes */
596
+ id?: string
597
+ /** A valid file identifier for the video file */
598
+ video_file_id?: string
599
+ /** Title for the result */
600
+ title?: string
601
+ /** Optional. Short description of the result */
602
+ description?: string
603
+ /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */
604
+ caption?: string
605
+ /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */
606
+ parse_mode?: string
607
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
608
+ caption_entities?: MessageEntity[]
609
+ /** Optional. Inline keyboard attached to the message */
610
+ reply_markup?: InlineKeyboardMarkup
611
+ /** Optional. Content of the message to be sent instead of the video */
612
+ input_message_content?: InputMessageContent
613
+ }
614
+
615
+ /**
616
+ * 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.
617
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedvoice
618
+ */
619
+ export interface InlineQueryResultCachedVoice {
620
+ /** Type of the result, must be voice */
621
+ type?: string
622
+ /** Unique identifier for this result, 1-64 bytes */
623
+ id?: string
624
+ /** A valid file identifier for the voice message */
625
+ voice_file_id?: string
626
+ /** Voice message title */
627
+ title?: string
628
+ /** Optional. Caption, 0-1024 characters after entities parsing */
629
+ caption?: string
630
+ /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */
631
+ parse_mode?: string
632
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
633
+ caption_entities?: MessageEntity[]
634
+ /** Optional. Inline keyboard attached to the message */
635
+ reply_markup?: InlineKeyboardMarkup
636
+ /** Optional. Content of the message to be sent instead of the voice message */
637
+ input_message_content?: InputMessageContent
638
+ }
639
+
640
+ /**
641
+ * 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.
642
+ * @see https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
643
+ */
644
+ export interface InlineQueryResultCachedAudio {
645
+ /** Type of the result, must be audio */
646
+ type?: string
647
+ /** Unique identifier for this result, 1-64 bytes */
648
+ id?: string
649
+ /** A valid file identifier for the audio file */
650
+ audio_file_id?: string
651
+ /** Optional. Caption, 0-1024 characters after entities parsing */
652
+ caption?: string
653
+ /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */
654
+ parse_mode?: string
655
+ /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
656
+ caption_entities?: MessageEntity[]
657
+ /** Optional. Inline keyboard attached to the message */
658
+ reply_markup?: InlineKeyboardMarkup
659
+ /** Optional. Content of the message to be sent instead of the audio */
660
+ input_message_content?: InputMessageContent
661
+ }
662
+
663
+ /**
664
+ * This object represents the content of a message to be sent as a result of an inline query.
665
+ * Telegram clients currently support the following 5 types:
666
+ * - InputTextMessageContent
667
+ * - InputLocationMessageContent
668
+ * - InputVenueMessageContent
669
+ * - InputContactMessageContent
670
+ * - InputInvoiceMessageContent
671
+ * @see https://core.telegram.org/bots/api#inputmessagecontent
672
+ */
673
+ export type InputMessageContent =
674
+ | InputTextMessageContent
675
+ | InputLocationMessageContent
676
+ | InputVenueMessageContent
677
+ | InputContactMessageContent
678
+ | InputInvoiceMessageContent
679
+
680
+ /**
681
+ * Represents the content of a text message to be sent as the result of an inline query.
682
+ * @see https://core.telegram.org/bots/api#inputtextmessagecontent
683
+ */
684
+ export interface InputTextMessageContent {
685
+ /** Text of the message to be sent, 1-4096 characters */
686
+ message_text?: string
687
+ /** Optional. Mode for parsing entities in the message text. See formatting options for more details. */
688
+ parse_mode?: string
689
+ /** Optional. List of special entities that appear in message text, which can be specified instead of parse_mode */
690
+ entities?: MessageEntity[]
691
+ /** Optional. Disables link previews for links in the sent message */
692
+ disable_web_page_preview?: boolean
693
+ }
694
+
695
+ /**
696
+ * Represents the content of a location message to be sent as the result of an inline query.
697
+ * @see https://core.telegram.org/bots/api#inputlocationmessagecontent
698
+ */
699
+ export interface InputLocationMessageContent {
700
+ /** Latitude of the location in degrees */
701
+ latitude?: Float
702
+ /** Longitude of the location in degrees */
703
+ longitude?: Float
704
+ /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */
705
+ horizontal_accuracy?: Float
706
+ /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */
707
+ live_period?: Integer
708
+ /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
709
+ heading?: Integer
710
+ /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
711
+ proximity_alert_radius?: Integer
712
+ }
713
+
714
+ /**
715
+ * Represents the content of a venue message to be sent as the result of an inline query.
716
+ * @see https://core.telegram.org/bots/api#inputvenuemessagecontent
717
+ */
718
+ export interface InputVenueMessageContent {
719
+ /** Latitude of the venue in degrees */
720
+ latitude?: Float
721
+ /** Longitude of the venue in degrees */
722
+ longitude?: Float
723
+ /** Name of the venue */
724
+ title?: string
725
+ /** Address of the venue */
726
+ address?: string
727
+ /** Optional. Foursquare identifier of the venue, if known */
728
+ foursquare_id?: string
729
+ /** Optional. Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
730
+ foursquare_type?: string
731
+ /** Optional. Google Places identifier of the venue */
732
+ google_place_id?: string
733
+ /** Optional. Google Places type of the venue. (See supported types.) */
734
+ google_place_type?: string
735
+ }
736
+
737
+ /**
738
+ * Represents the content of a contact message to be sent as the result of an inline query.
739
+ * @see https://core.telegram.org/bots/api#inputcontactmessagecontent
740
+ */
741
+ export interface InputContactMessageContent {
742
+ /** Contact's phone number */
743
+ phone_number?: string
744
+ /** Contact's first name */
745
+ first_name?: string
746
+ /** Optional. Contact's last name */
747
+ last_name?: string
748
+ /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */
749
+ vcard?: string
750
+ }
751
+
752
+ /**
753
+ * Represents the content of an invoice message to be sent as the result of an inline query.
754
+ * @see https://core.telegram.org/bots/api#inputinvoicemessagecontent
755
+ */
756
+ export interface InputInvoiceMessageContent {
757
+ /** Product name, 1-32 characters */
758
+ title?: string
759
+ /** Product description, 1-255 characters */
760
+ description?: string
761
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
762
+ payload?: string
763
+ /** Payment provider token, obtained via Botfather */
764
+ provider_token?: string
765
+ /** Three-letter ISO 4217 currency code, see more on currencies */
766
+ currency?: string
767
+ /** Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
768
+ prices?: LabeledPrice[]
769
+ /** Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */
770
+ max_tip_amount?: Integer
771
+ /** Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */
772
+ suggested_tip_amounts?: Integer[]
773
+ /** Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */
774
+ provider_data?: string
775
+ /** Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. */
776
+ photo_url?: string
777
+ /** Optional. Photo size */
778
+ photo_size?: Integer
779
+ /** Optional. Photo width */
780
+ photo_width?: Integer
781
+ /** Optional. Photo height */
782
+ photo_height?: Integer
783
+ /** Optional. Pass True, if you require the user's full name to complete the order */
784
+ need_name?: boolean
785
+ /** Optional. Pass True, if you require the user's phone number to complete the order */
786
+ need_phone_number?: boolean
787
+ /** Optional. Pass True, if you require the user's email address to complete the order */
788
+ need_email?: boolean
789
+ /** Optional. Pass True, if you require the user's shipping address to complete the order */
790
+ need_shipping_address?: boolean
791
+ /** Optional. Pass True, if user's phone number should be sent to provider */
792
+ send_phone_number_to_provider?: boolean
793
+ /** Optional. Pass True, if user's email address should be sent to provider */
794
+ send_email_to_provider?: boolean
795
+ /** Optional. Pass True, if the final price depends on the shipping method */
796
+ is_flexible?: boolean
797
+ }
798
+
799
+ /**
800
+ * Represents a result of an inline query that was chosen by the user and sent to their chat partner.
801
+ * @see https://core.telegram.org/bots/api#choseninlineresult
802
+ */
803
+ export interface ChosenInlineResult {
804
+ /** The unique identifier for the result that was chosen */
805
+ result_id?: string
806
+ /** The user that chose the result */
807
+ from?: User
808
+ /** Optional. Sender location, only for bots that require user location */
809
+ location?: Location
810
+ /** 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. */
811
+ inline_message_id?: string
812
+ /** The query that was used to obtain the result */
813
+ query?: string
814
+ }
815
+
816
+ export interface AnswerWebAppQueryPayload {
817
+ /** Unique identifier for the query to be answered */
818
+ web_app_query_id: string
819
+ /** A JSON-serialized object describing the message to be sent */
820
+ result: InlineQueryResult
821
+ }
822
+
823
+ /**
824
+ * Describes an inline message sent by a Web App on behalf of a user.
825
+ * @see https://core.telegram.org/bots/api#sentwebappmessage
826
+ */
827
+ export interface SentWebAppMessage {
828
+ /** Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
829
+ inline_message_id?: string
830
+ }
831
+
832
+ declare module './update.ts' {
833
+ interface Update {
834
+ /** Optional. New incoming inline query */
835
+ inline_query?: InlineQuery
836
+ /** Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */
837
+ chosen_inline_result?: ChosenInlineResult
838
+ }
839
+ }
840
+
841
+ declare module './internal.ts' {
842
+ interface Internal {
843
+ /**
844
+ * Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.
845
+ * @see https://core.telegram.org/bots/api#answerinlinequery
846
+ */
847
+ answerInlineQuery(payload: AnswerInlineQueryPayload): Promise<boolean>
848
+ /**
849
+ * Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.
850
+ * @see https://core.telegram.org/bots/api#answerwebappquery
851
+ */
852
+ answerWebAppQuery(payload: AnswerWebAppQueryPayload): Promise<SentWebAppMessage>
853
+ }
854
+ }
855
+
856
+ Internal.define('answerInlineQuery')
857
+ Internal.define('answerWebAppQuery')