@grammyjs/types 2.10.2 → 2.11.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
@@ -89,3 +89,5 @@ The actual type definitions themselves are never different.
89
89
  4. No `More info on Sending Files »`.
90
90
  File handling is abstracted away by the underlying library.
91
91
  Also, without the links, it's useless anyway.
92
+ 5. No images.
93
+ Documentation strings containing an image are adjusted to make sense without the images, too.
package/manage.d.ts CHANGED
@@ -163,6 +163,8 @@ export namespace Chat {
163
163
  extends SupergroupChat, NonGroupGetChat, MultiUserGetChat, LargeGetChat {
164
164
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
165
165
  slow_mode_delay?: number;
166
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
167
+ has_aggressive_anti_spam_enabled?: true;
166
168
  /** For supergroups, name of group sticker set. Returned only in getChat. */
167
169
  sticker_set_name?: string;
168
170
  /** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
package/markup.d.ts CHANGED
@@ -108,6 +108,8 @@ export interface CallbackQuery {
108
108
  export interface ReplyKeyboardMarkup {
109
109
  /** Array of button rows, each represented by an Array of KeyboardButton objects */
110
110
  keyboard: KeyboardButton[][];
111
+ /** Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
112
+ is_persistent?: boolean;
111
113
  /** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
112
114
  resize_keyboard?: boolean;
113
115
  /** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */
package/message.d.ts CHANGED
@@ -59,6 +59,8 @@ export namespace Message {
59
59
  interface MediaMessage extends CaptionableMessage {
60
60
  /** The unique identifier of a media message group this message belongs to */
61
61
  media_group_id?: string;
62
+ /** True, if the message media is covered by a spoiler animation */
63
+ has_media_spoiler?: true;
62
64
  }
63
65
 
64
66
  export type TextMessage = CommonMessage & MsgWith<"text">;
@@ -113,6 +115,9 @@ export namespace Message {
113
115
  export type ConnectedWebsiteMessage =
114
116
  & ServiceMessage
115
117
  & MsgWith<"connected_website">;
118
+ export type WriteAccessAllowedMessage =
119
+ & ServiceMessage
120
+ & MsgWith<"write_access_allowed">;
116
121
  export type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
117
122
  export type ProximityAlertTriggeredMessage =
118
123
  & ServiceMessage
@@ -120,12 +125,21 @@ export namespace Message {
120
125
  export type ForumTopicCreatedMessage =
121
126
  & ServiceMessage
122
127
  & MsgWith<"forum_topic_created">;
128
+ export type ForumTopicEditedMessage =
129
+ & ServiceMessage
130
+ & MsgWith<"forum_topic_edited">;
123
131
  export type ForumTopicClosedMessage =
124
132
  & ServiceMessage
125
133
  & MsgWith<"forum_topic_closed">;
126
134
  export type ForumTopicReopenedMessage =
127
135
  & ServiceMessage
128
136
  & MsgWith<"forum_topic_reopened">;
137
+ export type GeneralForumTopicHiddenMessage =
138
+ & ServiceMessage
139
+ & MsgWith<"general_forum_topic_hidden">;
140
+ export type GeneralForumTopicUnhiddenMessage =
141
+ & ServiceMessage
142
+ & MsgWith<"general_forum_topic_unhidden">;
129
143
  export type VideoChatScheduledMessage =
130
144
  & ServiceMessage
131
145
  & MsgWith<"video_chat_scheduled">;
@@ -206,16 +220,24 @@ export interface Message extends Message.MediaMessage {
206
220
  successful_payment?: SuccessfulPayment;
207
221
  /** The domain name of the website on which the user has logged in. More about Telegram Login » */
208
222
  connected_website?: string;
223
+ /** Service message: the user allowed the bot added to the attachment menu to write messages */
224
+ write_access_allowed?: WriteAccessAllowed;
209
225
  /** Telegram Passport data */
210
226
  passport_data?: PassportData;
211
227
  /** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */
212
228
  proximity_alert_triggered?: ProximityAlertTriggered;
213
229
  /** Service message: forum topic created */
214
230
  forum_topic_created?: ForumTopicCreated;
231
+ /** Service message: forum topic edited */
232
+ forum_topic_edited?: ForumTopicEdited;
215
233
  /** Service message: forum topic closed */
216
234
  forum_topic_closed?: ForumTopicClosed;
217
235
  /** Service message: forum topic reopened */
218
236
  forum_topic_reopened?: ForumTopicReopened;
237
+ /** Service message: the 'General' forum topic hidden */
238
+ general_forum_topic_hidden?: GeneralForumTopicHidden;
239
+ /** Service message: the 'General' forum topic unhidden */
240
+ general_forum_topic_unhidden?: GeneralForumTopicUnhidden;
219
241
  /** Service message: video chat scheduled */
220
242
  video_chat_scheduled?: VideoChatScheduled;
221
243
  /** Service message: video chat started */
@@ -642,12 +664,29 @@ export interface ForumTopicCreated {
642
664
  icon_custom_emoji_id?: string;
643
665
  }
644
666
 
667
+ /** This object represents a service message about an edited forum topic. */
668
+ export interface ForumTopicEdited {
669
+ /** New name of the topic, if it was edited */
670
+ name?: string;
671
+ /** New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed */
672
+ icon_custom_emoji_id?: string;
673
+ }
674
+
645
675
  /** This object represents a service message about a forum topic closed in the chat. Currently holds no information. */
646
676
  export interface ForumTopicClosed {}
647
677
 
648
678
  /** This object represents a service message about a forum topic reopened in the chat. Currently holds no information. */
649
679
  export interface ForumTopicReopened {}
650
680
 
681
+ /** This object represents a service message about General forum topic hidden in the chat. Currently holds no information. */
682
+ export interface GeneralForumTopicHidden {}
683
+
684
+ /** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
685
+ export interface GeneralForumTopicUnhidden {}
686
+
687
+ /** 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
+ export interface WriteAccessAllowed {}
689
+
651
690
  /** This object represents a service message about a video chat scheduled in the chat. */
652
691
  export interface VideoChatScheduled {
653
692
  /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "2.10.2",
3
+ "version": "2.11.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "index.js",
6
6
  "repository": {
package/proxied.d.ts CHANGED
@@ -209,6 +209,8 @@ export interface InputFileProxy<F> {
209
209
  parse_mode?: ParseMode;
210
210
  /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
211
211
  caption_entities?: MessageEntity[];
212
+ /** Pass True if the photo needs to be covered with a spoiler animation */
213
+ has_spoiler?: boolean;
212
214
  /** Sends the message silently. Users will receive a notification with no sound. */
213
215
  disable_notification?: boolean;
214
216
  /** Protects the contents of the sent message from forwarding and saving */
@@ -321,6 +323,8 @@ export interface InputFileProxy<F> {
321
323
  parse_mode?: ParseMode;
322
324
  /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
323
325
  caption_entities?: MessageEntity[];
326
+ /** Pass True if the video needs to be covered with a spoiler animation */
327
+ has_spoiler?: boolean;
324
328
  /** Pass True if the uploaded video is suitable for streaming */
325
329
  supports_streaming?: boolean;
326
330
  /** Sends the message silently. Users will receive a notification with no sound. */
@@ -361,6 +365,8 @@ export interface InputFileProxy<F> {
361
365
  parse_mode?: ParseMode;
362
366
  /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
363
367
  caption_entities?: MessageEntity[];
368
+ /** Pass True if the animation needs to be covered with a spoiler animation */
369
+ has_spoiler?: boolean;
364
370
  /** Sends the message silently. Users will receive a notification with no sound. */
365
371
  disable_notification?: boolean;
366
372
  /** Protects the contents of the sent message from forwarding and saving */
@@ -695,6 +701,8 @@ export interface InputFileProxy<F> {
695
701
  | "find_location"
696
702
  | "record_video_note"
697
703
  | "upload_video_note";
704
+ /** Unique identifier for the target message thread; supergroups only */
705
+ message_thread_id?: number;
698
706
  }): true;
699
707
 
700
708
  /** Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. */
@@ -963,7 +971,7 @@ export interface InputFileProxy<F> {
963
971
  chat_id: number | string;
964
972
  }): number;
965
973
 
966
- /** Use this method to get information about a member of a chat. Returns a ChatMember object on success. */
974
+ /** Use this method to get information about a member of a chat. The method is guaranteed to work only if the bot is an administrator in the chat. Returns a ChatMember object on success. */
967
975
  getChatMember(args: {
968
976
  /** Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername) */
969
977
  chat_id: number | string;
@@ -994,7 +1002,7 @@ export interface InputFileProxy<F> {
994
1002
  chat_id: number | string;
995
1003
  /** Topic name, 1-128 characters */
996
1004
  name: string;
997
- /** Color of the topic icon in RGB format. Currently, must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F */
1005
+ /** Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F) */
998
1006
  icon_color?:
999
1007
  | 0x6FB9F0
1000
1008
  | 0xFFD67E
@@ -1012,10 +1020,10 @@ export interface InputFileProxy<F> {
1012
1020
  chat_id: number | string;
1013
1021
  /** Unique identifier for the target message thread of the forum topic */
1014
1022
  message_thread_id: number;
1015
- /** New topic name, 1-128 characters */
1016
- name: string;
1017
- /** New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. */
1018
- icon_custom_emoji_id: string;
1023
+ /** New topic name, 0-128 characters. If not specififed or empty, the current name of the topic will be kept */
1024
+ name?: string;
1025
+ /** 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
+ icon_custom_emoji_id?: string;
1019
1027
  }): true;
1020
1028
 
1021
1029
  /** Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success. */
@@ -1050,6 +1058,38 @@ export interface InputFileProxy<F> {
1050
1058
  message_thread_id: number;
1051
1059
  }): true;
1052
1060
 
1061
+ /** Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success. */
1062
+ editGeneralForumTopic(args: {
1063
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1064
+ chat_id: number | string;
1065
+ /** New topic name, 1-128 characters */
1066
+ name: string;
1067
+ }): true;
1068
+
1069
+ /** Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */
1070
+ closeGeneralForumTopic(args: {
1071
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1072
+ chat_id: number | string;
1073
+ }): true;
1074
+
1075
+ /** Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success. */
1076
+ reopenGeneralForumTopic(args: {
1077
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1078
+ chat_id: number | string;
1079
+ }): true;
1080
+
1081
+ /** Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success. */
1082
+ hideGeneralForumTopic(args: {
1083
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1084
+ chat_id: number | string;
1085
+ }): true;
1086
+
1087
+ /** Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success. */
1088
+ unhideGeneralForumTopic(args: {
1089
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1090
+ chat_id: number | string;
1091
+ }): true;
1092
+
1053
1093
  /** 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.
1054
1094
 
1055
1095
  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. */
@@ -1568,6 +1608,8 @@ export interface InputFileProxy<F> {
1568
1608
  parse_mode?: ParseMode;
1569
1609
  /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
1570
1610
  caption_entities?: MessageEntity[];
1611
+ /** Pass True if the photo needs to be covered with a spoiler animation */
1612
+ has_spoiler?: boolean;
1571
1613
  };
1572
1614
 
1573
1615
  /** Represents a video to be sent. */
@@ -1592,6 +1634,8 @@ export interface InputFileProxy<F> {
1592
1634
  duration?: number;
1593
1635
  /** Pass True if the uploaded video is suitable for streaming */
1594
1636
  supports_streaming?: boolean;
1637
+ /** Pass True if the photo needs to be covered with a spoiler animation */
1638
+ has_spoiler?: boolean;
1595
1639
  };
1596
1640
 
1597
1641
  /** Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. */
@@ -1614,6 +1658,8 @@ export interface InputFileProxy<F> {
1614
1658
  height?: number;
1615
1659
  /** Animation duration in seconds */
1616
1660
  duration?: number;
1661
+ /** Pass True if the photo needs to be covered with a spoiler animation */
1662
+ has_spoiler?: boolean;
1617
1663
  };
1618
1664
 
1619
1665
  /** Represents an audio file to be treated as music to be sent. */
package/update.d.ts CHANGED
@@ -6,13 +6,13 @@ import { PreCheckoutQuery, ShippingQuery } from "./payment";
6
6
 
7
7
  /** Internal namespace used to make some message types more accurate */
8
8
  export namespace Update {
9
- /** Internal type holding properties that updates in channels share. */
9
+ /** Internal type holding properties that message updates in channels share. */
10
10
  export interface Channel {
11
11
  chat: Chat.ChannelChat;
12
12
  author_signature?: string;
13
13
  from?: never;
14
14
  }
15
- /** Internal type holding properties that updates outside of channels share. */
15
+ /** Internal type holding properties that message updates outside of channels share. */
16
16
  export interface NonChannel {
17
17
  chat: Exclude<Chat, Chat.ChannelChat>;
18
18
  author_signature?: never;
@@ -41,13 +41,13 @@ export interface Update {
41
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
43
  /** New incoming message of any kind - text, photo, sticker, etc. */
44
- message?: Message;
44
+ message?: Message & Update.New & Update.NonChannel;
45
45
  /** New version of a message that is known to the bot and was edited */
46
- edited_message?: Message;
46
+ edited_message?: Message & Update.Edited & Update.NonChannel;
47
47
  /** New incoming channel post of any kind - text, photo, sticker, etc. */
48
- channel_post?: Message;
48
+ channel_post?: Message & Update.New & Update.Channel;
49
49
  /** New version of a channel post that is known to the bot and was edited */
50
- edited_channel_post?: Message;
50
+ edited_channel_post?: Message & Update.Edited & Update.Channel;
51
51
  /** New incoming inline query */
52
52
  inline_query?: InlineQuery;
53
53
  /** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */