@grammyjs/types 2.7.2 → 2.8.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.
package/README.md CHANGED
@@ -73,3 +73,19 @@ Consequently, the type `InputFile` is not defined in this library.
73
73
  Instead, grammY specifies its own version of what an `InputFile` is, hence automatically adjusting `@grammyjs/types` with a custom `InputFile` type used throughout all affected methods and interfaces.
74
74
  This is possible by what we call a _proxy type_.
75
75
  grammY then imports the proxy type called `InputProxyType` and parametrises it with its version of `InputFile`.
76
+
77
+ ## Differences to the Bot API
78
+
79
+ Some documentation strings are intentionally different from what is written on the website.
80
+ The actual type definitions themselves are never different.
81
+
82
+ 1. No formatting.
83
+ We do not leverage the markdown capabilities of JSDoc for the sake of easier copying and thus reduced maintenance efforts.
84
+ 2. No mentions of `JSON-serialized`.
85
+ As underlying libraries handle serialization, these words are removed from the explantions.
86
+ 3. No mentions of integer numbers that exceed 2^31 but not 2^51.
87
+ All numbers are 64-bit floats in JS, so this is irrelevant.
88
+ Note that JS bit operators cast numbers to 32-bit integers and back, but we deliberately ignore this because people who use bit operators on identifiers or file sizes should know what they're doing, and they should also know that it's a bad idea.
89
+ 4. No `More info on Sending Files »`.
90
+ File handling is abstracted away by the underlying library.
91
+ Also, without the links, it's useless anyway.
package/api.d.ts CHANGED
@@ -16,7 +16,7 @@ All methods in the Bot API are case-insensitive.
16
16
  All queries must be made using UTF-8. */
17
17
  export type ApiResponse<T> = ApiError | ApiSuccess<T>;
18
18
 
