@grammyjs/types 2.11.1 → 2.12.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 KnorpelSenf
3
+ Copyright (c) 2021-2023 KnorpelSenf
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/manage.d.ts CHANGED
@@ -243,7 +243,7 @@ export interface ChatAdministratorRights {
243
243
  can_manage_video_chats: boolean;
244
244
  /** True, if the administrator can restrict, ban or unban chat members */
245
245
  can_restrict_members: boolean;
246
- /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
246
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
247
247
  can_promote_members: boolean;
248
248
  /** True, if the user is allowed to change the chat title, photo and other settings */
249
249
  can_change_info: boolean;
@@ -304,7 +304,7 @@ export interface ChatMemberAdministrator {
304
304
  can_manage_video_chats: boolean;
305
305
  /** True, if the administrator can restrict, ban or unban chat members */
306
306
  can_restrict_members: boolean;
307
- /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
307
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
308
308
  can_promote_members: boolean;
309
309
  /** True, if the user is allowed to change the chat title, photo and other settings */
310
310
  can_change_info: boolean;
@@ -338,6 +338,26 @@ export interface ChatMemberRestricted {
338
338
  user: User;
339
339
  /** True, if the user is a member of the chat at the moment of the request */
340
340
  is_member: boolean;
341
+ /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
342
+ can_send_messages: boolean;
343
+ /** True, if the user is allowed to send audios */
344
+ can_send_audios: boolean;
345
+ /** True, if the user is allowed to send documents */
346
+ can_send_documents: boolean;
347
+ /** True, if the user is allowed to send photos */
348
+ can_send_photos: boolean;
349
+ /** True, if the user is allowed to send videos */
350
+ can_send_videos: boolean;
351
+ /** True, if the user is allowed to send video notes */
352
+ can_send_video_notes: boolean;
353
+ /** True, if the user is allowed to send voice notes */
354
+ can_send_voice_notes: boolean;
355
+ /** True, if the user is allowed to send polls */
356
+ can_send_polls: boolean;
357
+ /** True, if the user is allowed to send animations, games, stickers and use inline bots */
358
+ can_send_other_messages: boolean;
359
+ /** True, if the user is allowed to add web page previews to their messages */
360
+ can_add_web_page_previews: boolean;
341
361
  /** True, if the user is allowed to change the chat title, photo and other settings */
342
362
  can_change_info: boolean;
343
363
  /** True, if the user is allowed to invite new users to the chat */
@@ -346,16 +366,6 @@ export interface ChatMemberRestricted {
346
366
  can_pin_messages: boolean;
347
367
  /** True, if the user is allowed to create forum topics */
348
368
  can_manage_topics: boolean;
349
- /** True, if the user is allowed to send text messages, contacts, locations and venues */
350
- can_send_messages: boolean;
351
- /** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes */
352
- can_send_media_messages: boolean;
353
- /** True, if the user is allowed to send polls */
354
- can_send_polls: boolean;
355
- /** True, if the user is allowed to send animations, games, stickers and use inline bots */
356
- can_send_other_messages: boolean;
357
- /** True, if the user is allowed to add web page previews to their messages */
358
- can_add_web_page_previews: boolean;
359
369
  /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */
360
370
  until_date: number;
361
371
  }
@@ -400,6 +410,8 @@ export interface ChatJoinRequest {
400
410
  chat: Chat.SupergroupChat | Chat.ChannelChat;
401
411
  /** User that sent the join request */
402
412
  from: User;
413
+ /** Identifier of a private chat with the user who sent the join request. 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 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user. */
414
+ user_chat_id: number;
403
415
  /** Date the request was sent in Unix time */
404
416
  date: number;
405
417
  /** Bio of the user. */
@@ -410,15 +422,25 @@ export interface ChatJoinRequest {
410
422
 
411
423
  /** Describes actions that a non-administrator user is allowed to take in a chat. */
412
424
  export interface ChatPermissions {
413
- /** True, if the user is allowed to send text messages, contacts, locations and venues */
425
+ /** True, if the user is allowed to send text messages, contacts, invoices, locations and venues */
414
426
  can_send_messages?: boolean;
415
- /** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages */
416
- can_send_media_messages?: boolean;
417
- /** True, if the user is allowed to send polls, implies can_send_messages */
427
+ /** True, if the user is allowed to send audios */
428
+ can_send_audios?: boolean;
429
+ /** True, if the user is allowed to send documents */
430
+ can_send_documents?: boolean;
431
+ /** True, if the user is allowed to send photos */
432
+ can_send_photos?: boolean;
433
+ /** True, if the user is allowed to send videos */
434
+ can_send_videos?: boolean;
435
+ /** True, if the user is allowed to send video notes */
436
+ can_send_video_notes?: boolean;
437
+ /** True, if the user is allowed to send voice notes */
438
+ can_send_voice_notes?: boolean;
439
+ /** True, if the user is allowed to send polls */
418
440
  can_send_polls?: boolean;
419
- /** True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages */
441
+ /** True, if the user is allowed to send animations, games, stickers and use inline bots */
420
442
  can_send_other_messages?: boolean;
421
- /** True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages */
443
+ /** True, if the user is allowed to add web page previews to their messages */
422
444
  can_add_web_page_previews?: boolean;
423
445
  /** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */
424
446
  can_change_info?: boolean;
package/markup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { User } from "./manage";
1
+ import { ChatAdministratorRights, User } from "./manage";
2
2
  import { Message } from "./message";
3
3
 
4
4
  /** This object represents an inline keyboard that appears right next to the message it belongs to. */
@@ -127,6 +127,14 @@ export namespace KeyboardButton {
127
127
  /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
128
128
  text: string;
129
129
  }
130
+ export interface RequestUserButton extends CommonButton {
131
+ /** If specified, pressing the button will open a list of suitable users. Tapping on any user will send their identifier to the bot in a “user_shared” service message. Available in private chats only. */
132
+ request_user: KeyboardButtonRequestUser;
133
+ }
134
+ export interface RequestChatButton extends CommonButton {
135
+ /** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
136
+ request_chat: KeyboardButtonRequestChat;
137
+ }
130
138
  export interface RequestContactButton extends CommonButton {
131
139
  /** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
132
140
  request_contact: boolean;
@@ -145,9 +153,11 @@ export namespace KeyboardButton {
145
153
  }
146
154
  }
147
155
 
148
- /** This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive. */
156
+ /** This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_user, request_chat, request_contact, request_location, and request_poll are mutually exclusive. */
149
157
  export type KeyboardButton =
150
158
  | KeyboardButton.CommonButton
159
+ | KeyboardButton.RequestUserButton
160
+ | KeyboardButton.RequestChatButton
151
161
  | KeyboardButton.RequestContactButton
152
162
  | KeyboardButton.RequestLocationButton
153
163
  | KeyboardButton.RequestPollButton
@@ -193,3 +203,33 @@ export interface WebAppInfo {
193
203
  /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
194
204
  url: string;
195
205
  }
206
+
207
+ /** This object defines the criteria used to request a suitable user. The identifier of the selected user will be shared with the bot when the corresponding button is pressed. */
208
+ export interface KeyboardButtonRequestUser {
209
+ /** Signed 32-bit identifier of the request */
210
+ request_id: number;
211
+ /** Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied. */
212
+ user_is_bot?: boolean;
213
+ /** Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied. */
214
+ user_is_premium?: boolean;
215
+ }
216
+
217
+ /** This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. */
218
+ export interface KeyboardButtonRequestChat {
219
+ /** Signed 32-bit identifier of the request */
220
+ request_id: number;
221
+ /** Pass True to request a channel chat, pass False to request a group or a supergroup chat. */
222
+ chat_is_channel: boolean;
223
+ /** Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
224
+ chat_is_forum?: boolean;
225
+ /** Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
226
+ chat_has_username?: boolean;
227
+ /** Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
228
+ chat_is_created?: boolean;
229
+ /** A JSON-serialized object listing the required administrator rights of the user in the chat. If not specified, no additional restrictions are applied. */
230
+ user_administrator_rights?: ChatAdministratorRights;
231
+ /** A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied. */
232
+ bot_administrator_rights?: ChatAdministratorRights;
233
+ /** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
234
+ bot_is_member?: boolean;
235
+ }
package/message.d.ts CHANGED
@@ -112,6 +112,8 @@ export namespace Message {
112
112
  export type SuccessfulPaymentMessage =
113
113
  & ServiceMessage
114
114
  & MsgWith<"successful_payment">;
115
+ export type UserSharedMessage = ServiceMessage & MsgWith<"user_shared">;
116
+ export type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
115
117
  export type ConnectedWebsiteMessage =
116
118
  & ServiceMessage
117
119
  & MsgWith<"connected_website">;
@@ -218,6 +220,10 @@ export interface Message extends Message.MediaMessage {
218
220
  invoice?: Invoice;
219
221
  /** Message is a service message about a successful payment, information about the payment. More about payments » */
220
222
  successful_payment?: SuccessfulPayment;
223
+ /** Service message: a user was shared with the bot */
224
+ user_shared?: UserShared;
225
+ /** Service message: a chat was shared with the bot */
226
+ chat_shared?: ChatShared;
221
227
  /** The domain name of the website on which the user has logged in. More about Telegram Login » */
222
228
  connected_website?: string;
223
229
  /** Service message: the user allowed the bot added to the attachment menu to write messages */
@@ -274,7 +280,7 @@ Message entities can be nested, providing following restrictions are met:
274
280
  Links `tg://user?id=<user_id>` can be used to mention a user by their ID without using a username. Please note:
275
281
 
276
282
  - These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text.
277
- - These mentions are only guaranteed to work if the user has contacted the bot in the past, has sent a callback query to the bot via an inline button or is a member in the group where he was mentioned.
283
+ - Unless the user is a member of the chat where they were mentioned, these mentions are only guaranteed to work if the user has contacted the bot in private in the past or has sent a callback query to the bot via an inline button and doesn't have Forwarded Messages privacy enabled for the bot.
278
284
 
279
285
  #### MarkdownV2 style
280
286
  To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
@@ -684,6 +690,22 @@ export interface GeneralForumTopicHidden {}
684
690
  /** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
685
691
  export interface GeneralForumTopicUnhidden {}
686
692
 
693
+ /** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button. */
694
+ export interface UserShared {
695
+ /** Identifier of the request */
696
+ request_id: number;
697
+ /** Identifier of the shared user. 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 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
698
+ user_id: number;
699
+ }
700
+
701
+ /** This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button. */
702
+ export interface ChatShared {
703
+ /** Identifier of the request */
704
+ request_id: number;
705
+ /** Identifier of the shared 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 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
706
+ chat_id: number;
707
+ }
708
+
687
709
  /** This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information. */
688
710
  export interface WriteAccessAllowed {}
689
711
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "2.11.1",
3
+ "version": "2.12.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "index.js",
6
6
  "repository": {
package/proxied.d.ts CHANGED
@@ -757,6 +757,8 @@ export interface InputFileProxy<F> {
757
757
  user_id: number;
758
758
  /** An object for new user permissions */
759
759
  permissions: ChatPermissions;
760
+ /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */
761
+ use_independent_chat_permissions?: boolean;
760
762
  /** Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever */
761
763
  until_date?: number;
762
764
  }): true;
@@ -781,7 +783,7 @@ export interface InputFileProxy<F> {
781
783
  can_manage_video_chats?: boolean;
782
784
  /** Pass True if the administrator can restrict, ban or unban chat members */
783
785
  can_restrict_members?: boolean;
784
- /** Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) */
786
+ /** Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him) */
785
787
  can_promote_members?: boolean;
786
788
  /** Pass True if the administrator can change chat title, photo and other settings */
787
789
  can_change_info?: boolean;
@@ -825,6 +827,8 @@ export interface InputFileProxy<F> {
825
827
  chat_id: number | string;
826
828
  /** An object for new default chat permissions */
827
829
  permissions: ChatPermissions;
830
+ /** Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission. */
831
+ use_independent_chat_permissions?: boolean;
828
832
  }): true;
829
833
 
830
834
  /** Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
@@ -1020,7 +1024,7 @@ export interface InputFileProxy<F> {
1020
1024
  chat_id: number | string;
1021
1025
  /** Unique identifier for the target message thread of the forum topic */
1022
1026
  message_thread_id: number;
1023
- /** New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept */
1027
+ /** New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept */
1024
1028
  name?: string;
1025
1029
  /** New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept */
1026
1030
  icon_custom_emoji_id?: string;
@@ -1212,13 +1216,7 @@ export interface InputFileProxy<F> {
1212
1216
  media: InputFileProxy<F>["InputMedia"];
1213
1217
  /** An object for a new inline keyboard. */
1214
1218
  reply_markup?: InlineKeyboardMarkup;
1215
- }):
1216
- | (Update.Edited & Message.AnimationMessage)
1217
- | (Update.Edited & Message.AudioMessage)
1218
- | (Update.Edited & Message.DocumentMessage)
1219
- | (Update.Edited & Message.PhotoMessage)
1220
- | (Update.Edited & Message.VideoMessage)
1221
- | true;
1219
+ }): (Update.Edited & Message) | true;
1222
1220
 
1223
1221
  /** Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. */
1224
1222
  editMessageReplyMarkup(args: {