19
- /** Contains information about why a request was unsuccessful. */
19
+ /** Describes why a request was unsuccessful. */
20
20
  export interface ResponseParameters {
21
21
  /** The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
22
22
  migrate_to_chat_id?: number;
package/deno.jsonc ADDED
@@ -0,0 +1 @@
1
+ { "fmt": { "options": { "indentWidth": 2, "proseWrap": "preserve" } } }
package/inline.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface InlineQuery {
13
13
  query: string;
14
14
  /** Offset of the results to be returned, can be controlled by the bot */
15
15
  offset: string;
16
- /** 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 */
16
+ /** 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
17
  chat_type?: "sender" | Chat["type"];
18
18
  /** Sender location, only for bots that request user location */
19
19
  location?: Location;
@@ -136,7 +136,7 @@ export interface InlineQueryResultGif {
136
136
  gif_duration?: number;
137
137
  /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
138
138
  thumb_url: string;
139
- /** MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg" */
139
+ /** MIME type of the thumbnail, must be one of image/jpeg”, image/gif”, or video/mp4”. Defaults to image/jpeg */
140
140
  thumb_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
141
141
  /** Title for the result */
142
142
  title?: string;
@@ -156,7 +156,7 @@ export interface InlineQueryResultMpeg4Gif {
156
156
  type: "mpeg4_gif";
157
157
  /** Unique identifier for this result, 1-64 bytes */
158
158
  id: string;
159
- /** A valid URL for the MP4 file. File size must not exceed 1MB */
159
+ /** A valid URL for the MPEG4 file. File size must not exceed 1MB */
160
160
  mpeg4_url: string;
161
161
  /** Video width */
162
162
  mpeg4_width?: number;
@@ -166,7 +166,7 @@ export interface InlineQueryResultMpeg4Gif {
166
166
  mpeg4_duration?: number;
167
167
  /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
168
168
  thumb_url: string;
169
- /** MIME type of the thumbnail, must be one of "image/jpeg", "image/gif", or "video/mp4". Defaults to "image/jpeg" */
169
+ /** MIME type of the thumbnail, must be one of image/jpeg”, image/gif”, or video/mp4”. Defaults to image/jpeg */
170
170
  thumb_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
171
171
  /** Title for the result */
172
172
  title?: string;
@@ -190,7 +190,7 @@ export interface InlineQueryResultVideo {
190
190
  id: string;
191
191
  /** A valid URL for the embedded video player or video file */
192
192
  video_url: string;
193
- /** Mime type of the content of video url, "text/html" or "video/mp4" */
193
+ /** MIME type of the content of the video URL, text/html or video/mp4 */
194
194
  mime_type: "text/html" | "video/mp4";
195
195
  /** URL of the thumbnail (JPEG only) for the video */
196
196
  thumb_url: string;
@@ -286,7 +286,7 @@ export interface InlineQueryResultDocument {
286
286
  caption_entities?: MessageEntity[];
287
287
  /** A valid URL for the file */
288
288
  document_url: string;
289
- /** Mime type of the content of the file, either “application/pdf” or “application/zip” */
289
+ /** MIME type of the content of the file, either “application/pdf” or “application/zip” */
290
290
  mime_type: "application/pdf" | "application/zip";
291
291
  /** Short description of the result */
292
292
  description?: string;
@@ -322,7 +322,7 @@ export interface InlineQueryResultLocation {
322
322
  live_period?: number;
323
323
  /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
324
324
  heading?: number;
325
- /** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
325
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
326
326
  proximity_alert_radius?: number;
327
327
  /** Inline keyboard attached to the message */
328
328
  reply_markup?: InlineKeyboardMarkup;
@@ -354,7 +354,7 @@ export interface InlineQueryResultVenue {
354
354
  address: string;
355
355
  /** Foursquare identifier of the venue if known */
356
356
  foursquare_id?: string;
357
- /** Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
357
+ /** Foursquare type of the venue, if known. (For example, arts_entertainment/default”, arts_entertainment/aquarium or food/icecream”.) */
358
358
  foursquare_type?: string;
359
359
  /** Google Places identifier of the venue */
360
360
  google_place_id?: string;
@@ -464,7 +464,7 @@ export interface InlineQueryResultCachedMpeg4Gif {
464
464
  type: "mpeg4_gif";
465
465
  /** Unique identifier for this result, 1-64 bytes */
466
466
  id: string;
467
- /** A valid file identifier for the MP4 file */
467
+ /** A valid file identifier for the MPEG4 file */
468
468
  mpeg4_file_id: string;
469
469
  /** Title for the result */
470
470
  title?: string;
@@ -643,7 +643,7 @@ export interface InputVenueMessageContent {
643
643
  address: string;
644
644
  /** Foursquare identifier of the venue, if known */
645
645
  foursquare_id?: string;
646
- /** Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
646
+ /** Foursquare type of the venue, if known. (For example, arts_entertainment/default”, arts_entertainment/aquarium or food/icecream”.) */
647
647
  foursquare_type?: string;
648
648
  /** Google Places identifier of the venue */
649
649
  google_place_id?: string;
@@ -671,7 +671,7 @@ export interface InputInvoiceMessageContent {
671
671
  description: string;
672
672
  /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
673
673
  payload: string;
674
- /** Payment provider token, obtained via Botfather */
674
+ /** Payment provider token, obtained via BotFather */
675
675
  provider_token: string;
676
676
  /** Three-letter ISO 4217 currency code, see more on currencies */
677
677
  currency: string;
@@ -681,11 +681,11 @@ export interface InputInvoiceMessageContent {
681
681
  max_tip_amount?: number;
682
682
  /** An 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. */
683
683
  suggested_tip_amounts?: number[];
684
- /** An 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. */
684
+ /** 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. */
685
685
  provider_data?: string;
686
- /** 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. */
686
+ /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */
687
687
  photo_url?: string;
688
- /** Photo size */
688
+ /** Photo size in bytes */
689
689
  photo_size?: number;
690
690
  /** Photo width */
691
691
  photo_width?: number;
@@ -699,9 +699,9 @@ export interface InputInvoiceMessageContent {
699
699
  need_email?: boolean;
700
700
  /** Pass True, if you require the user's shipping address to complete the order */
701
701
  need_shipping_address?: boolean;
702
- /** Pass True, if user's phone number should be sent to provider */
702
+ /** Pass True, if the user's phone number should be sent to provider */
703
703
  send_phone_number_to_provider?: boolean;
704
- /** Pass True, if user's email address should be sent to provider */
704
+ /** Pass True, if the user's email address should be sent to provider */
705
705
  send_email_to_provider?: boolean;
706
706
  /** Pass True, if the final price depends on the shipping method */
707
707
  is_flexible?: boolean;
@@ -709,7 +709,7 @@ export interface InputInvoiceMessageContent {
709
709
 
710
710
  /** Represents a result of an inline query that was chosen by the user and sent to their chat partner.
711
711
 
712
- Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates. */
712
+ Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates. */
713
713
  export interface ChosenInlineResult {
714
714
  /** The unique identifier for the result that was chosen */
715
715
  result_id: string;
package/manage.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Location, Message, PhotoSize } from "./message";
2
2
  import { Update } from "./update";
3
3
 
4
- /** Contains information about the current status of a webhook. */
4
+ /** Describes the current status of a webhook. */
5
5
  export interface WebhookInfo {
6
6
  /** Webhook URL, may be empty if webhook is not set up */
7
7
  url?: string;
@@ -17,7 +17,7 @@ export interface WebhookInfo {
17
17
  last_error_message: string;
18
18
  /** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
19
19
  last_synchronization_error_date?: number;
20
- /** Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
20
+ /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
21
21
  max_connections: number;
22
22
  /** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
23
23
  allowed_updates: Array<Exclude<keyof Update, "update_id">>;
@@ -37,6 +37,10 @@ export interface User {
37
37
  username?: string;
38
38
  /** IETF language tag of the user's language */
39
39
  language_code?: string;
40
+ /** True, if this user is a Telegram Premium user */
41
+ is_premium?: true;
42
+ /** True, if this user added the bot to the attachment menu */
43
+ added_to_attachment_menu?: true;
40
44
  }
41
45
 
42
46
  /** This object represents a Telegram user or bot that was returned by `getMe`. */
@@ -55,7 +59,7 @@ export namespace Chat {
55
59
  // ABSTRACT
56
60
  /** Internal type holding properties that all kinds of chats share. */
57
61
  interface AbstractChat {
58
- /** Type of chat, can be either "private", "group", "supergroup" or "channel" */
62
+ /** Type of chat, can be either private”, group”, supergroup or channel */
59
63
  type: string;
60
64
  /** Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. */
61
65
  id: number;
@@ -88,9 +92,7 @@ export namespace Chat {
88
92
  }
89
93
  /** Internal type representing super group chats. */
90
94
  export interface SupergroupChat
91
- extends AbstractChat,
92
- UserNameChat,
93
- TitleChat {
95
+ extends AbstractChat, UserNameChat, TitleChat {
94
96
  type: "supergroup";
95
97
  }
96
98
  /** Internal type representing channel chats. */
@@ -103,6 +105,10 @@ export namespace Chat {
103
105
  interface GetChat {
104
106
  /** Chat photo. Returned only in getChat. */
105
107
  photo?: ChatPhoto;
108
+ /** True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
109
+ join_to_send_messages?: true;
110
+ /** True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat. */
111
+ join_by_request?: true;
106
112
  /** The most recent pinned message (by sending date). Returned only in getChat. */
107
113
  pinned_message?: Message;
108
114
  /** The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */
@@ -142,9 +148,7 @@ export namespace Chat {
142
148
  export interface GroupGetChat extends GroupChat, MultiUserGetChat {}
143
149
  /** Internal type representing supergroup chats returned from `getChat`. */
144
150
  export interface SupergroupGetChat
145
- extends SupergroupChat,
146
- MultiUserGetChat,
147
- LargeGetChat {
151
+ extends SupergroupChat, MultiUserGetChat, LargeGetChat {
148
152
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
149
153
  slow_mode_delay?: number;
150
154
  /** For supergroups, name of group sticker set. Returned only in getChat. */
@@ -206,7 +210,7 @@ export interface ChatInviteLink {
206
210
  name?: string;
207
211
  /** Point in time (Unix timestamp) when the link will expire or has been expired */
208
212
  expire_date?: number;
209
- /** Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
213
+ /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
210
214
  member_limit?: number;
211
215
  /** Number of pending join requests created using this link */
212
216
  pending_join_request_count?: number;
@@ -255,7 +259,7 @@ export type ChatMember =
255
259
 
256
260
  /** Represents a chat member that owns the chat and has all administrator privileges. */
257
261
  export interface ChatMemberOwner {
258
- /** The member's status in the chat, always "creator" */
262
+ /** The member's status in the chat, always creator */
259
263
  status: "creator";
260
264
  /** Information about the user */
261
265
  user: User;
@@ -267,7 +271,7 @@ export interface ChatMemberOwner {
267
271
 
268
272
  /** Represents a chat member that has some additional privileges. */
269
273
  export interface ChatMemberAdministrator {
270
- /** The member's status in the chat, always "administrator" */
274
+ /** The member's status in the chat, always administrator */
271
275
  status: "administrator";
272
276
  /** Information about the user */
273
277
  user: User;
@@ -301,7 +305,7 @@ export interface ChatMemberAdministrator {
301
305
 
302
306
  /** Represents a chat member that has no additional privileges or restrictions. */
303
307
  export interface ChatMemberMember {
304
- /** The member's status in the chat, always "member" */
308
+ /** The member's status in the chat, always member */
305
309
  status: "member";
306
310
  /** Information about the user */
307
311
  user: User;
@@ -309,7 +313,7 @@ export interface ChatMemberMember {
309
313
 
310
314
  /** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
311
315
  export interface ChatMemberRestricted {
312
- /** The member's status in the chat, always "restricted" */
316
+ /** The member's status in the chat, always restricted */
313
317
  status: "restricted";
314
318
  /** Information about the user */
315
319
  user: User;
@@ -337,7 +341,7 @@ export interface ChatMemberRestricted {
337
341
 
338
342
  /** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
339
343
  export interface ChatMemberLeft {
340
- /** The member's status in the chat, always "left" */
344
+ /** The member's status in the chat, always left */
341
345
  status: "left";
342
346
  /** Information about the user */
343
347
  user: User;
@@ -345,7 +349,7 @@ export interface ChatMemberLeft {
345
349
 
346
350
  /** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
347
351
  export interface ChatMemberBanned {
348
- /** The member's status in the chat, always "kicked" */
352
+ /** The member's status in the chat, always kicked */
349
353
  status: "kicked";
350
354
  /** Information about the user */
351
355
  user: User;
@@ -425,7 +429,7 @@ export interface File {
425
429
  file_id: string;
426
430
  /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
427
431
  file_unique_id: string;
428
- /** File size in bytes, if known */
432
+ /** File size in bytes */
429
433
  file_size?: number;
430
434
  /** File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
431
435
  file_path?: string;
package/markup.d.ts CHANGED
@@ -13,7 +13,7 @@ export namespace InlineKeyboardButton {
13
13
  text: string;
14
14
  }
15
15
  export interface UrlButton extends AbstractInlineKeyboardButton {
16
- /** HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
16
+ /** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */
17
17
  url: string;
18
18
  }
19
19
  export interface CallbackButton extends AbstractInlineKeyboardButton {
@@ -25,7 +25,7 @@ export namespace InlineKeyboardButton {
25
25
  web_app: WebAppInfo;
26
26
  }
27
27
  export interface LoginButton extends AbstractInlineKeyboardButton {
28
- /** An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
28
+ /** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
29
29
  login_url: LoginUrl;
30
30
  }
31
31
  export interface SwitchInlineButton extends AbstractInlineKeyboardButton {
@@ -98,7 +98,7 @@ export interface CallbackQuery {
98
98
  inline_message_id?: string;
99
99
  /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */
100
100
  chat_instance: string;
101
- /** Data associated with the callback button. Be aware that the message, which originated the query, can contain no callback buttons with this data. */
101
+ /** Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. */
102
102
  data?: string;
103
103
  /** Short name of a Game to be returned, serves as the unique identifier for the game */
104
104
  game_short_name?: string;
@@ -176,7 +176,7 @@ Explain the user how to send a command with parameters (e.g. /newpoll question a
176
176
 
177
177
  Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
178
178
 
179
- The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions without any extra work for the user. */
179
+ The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. */
180
180
  export interface ForceReply {
181
181
  /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
182
182
  force_reply: true;
@@ -186,7 +186,7 @@ export interface ForceReply {
186
186
  selective?: boolean;
187
187
  }
188
188
 
189
- /** Contains information about a Web App. */
189
+ /** Describes a Web App. */
190
190
  export interface WebAppInfo {
191
191
  /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
192
192
  url: string;
package/message.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InlineKeyboardMarkup } from "./markup";
2
- import { Chat, User } from "./manage";
2
+ import { Chat, File, User } from "./manage";
3
3
  import { PassportData } from "./passport";
4
4
  import { Invoice, SuccessfulPayment } from "./payment";
5
5
 
@@ -47,7 +47,7 @@ export namespace Message {
47
47
  reply_markup?: InlineKeyboardMarkup;
48
48
  }
49
49
  export interface CaptionableMessage extends CommonMessage {
50
- /** Caption for the animation, audio, document, photo, video or voice, 0-1024 characters */
50
+ /** Caption for the animation, audio, document, photo, video or voice */
51
51
  caption?: string;
52
52
  /** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
53
53
  caption_entities?: MessageEntity[];
@@ -72,50 +72,66 @@ export namespace Message {
72
72
  export type PollMessage = CommonMessage & MsgWith<"poll">;
73
73
  export type LocationMessage = CommonMessage & MsgWith<"location">;
74
74
  export type VenueMessage = LocationMessage & MsgWith<"venue">;
75
- export type NewChatMembersMessage = ServiceMessage &
76
- MsgWith<"new_chat_members">;
77
- export type LeftChatMemberMessage = ServiceMessage &
78
- MsgWith<"left_chat_member">;
75
+ export type NewChatMembersMessage =
76
+ & ServiceMessage
77
+ & MsgWith<"new_chat_members">;
78
+ export type LeftChatMemberMessage =
79
+ & ServiceMessage
80
+ & MsgWith<"left_chat_member">;
79
81
  export type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
80
82
  export type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
81
- export type DeleteChatPhotoMessage = ServiceMessage &
82
- MsgWith<"delete_chat_photo">;
83
- export type GroupChatCreatedMessage = ServiceMessage &
84
- MsgWith<"group_chat_created">;
85
- export type SupergroupChatCreated = ServiceMessage &
86
- MsgWith<"supergroup_chat_created">;
87
- export type ChannelChatCreatedMessage = ServiceMessage &
88
- MsgWith<"channel_chat_created">;
89
- export type MessageAutoDeleteTimerChangedMessage = ServiceMessage &
90
- MsgWith<"message_auto_delete_timer_changed">;
91
- export type MigrateToChatIdMessage = ServiceMessage &
92
- MsgWith<"migrate_to_chat_id">;
93
- export type MigrateFromChatIdMessage = ServiceMessage &
94
- MsgWith<"migrate_from_chat_id">;
83
+ export type DeleteChatPhotoMessage =
84
+ & ServiceMessage
85
+ & MsgWith<"delete_chat_photo">;
86
+ export type GroupChatCreatedMessage =
87
+ & ServiceMessage
88
+ & MsgWith<"group_chat_created">;
89
+ export type SupergroupChatCreated =
90
+ & ServiceMessage
91
+ & MsgWith<"supergroup_chat_created">;
92
+ export type ChannelChatCreatedMessage =
93
+ & ServiceMessage
94
+ & MsgWith<"channel_chat_created">;
95
+ export type MessageAutoDeleteTimerChangedMessage =
96
+ & ServiceMessage
97
+ & MsgWith<"message_auto_delete_timer_changed">;
98
+ export type MigrateToChatIdMessage =
99
+ & ServiceMessage
100
+ & MsgWith<"migrate_to_chat_id">;
101
+ export type MigrateFromChatIdMessage =
102
+ & ServiceMessage
103
+ & MsgWith<"migrate_from_chat_id">;
95
104
  export type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
96
105
  export type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
97
- export type SuccessfulPaymentMessage = ServiceMessage &
98
- MsgWith<"successful_payment">;
99
- export type ConnectedWebsiteMessage = ServiceMessage &
100
- MsgWith<"connected_website">;
106
+ export type SuccessfulPaymentMessage =
107
+ & ServiceMessage
108
+ & MsgWith<"successful_payment">;
109
+ export type ConnectedWebsiteMessage =
110
+ & ServiceMessage
111
+ & MsgWith<"connected_website">;
101
112
  export type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
102
- export type ProximityAlertTriggeredMessage = ServiceMessage &
103
- MsgWith<"proximity_alert_triggered">;
104
- export type VideoChatScheduledMessage = ServiceMessage &
105
- MsgWith<"video_chat_scheduled">;
106
- export type VideoChatStartedMessage = ServiceMessage &
107
- MsgWith<"video_chat_started">;
108
- export type VideoChatEndedMessage = ServiceMessage &
109
- MsgWith<"video_chat_ended">;
110
- export type VideoChatParticipantsInvitedMessage = ServiceMessage &
111
- MsgWith<"video_chat_participants_invited">;
113
+ export type ProximityAlertTriggeredMessage =
114
+ & ServiceMessage
115
+ & MsgWith<"proximity_alert_triggered">;
116
+ export type VideoChatScheduledMessage =
117
+ & ServiceMessage
118
+ & MsgWith<"video_chat_scheduled">;
119
+ export type VideoChatStartedMessage =
120
+ & ServiceMessage
121
+ & MsgWith<"video_chat_started">;
122
+ export type VideoChatEndedMessage =
123
+ & ServiceMessage
124
+ & MsgWith<"video_chat_ended">;
125
+ export type VideoChatParticipantsInvitedMessage =
126
+ & ServiceMessage
127
+ & MsgWith<"video_chat_participants_invited">;
112
128
  export type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
113
129
  }
114
130
 
115
131
  type ReplyMessage = Message & { reply_to_message: undefined };
116
132
 
117
133
  export interface Message extends Message.MediaMessage {
118
- /** For text messages, the actual UTF-8 text of the message, 0-4096 characters */
134
+ /** For text messages, the actual UTF-8 text of the message */
119
135
  text?: string;
120
136
  /** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
121
137
  entities?: MessageEntity[];
@@ -200,7 +216,7 @@ export interface MessageId {
200
216
  message_id: number;
201
217
  }
202
218
 
203
- /** Contains information about an inline message sent by a Web App on behalf of a user. */
219
+ /** Describes an inline message sent by a Web App on behalf of a user. */
204
220
  export interface SentWebAppMessage {
205
221
  /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
206
222
  inline_message_id: string;
@@ -211,7 +227,7 @@ export interface SentWebAppMessage {
211
227
  Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).
212
228
 
213
229
  Message entities can be nested, providing following restrictions are met:
214
- - If two entities have common characters then one of them is fully contained inside another.
230
+ - If two entities have common characters, then one of them is fully contained inside another.
215
231
  - bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
216
232
  - All other entities can't contain each other.
217
233
 
@@ -299,7 +315,7 @@ export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
299
315
 
300
316
  export namespace MessageEntity {
301
317
  interface AbstractMessageEntity {
302
- /** Type of the entity. Currently, can be "mention" (@username), "hashtag" (#hashtag), "cashtag" ($USD), "bot_command" (/start@jobs_bot), "url" (https://telegram.org), "email" (do-not-reply@telegram.org), "phone_number" (+1-212-555-0123), "bold" (bold text), "italic" (italic text), "underline" (underlined text), "strikethrough" (strikethrough text), "spoiler" (spoiler message), "code" (monowidth string), "pre" (monowidth block), "text_link" (for clickable text URLs), "text_mention" (for users without usernames) */
318
+ /** Type of the entity. Currently, can be mention (@username), hashtag (#hashtag), cashtag ($USD), bot_command (/start@jobs_bot), url (https://telegram.org), email (do-not-reply@telegram.org), phone_number (+1-212-555-0123), bold (bold text), italic (italic text), underline (underlined text), strikethrough (strikethrough text), spoiler (spoiler message), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames) */
303
319
  type: string;
304
320
  /** Offset in UTF-16 code units to the start of the entity */
305
321
  offset: number;
@@ -324,17 +340,17 @@ export namespace MessageEntity {
324
340
  }
325
341
  export interface TextLinkMessageEntity extends AbstractMessageEntity {
326
342
  type: "text_link";
327
- /** For "text_link" only, url that will be opened after user taps on the text */
343
+ /** For text_link only, URL that will be opened after user taps on the text */
328
344
  url: string;
329
345
  }
330
346
  export interface TextMentionMessageEntity extends AbstractMessageEntity {
331
347
  type: "text_mention";
332
- /** For "text_mention" only, the mentioned user */
348
+ /** For text_mention only, the mentioned user */
333
349
  user: User;
334
350
  }
335
351
  export interface PreMessageEntity extends AbstractMessageEntity {
336
352
  type: "pre";
337
- /** For "pre" only, the programming language of the entity text */
353
+ /** For pre only, the programming language of the entity text */
338
354
  language?: string;
339
355
  }
340
356
  }
@@ -436,7 +452,7 @@ export interface Video {
436
452
  thumb?: PhotoSize;
437
453
  /** Original filename as defined by sender */
438
454
  file_name?: string;
439
- /** Mime type of a file as defined by sender */
455
+ /** MIME type of the file as defined by sender */
440
456
  mime_type?: string;
441
457
  /** File size in bytes */
442
458
  file_size?: number;
@@ -526,7 +542,7 @@ export interface Poll {
526
542
  is_closed: boolean;
527
543
  /** True, if the poll is anonymous */
528
544
  is_anonymous: boolean;
529
- /** Poll type, currently can be "regular" or "quiz" */
545
+ /** Poll type, currently can be regular or quiz */
530
546
  type: "regular" | "quiz";
531
547
  /** True, if the poll allows multiple answers */
532
548
  allows_multiple_answers: boolean;
@@ -554,7 +570,7 @@ export interface Location {
554
570
  live_period?: number;
555
571
  /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
556
572
  heading?: number;
557
- /** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
573
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
558
574
  proximity_alert_radius?: number;
559
575
  }
560
576
 
@@ -568,7 +584,7 @@ export interface Venue {
568
584
  address: string;
569
585
  /** Foursquare identifier of the venue */
570
586
  foursquare_id?: string;
571
- /** Foursquare type of the venue. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
587
+ /** Foursquare type of the venue. (For example, arts_entertainment/default”, arts_entertainment/aquarium or food/icecream”.) */
572
588
  foursquare_type?: string;
573
589
  /** Google Places identifier of the venue */
574
590
  google_place_id?: string;
@@ -613,11 +629,11 @@ export interface VideoChatParticipantsInvited {
613
629
  users: User[];
614
630
  }
615
631
 
616
- /** Contains data sent from a Web App to the bot. */
632
+ /** Describes data sent from a Web App to the bot. */
617
633
  export interface WebAppData {
618
634
  /** The data. Be aware that a bad client can send arbitrary data in this field. */
619
635
  data: string;
620
- /** Text of the web_app keyboard button, from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */
636
+ /** Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */
621
637
  button_text: string;
622
638
  }
623
639
 
@@ -641,6 +657,8 @@ export interface Sticker {
641
657
  emoji?: string;
642
658
  /** Name of the sticker set to which the sticker belongs */
643
659
  set_name?: string;
660
+ /** Premium animation for the sticker, if the sticker is premium */
661
+ premium_animation?: File;
644
662
  /** For mask stickers, the position where the mask should be placed */
645
663
  mask_position?: MaskPosition;
646
664
  /** File size in bytes */
@@ -667,7 +685,7 @@ export interface StickerSet {
667
685
 
668
686
  /** This object describes the position on faces where a mask should be placed by default. */
669
687
  export interface MaskPosition {
670
- /** The part of the face relative to which the mask should be placed. One of "forehead", "eyes", "mouth", or "chin". */
688
+ /** The part of the face relative to which the mask should be placed. One of forehead”, eyes”, mouth”, or chin”. */
671
689
  point: "forehead" | "eyes" | "mouth" | "chin";
672
690
  /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
673
691
  x_shift: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "index.js",
6
6
  "repository": {
package/passport.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /** Contains information about Telegram Passport data shared with the bot by the user. */
1
+ /** Describes Telegram Passport data shared with the bot by the user. */
2
2
  export interface PassportData {
3
3
  /** Array with information about documents and other Telegram Passport elements that was shared with the bot */
4
4
  data: EncryptedPassportElement[];
@@ -18,9 +18,9 @@ export interface PassportFile {
18
18
  file_date: number;
19
19
  }
20
20
 
21
- /** Contains information about documents or other Telegram Passport elements shared with the bot by the user. */
21
+ /** Describes documents or other Telegram Passport elements shared with the bot by the user. */
22
22
  export interface EncryptedPassportElement {
23
- /** Element type. One of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration", "phone_number", "email". */
23
+ /** Element type. One of personal_details”, passport”, driver_license”, identity_card”, internal_passport”, address”, utility_bill”, bank_statement”, rental_agreement”, passport_registration”, temporary_registration”, phone_number”, email”. */
24
24
  type:
25
25
  | "personal_details"
26
26
  | "passport"
@@ -35,27 +35,27 @@ export interface EncryptedPassportElement {
35
35
  | "temporary_registration"
36
36
  | "phone_number"
37
37
  | "email";
38
- /** Base64-encoded encrypted Telegram Passport element data provided by the user, available for "personal_details", "passport", "driver_license", "identity_card", "internal_passport" and "address" types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
38
+ /** Base64-encoded encrypted Telegram Passport element data provided by the user, available for personal_details”, passport”, driver_license”, identity_card”, internal_passport and address types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
39
39
  data?: string;
40
- /** User's verified phone number, available only for "phone_number" type */
40
+ /** User's verified phone number, available only for phone_number type */
41
41
  phone_number?: string;
42
- /** User's verified email address, available only for "email" type */
42
+ /** User's verified email address, available only for email type */
43
43
  email?: string;
44
- /** Array of encrypted files with documents provided by the user, available for "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
44
+ /** Array of encrypted files with documents provided by the user, available for utility_bill”, bank_statement”, rental_agreement”, passport_registration and temporary_registration types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
45
45
  files?: PassportFile[];
46
- /** Encrypted file with the front side of the document, provided by the user. Available for "passport", "driver_license", "identity_card" and "internal_passport". The file can be decrypted and verified using the accompanying EncryptedCredentials. */
46
+ /** Encrypted file with the front side of the document, provided by the user. Available for passport”, driver_license”, identity_card and internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
47
47
  front_side?: PassportFile;
48
- /** Encrypted file with the reverse side of the document, provided by the user. Available for "driver_license" and "identity_card". The file can be decrypted and verified using the accompanying EncryptedCredentials. */
48
+ /** Encrypted file with the reverse side of the document, provided by the user. Available for driver_license and identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
49
49
  reverse_side?: PassportFile;
50
- /** Encrypted file with the selfie of the user holding a document, provided by the user; available for "passport", "driver_license", "identity_card" and "internal_passport". The file can be decrypted and verified using the accompanying EncryptedCredentials. */
50
+ /** Encrypted file with the selfie of the user holding a document, provided by the user; available for passport”, driver_license”, identity_card and internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
51
51
  selfie?: PassportFile;
52
- /** Array of encrypted files with translated versions of documents provided by the user. Available if requested for "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration" and "temporary_registration" types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
52
+ /** Array of encrypted files with translated versions of documents provided by the user. Available if requested for passport”, driver_license”, identity_card”, internal_passport”, utility_bill”, bank_statement”, rental_agreement”, passport_registration and temporary_registration types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
53
53
  translation?: PassportFile[];
54
54
  /** Base64-encoded element hash for using in PassportElementErrorUnspecified */
55
55
  hash: string;
56
56
  }
57
57
 
58
- /** Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
58
+ /** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
59
59
  export interface EncryptedCredentials {
60
60
  /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */
61
61
  data: string;
@@ -91,7 +91,7 @@ export type PassportElementError =
91
91
  export interface PassportElementErrorDataField {
92
92
  /** Error source, must be data */
93
93
  source: "data";
94
- /** The section of the user's Telegram Passport which has the error, one of "personal_details", "passport", "driver_license", "identity_card", "internal_passport", "address" */
94
+ /** The section of the user's Telegram Passport which has the error, one of personal_details”, passport”, driver_license”, identity_card”, internal_passport”, address */
95
95
  type:
96
96
  | "personal_details"
97
97
  | "passport"
@@ -111,7 +111,7 @@ export interface PassportElementErrorDataField {
111
111
  export interface PassportElementErrorFrontSide {
112
112
  /** Error source, must be front_side */
113
113
  source: "front_side";
114
- /** The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
114
+ /** The section of the user's Telegram Passport which has the issue, one of passport”, driver_license”, identity_card”, internal_passport */
115
115
  type: "passport" | "driver_license" | "identity_card" | "internal_passport";
116
116
  /** Base64-encoded hash of the file with the front side of the document */
117
117
  file_hash: string;
@@ -123,7 +123,7 @@ export interface PassportElementErrorFrontSide {
123
123
  export interface PassportElementErrorReverseSide {
124
124
  /** Error source, must be reverse_side */
125
125
  source: "reverse_side";
126
- /** The section of the user's Telegram Passport which has the issue, one of "driver_license", "identity_card" */
126
+ /** The section of the user's Telegram Passport which has the issue, one of driver_license”, identity_card */
127
127
  type: "driver_license" | "identity_card";
128
128
  /** Base64-encoded hash of the file with the reverse side of the document */
129
129
  file_hash: string;
@@ -135,7 +135,7 @@ export interface PassportElementErrorReverseSide {
135
135
  export interface PassportElementErrorSelfie {
136
136
  /** Error source, must be selfie */
137
137
  source: "selfie";
138
- /** The section of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport" */
138
+ /** The section of the user's Telegram Passport which has the issue, one of passport”, driver_license”, identity_card”, internal_passport */
139
139
  type: "passport" | "driver_license" | "identity_card" | "internal_passport";
140
140
  /** Base64-encoded hash of the file with the selfie */
141
141
  file_hash: string;
@@ -147,7 +147,7 @@ export interface PassportElementErrorSelfie {
147
147
  export interface PassportElementErrorFile {
148
148
  /** Error source, must be file */
149
149
  source: "file";
150
- /** The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
150
+ /** The section of the user's Telegram Passport which has the issue, one of utility_bill”, bank_statement”, rental_agreement”, passport_registration”, temporary_registration */
151
151
  type:
152
152
  | "utility_bill"
153
153
  | "bank_statement"
@@ -164,7 +164,7 @@ export interface PassportElementErrorFile {
164
164
  export interface PassportElementErrorFiles {
165
165
  /** Error source, must be files */
166
166
  source: "files";
167
- /** The section of the user's Telegram Passport which has the issue, one of "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
167
+ /** The section of the user's Telegram Passport which has the issue, one of utility_bill”, bank_statement”, rental_agreement”, passport_registration”, temporary_registration */
168
168
  type:
169
169
  | "utility_bill"
170
170
  | "bank_statement"
@@ -181,7 +181,7 @@ export interface PassportElementErrorFiles {
181
181
  export interface PassportElementErrorTranslationFile {
182
182
  /** Error source, must be translation_file */
183
183
  source: "translation_file";
184
- /** Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
184
+ /** Type of element of the user's Telegram Passport which has the issue, one of passport”, driver_license”, identity_card”, internal_passport”, utility_bill”, bank_statement”, rental_agreement”, passport_registration”, temporary_registration */
185
185
  type:
186
186
  | "passport"
187
187
  | "driver_license"
@@ -202,7 +202,7 @@ export interface PassportElementErrorTranslationFile {
202
202
  export interface PassportElementErrorTranslationFiles {
203
203
  /** Error source, must be translation_files */
204
204
  source: "translation_files";
205
- /** Type of element of the user's Telegram Passport which has the issue, one of "passport", "driver_license", "identity_card", "internal_passport", "utility_bill", "bank_statement", "rental_agreement", "passport_registration", "temporary_registration" */
205
+ /** Type of element of the user's Telegram Passport which has the issue, one of passport”, driver_license”, identity_card”, internal_passport”, utility_bill”, bank_statement”, rental_agreement”, passport_registration”, temporary_registration */
206
206
  type:
207
207
  | "passport"
208
208
  | "driver_license"
package/payment.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface Invoice {
24
24
 
25
25
  /** This object represents a shipping address. */
26
26
  export interface ShippingAddress {
27
- /** ISO 3166-1 alpha-2 country code */
27
+ /** Two-letter ISO 3166-1 alpha-2 country code */
28
28
  country_code: string;
29
29
  /** State, if applicable */
30
30
  state: string;
@@ -70,7 +70,7 @@ export interface SuccessfulPayment {
70
70
  invoice_payload: string;
71
71
  /** Identifier of the shipping option chosen by the user */
72
72
  shipping_option_id?: string;
73
- /** Order info provided by the user */
73
+ /** Order information provided by the user */
74
74
  order_info?: OrderInfo;
75
75
  /** Telegram payment identifier */
76
76
  telegram_payment_charge_id: string;
@@ -104,6 +104,6 @@ export interface PreCheckoutQuery {
104
104
  invoice_payload: string;
105
105
  /** Identifier of the shipping option chosen by the user */
106
106
  shipping_option_id?: string;
107
- /** Order info provided by the user */
107
+ /** Order information provided by the user */
108
108
  order_info?: OrderInfo;
109
109
  }
package/proxied.d.ts CHANGED
@@ -42,12 +42,8 @@ type Params<M extends keyof InputFileProxy<F>["Telegram"], F> = Parameters<
42
42
  export interface InputFileProxy<F> {
43
43
  /** Utility type providing the argument type for the given method name or `{}` if the method does not take any parameters */
44
44
  Opts: {
45
- [M in keyof InputFileProxy<F>["Telegram"]]: Params<
46
- M,
47
- F
48
- >[0] extends undefined
49
- ? {}
50
- : NonNullable<Params<M, F>[0]>;
45
+ [M in keyof InputFileProxy<F>["Telegram"]]: Params<M, F>[0] extends
46
+ undefined ? {} : NonNullable<Params<M, F>[0]>;
51
47
  };
52
48
 
53
49
  /** Wrapper type to bundle all methods of the Telegram API */
@@ -64,36 +60,38 @@ export interface InputFileProxy<F> {
64
60
  limit?: number;
65
61
  /** Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. */
66
62
  timeout?: number;
67
- /** A list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.
63
+ /** A list of the update types you want your bot to receive. For example, specify [message”, edited_channel_post”, callback_query] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.
68
64
 
69
65
  Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time. */
70
66
  allowed_updates?: readonly string[];
71
67
  }): Update[];
72
68
 
73
- /** Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
69
+ /** Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success.
74
70
 
75
- If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot's token, you can be pretty sure it's us.
71
+ If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
76
72
 
77
73
  Notes
78
74
  1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up.
79
75
  2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work.
80
76
  3. Ports currently supported for Webhooks: 443, 80, 88, 8443.
81
77
 
82
- NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks. */
78
+ If you're having any trouble setting up webhooks, please check out this amazing guide to webhooks. */
83
79
  setWebhook(args: {
84
- /** HTTPS url to send updates to. Use an empty string to remove webhook integration */
80
+ /** HTTPS URL to send updates to. Use an empty string to remove webhook integration */
85
81
  url: string;
86
82
  /** Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details. */
87
83
  certificate?: F;
88
84
  /** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */
89
85
  ip_address?: string;
90
- /** Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. */
86
+ /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. */
91
87
  max_connections?: number;
92
- /** A list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.
93
- Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. */
94
- allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
95
- /** Pass True to drop all pending updates */
96
- drop_pending_updates?: boolean;
88
+ /** A list of the update types you want your bot to receive. For example, specify [message”, edited_channel_post”, callback_query] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member (default). If not specified, the previous setting will be used.
89
+ Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. */
90
+ allowed_updates?: ReadonlyArray<Exclude<keyof Update, "update_id">>;
91
+ /** Pass True to drop all pending updates */
92
+ drop_pending_updates?: boolean;
93
+ /** A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. */
94
+ secret_token?: string;
97
95
  }): true;
98
96
 
99
97
  /** Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. */
@@ -284,7 +282,7 @@ export interface InputFileProxy<F> {
284
282
  | ForceReply;
285
283
  }): Message.DocumentMessage;
286
284
 
287
- /** Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. */
285
+ /** Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. */
288
286
  sendVideo(args: {
289
287
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
290
288
  chat_id: number | string;
@@ -389,7 +387,7 @@ export interface InputFileProxy<F> {
389
387
  }): Message.VoiceMessage;
390
388
 
391
389
  /** Use this method to send video messages. On success, the sent Message is returned.
392
- As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. */
390
+ As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. */
393
391
  sendVideoNote(args: {
394
392
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
395
393
  chat_id: number | string;
@@ -457,7 +455,7 @@ export interface InputFileProxy<F> {
457
455
  live_period?: number;
458
456
  /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
459
457
  heading?: number;
460
- /** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
458
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
461
459
  proximity_alert_radius?: number;
462
460
  /** Sends the message silently. Users will receive a notification with no sound. */
463
461
  disable_notification?: boolean;
@@ -491,7 +489,7 @@ export interface InputFileProxy<F> {
491
489
  horizontal_accuracy?: number;
492
490
  /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
493
491
  heading?: number;
494
- /** Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
492
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
495
493
  proximity_alert_radius?: number;
496
494
  /** An object for a new inline keyboard. */
497
495
  reply_markup?: InlineKeyboardMarkup;
@@ -523,7 +521,7 @@ export interface InputFileProxy<F> {
523
521
  address: string;
524
522
  /** Foursquare identifier of the venue */
525
523
  foursquare_id?: string;
526
- /** Foursquare type of the venue, if known. (For example, "arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".) */
524
+ /** Foursquare type of the venue, if known. (For example, arts_entertainment/default”, arts_entertainment/aquarium or food/icecream”.) */
527
525
  foursquare_type?: string;
528
526
  /** Google Places identifier of the venue */
529
527
  google_place_id?: string;
@@ -583,7 +581,7 @@ export interface InputFileProxy<F> {
583
581
  options: readonly string[];
584
582
  /** True, if the poll needs to be anonymous, defaults to True */
585
583
  is_anonymous?: boolean;
586
- /** Poll type, "quiz" or "regular", defaults to "regular" */
584
+ /** Poll type, quiz or regular”, defaults to regular */
587
585
  type?: "quiz" | "regular";
588
586
  /** True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False */
589
587
  allows_multiple_answers?: boolean;
@@ -672,11 +670,11 @@ export interface InputFileProxy<F> {
672
670
  limit?: number;
673
671
  }): UserProfilePhotos;
674
672
 
675
- /** Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
673
+ /** Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
676
674
 
677
675
  Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. */
678
676
  getFile(args: {
679
- /** File identifier to get info about */
677
+ /** File identifier to get information about */
680
678
  file_id: string;
681
679
  }): File;
682
680
 
@@ -798,7 +796,7 @@ export interface InputFileProxy<F> {
798
796
  name?: string;
799
797
  /** Point in time (Unix timestamp) when the link will expire */
800
798
  expire_date?: number;
801
- /** Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
799
+ /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
802
800
  member_limit?: number;
803
801
  /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */
804
802
  creates_join_request?: boolean;
@@ -814,7 +812,7 @@ export interface InputFileProxy<F> {
814
812
  name?: string;
815
813
  /** Point in time (Unix timestamp) when the link will expire */
816
814
  expire_date?: number;
817
- /** Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
815
+ /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
818
816
  member_limit?: number;
819
817
  /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */
820
818
  creates_join_request?: boolean;
@@ -950,7 +948,7 @@ export interface InputFileProxy<F> {
950
948
 
951
949
  /** Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
952
950
 
953
- Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */
951
+ Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */
954
952
  answerCallbackQuery(args: {
955
953
  /** Unique identifier for the query to be answered */
956
954
  callback_query_id: string;
@@ -958,7 +956,7 @@ export interface InputFileProxy<F> {
958
956
  text?: string;
959
957
  /** If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. */
960
958
  show_alert?: boolean;
961
- /** 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.
959
+ /** 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.
962
960
 
963
961
  Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. */
964
962
  url?: string;
@@ -1156,7 +1154,7 @@ export interface InputFileProxy<F> {
1156
1154
  createNewStickerSet(args: {
1157
1155
  /** User identifier of created sticker set owner */
1158
1156
  user_id: number;
1159
- /** Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot username>". <bot_username> is case insensitive. 1-64 characters. */
1157
+ /** Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot username>". <bot_username> is case insensitive. 1-64 characters. */
1160
1158
  name: string;
1161
1159
  /** Sticker set title, 1-64 characters */
1162
1160
  title: string;
@@ -1212,7 +1210,7 @@ export interface InputFileProxy<F> {
1212
1210
  name: string;
1213
1211
  /** User identifier of the sticker set owner */
1214
1212
  user_id: number;
1215
- /** A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More info on Sending Files ». Animated sticker set thumbnails can't be uploaded via HTTP URL. */
1213
+ /** A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. Animated sticker set thumbnails can't be uploaded via HTTP URL. */
1216
1214
  thumb?: F | string;
1217
1215
  }): true;
1218
1216
 
@@ -1255,7 +1253,7 @@ export interface InputFileProxy<F> {
1255
1253
  description: string;
1256
1254
  /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
1257
1255
  payload: string;
1258
- /** Payments provider token, obtained via Botfather */
1256
+ /** Payment provider token, obtained via BotFather */
1259
1257
  provider_token: string;
1260
1258
  /** Three-letter ISO 4217 currency code, see more on currencies */
1261
1259
  currency: string;
@@ -1271,7 +1269,7 @@ export interface InputFileProxy<F> {
1271
1269
  provider_data?: string;
1272
1270
  /** 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. */
1273
1271
  photo_url?: string;
1274
- /** Photo size */
1272
+ /** Photo size in bytes */
1275
1273
  photo_size?: number;
1276
1274
  /** Photo width */
1277
1275
  photo_width?: number;
@@ -1285,9 +1283,9 @@ export interface InputFileProxy<F> {
1285
1283
  need_email?: boolean;
1286
1284
  /** Pass True, if you require the user's shipping address to complete the order */
1287
1285
  need_shipping_address?: boolean;
1288
- /** Pass True, if user's phone number should be sent to provider */
1286
+ /** Pass True, if the user's phone number should be sent to provider */
1289
1287
  send_phone_number_to_provider?: boolean;
1290
- /** Pass True, if user's email address should be sent to provider */
1288
+ /** Pass True, if the user's email address should be sent to provider */
1291
1289
  send_email_to_provider?: boolean;
1292
1290
  /** Pass True, if the final price depends on the shipping method */
1293
1291
  is_flexible?: boolean;
@@ -1303,6 +1301,50 @@ export interface InputFileProxy<F> {
1303
1301
  reply_markup?: InlineKeyboardMarkup;
1304
1302
  }): Message.InvoiceMessage;
1305
1303
 
1304
+ /** Use this method to create a link for an invoice. Returns the created invoice link as String on success. */
1305
+ createInvoiceLink(args: {
1306
+ /** Product name, 1-32 characters */
1307
+ title: string;
1308
+ /** Product description, 1-255 characters */
1309
+ description: string;
1310
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
1311
+ payload: string;
1312
+ /** Payment provider token, obtained via BotFather */
1313
+ provider_token: string;
1314
+ /** Three-letter ISO 4217 currency code, see more on currencies */
1315
+ currency: string;
1316
+ /** Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) */
1317
+ prices: LabeledPrice[];
1318
+ /** 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 */
1319
+ max_tip_amount?: number;
1320
+ /** An array of suggested amounts of tips 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. */
1321
+ suggested_tip_amounts?: number[];
1322
+ /** Data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. */
1323
+ provider_data?: string;
1324
+ /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */
1325
+ photo_url?: string;
1326
+ /** Photo size in bytes */
1327
+ photo_size?: number;
1328
+ /** Photo width */
1329
+ photo_width?: number;
1330
+ /** Photo height */
1331
+ photo_height?: number;
1332
+ /** Pass True, if you require the user's full name to complete the order */
1333
+ need_name?: boolean;
1334
+ /** Pass True, if you require the user's phone number to complete the order */
1335
+ need_phone_number?: boolean;
1336
+ /** Pass True, if you require the user's email address to complete the order */
1337
+ need_email?: boolean;
1338
+ /** Pass True, if you require the user's shipping address to complete the order */
1339
+ need_shipping_address?: boolean;
1340
+ /** Pass True, if the user's phone number should be sent to the provider */
1341
+ send_phone_number_to_provider?: boolean;
1342
+ /** Pass True, if the user's email address should be sent to the provider */
1343
+ send_email_to_provider?: boolean;
1344
+ /** Pass True, if the final price depends on the shipping method */
1345
+ is_flexible?: boolean;
1346
+ }): string;
1347
+
1306
1348
  /** If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. */
1307
1349
  answerShippingQuery(args: {
1308
1350
  /** Unique identifier for the query to be answered */
@@ -1339,7 +1381,7 @@ export interface InputFileProxy<F> {
1339
1381
  sendGame(args: {
1340
1382
  /** Unique identifier for the target chat */
1341
1383
  chat_id: number;
1342
- /** Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. */
1384
+ /** Short name of the game, serves as the unique identifier for the game. Set up your games via BotFather. */
1343
1385
  game_short_name: string;
1344
1386
  /** Sends the message silently. Users will receive a notification with no sound. */
1345
1387
  disable_notification?: boolean;
@@ -1373,7 +1415,7 @@ export interface InputFileProxy<F> {
1373
1415
 
1374
1416
  /** Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
1375
1417
 
1376
- This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. */
1418
+ This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and their neighbors are not among them. Please note that this behavior is subject to change. */
1377
1419
  getGameHighScores(args: {
1378
1420
  /** Target user id */
1379
1421
  user_id: number;
package/update.d.ts CHANGED
@@ -38,13 +38,13 @@ export namespace Update {
38
38
  /** This object represents an incoming update.
39
39
  At most one of the optional parameters can be present in any given update. */
40
40
  export interface Update {
41
- /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
41
+ /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
42
42
  update_id: number;
43
- /** New incoming message of any kind text, photo, sticker, etc. */
43
+ /** New incoming message of any kind - text, photo, sticker, etc. */
44
44
  message?: Message;
45
45
  /** New version of a message that is known to the bot and was edited */
46
46
  edited_message?: Message;
47
- /** New incoming channel post of any kind text, photo, sticker, etc. */
47
+ /** New incoming channel post of any kind - text, photo, sticker, etc. */
48
48
  channel_post?: Message;
49
49
  /** New version of a channel post that is known to the bot and was edited */
50
50
  edited_channel_post?: Message;