@telegram.ts/types 1.5.0 → 1.7.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.
@@ -604,7 +604,7 @@ export interface InputTextMessageContent {
604
604
  parse_mode?: ParseMode;
605
605
  /** List of special entities that appear in message text, which can be specified instead of parse_mode */
606
606
  entities?: MessageEntity[];
607
- /** Link preview generation options for the message */
607
+ /** Link preview generation options for the message */
608
608
  link_preview_options?: LinkPreviewOptions;
609
609
  }
610
610
  /** Represents the content of a location message to be sent as the result of an inline query. */
@@ -1,4 +1,9 @@
1
- import type { Location, Message, PhotoSize, ReactionType } from "./messageTypes";
1
+ import type {
2
+ Location,
3
+ Message,
4
+ PhotoSize,
5
+ ReactionType,
6
+ } from "./messageTypes";
2
7
  import type { Update } from "./updateTypes";
3
8
 
4
9
  /** Describes the current status of a webhook. */
@@ -92,7 +97,9 @@ export declare namespace Chat {
92
97
  }
93
98
  /** Internal type representing super group chats. */
94
99
  export interface SupergroupChat
95
- extends AbstractChat, UserNameChat, TitleChat {
100
+ extends AbstractChat,
101
+ UserNameChat,
102
+ TitleChat {
96
103
  type: "supergroup";
97
104
  /** True, if the supergroup chat is a forum (has topics enabled) */
98
105
  is_forum?: true;
@@ -132,8 +139,6 @@ export declare namespace Chat {
132
139
  interface MultiUserGetChat {
133
140
  /** Default chat member permissions, for groups and supergroups. Returned only in getChat. */
134
141
  permissions?: ChatPermissions;
135
- /** True, if the bot can change the group sticker set. Returned only in getChat. */
136
- can_set_sticker_set?: true;
137
142
  }
138
143
  /** Internal type holding properties that those private and channel chats returned from `getChat` share. */
139
144
  interface NonMultiUserGetChat {
@@ -155,7 +160,10 @@ export declare namespace Chat {
155
160
  // ==> GET CHATS
156
161
  /** Internal type representing private chats returned from `getChat`. */
157
162
  export interface PrivateGetChat
158
- extends PrivateChat, GetChat, NonGroupGetChat, NonMultiUserGetChat {
163
+ extends PrivateChat,
164
+ GetChat,
165
+ NonGroupGetChat,
166
+ NonMultiUserGetChat {
159
167
  /** Bio of the other party in a private chat. Returned only in getChat. */
160
168
  bio?: string;
161
169
  /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. */
@@ -165,11 +173,13 @@ export declare namespace Chat {
165
173
  }
166
174
  /** Internal type representing group chats returned from `getChat`. */
167
175
  export interface GroupGetChat
168
- extends GroupChat, GetChat, NonPrivateGetChat, MultiUserGetChat {}
176
+ extends GroupChat,
177
+ GetChat,
178
+ NonPrivateGetChat,
179
+ MultiUserGetChat {}
169
180
  /** Internal type representing supergroup chats returned from `getChat`. */
170
181
  export interface SupergroupGetChat
171
- extends
172
- SupergroupChat,
182
+ extends SupergroupChat,
173
183
  GetChat,
174
184
  NonGroupGetChat,
175
185
  NonPrivateGetChat,
@@ -181,19 +191,24 @@ export declare namespace Chat {
181
191
  join_by_request?: true;
182
192
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */
183
193
  slow_mode_delay?: number;
194
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat. */
195
+ unrestrict_boost_count?: number;
184
196
  /** True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat. */
185
197
  has_visible_history?: boolean;
186
198
  /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat. */
187
199
  has_aggressive_anti_spam_enabled?: true;
188
200
  /** For supergroups, name of group sticker set. Returned only in getChat. */
189
201
  sticker_set_name?: string;
202
+ /** True, if the bot can change the group sticker set. Returned only in getChat. */
203
+ can_set_sticker_set?: true;
204
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat. */
205
+ custom_emoji_sticker_set_name?: string;
190
206
  /** For supergroups, the location to which the supergroup is connected. Returned only in getChat. */
191
207
  location?: ChatLocation;
192
208
  }
193
209
  /** Internal type representing channel chats returned from `getChat`. */
194
210
  export interface ChannelGetChat
195
- extends
196
- ChannelChat,
211
+ extends ChannelChat,
197
212
  GetChat,
198
213
  NonGroupGetChat,
199
214
  NonPrivateGetChat,
@@ -266,7 +281,7 @@ export interface ChatInviteLink {
266
281
  export interface ChatAdministratorRights {
267
282
  /** True, if the user's presence in the chat is hidden */
268
283
  is_anonymous: boolean;
269
- /** True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
284
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
270
285
  can_manage_chat: boolean;
271
286
  /** True, if the administrator can delete messages of other users */
272
287
  can_delete_messages: boolean;
@@ -286,9 +301,9 @@ export interface ChatAdministratorRights {
286
301
  can_edit_messages?: boolean;
287
302
  /** True, if the user is allowed to pin messages; groups and supergroups only */
288
303
  can_pin_messages?: boolean;
289
- /** True, if the administrator can post stories in the channel; channels only */
304
+ /** True, if the administrator can post stories to the chat */
290
305
  can_post_stories?: boolean;
291
- /** True, if the administrator can edit stories posted by other users; channels only */
306
+ /** True, if the administrator can edit stories posted by other users */
292
307
  can_edit_stories?: boolean;
293
308
  /** True, if the administrator can delete stories posted by other users; channels only */
294
309
  can_delete_stories?: boolean;
@@ -351,7 +366,7 @@ export interface ChatMemberAdministrator {
351
366
  can_be_edited: boolean;
352
367
  /** True, if the user's presence in the chat is hidden */
353
368
  is_anonymous: boolean;
354
- /** True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */
369
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
355
370
  can_manage_chat: boolean;
356
371
  /** True, if the administrator can delete messages of other users */
357
372
  can_delete_messages: boolean;
@@ -371,11 +386,11 @@ export interface ChatMemberAdministrator {
371
386
  can_edit_messages?: boolean;
372
387
  /** True, if the user is allowed to pin messages; groups and supergroups only */
373
388
  can_pin_messages?: boolean;
374
- /** True, if the administrator can post stories in the channel; channels only */
389
+ /** True, if the administrator can post stories to the chat */
375
390
  can_post_stories?: boolean;
376
- /** True, if the administrator can edit stories posted by other users; channels only */
391
+ /** True, if the administrator can edit stories posted by other users */
377
392
  can_edit_stories?: boolean;
378
- /** True, if the administrator can delete stories posted by other users; channels only */
393
+ /** True, if the administrator can delete stories posted by other users */
379
394
  can_delete_stories?: boolean;
380
395
  /** True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only */
381
396
  can_manage_topics?: boolean;
@@ -595,4 +610,4 @@ export interface ChatBoostRemoved {
595
610
  export interface UserChatBoosts {
596
611
  /** The list of boosts added to the chat by the user */
597
612
  boosts: ChatBoost[];
598
- }
613
+ }
@@ -23,6 +23,8 @@ export declare namespace Message {
23
23
  is_topic_message?: boolean;
24
24
  }
25
25
  export interface CommonMessage extends ServiceMessage {
26
+ /** If the sender of the message boosted the chat, the number of boosts added by the user */
27
+ sender_boost_count?: number;
26
28
  /** Information about the original message for forwarded messages */
27
29
  forward_origin?: MessageOrigin;
28
30
  /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
@@ -33,6 +35,8 @@ export declare namespace Message {
33
35
  external_reply?: ExternalReplyInfo;
34
36
  /** For replies that quote part of the original message, the quoted part of the message */
35
37
  quote?: TextQuote;
38
+ /** For replies to a story, the original message */
39
+ reply_to_story?: Story;
36
40
  /** Bot through which the message was sent */
37
41
  via_bot?: User;
38
42
  /** Date the message was last edited in Unix time */
@@ -75,92 +79,67 @@ export declare namespace Message {
75
79
  export type PollMessage = CommonMessage & MsgWith<"poll">;
76
80
  export type LocationMessage = CommonMessage & MsgWith<"location">;
77
81
  export type VenueMessage = LocationMessage & MsgWith<"venue">;
78
- export type NewChatMembersMessage =
79
- & ServiceMessage
80
- & MsgWith<"new_chat_members">;
81
- export type LeftChatMemberMessage =
82
- & ServiceMessage
83
- & MsgWith<"left_chat_member">;
82
+ export type NewChatMembersMessage = ServiceMessage &
83
+ MsgWith<"new_chat_members">;
84
+ export type LeftChatMemberMessage = ServiceMessage &
85
+ MsgWith<"left_chat_member">;
84
86
  export type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
85
87
  export type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
86
- export type DeleteChatPhotoMessage =
87
- & ServiceMessage
88
- & MsgWith<"delete_chat_photo">;
89
- export type GroupChatCreatedMessage =
90
- & ServiceMessage
91
- & MsgWith<"group_chat_created">;
92
- export type SupergroupChatCreated =
93
- & ServiceMessage
94
- & MsgWith<"supergroup_chat_created">;
95
- export type ChannelChatCreatedMessage =
96
- & ServiceMessage
97
- & MsgWith<"channel_chat_created">;
98
- export type MessageAutoDeleteTimerChangedMessage =
99
- & ServiceMessage
100
- & MsgWith<"message_auto_delete_timer_changed">;
101
- export type MigrateToChatIdMessage =
102
- & ServiceMessage
103
- & MsgWith<"migrate_to_chat_id">;
104
- export type MigrateFromChatIdMessage =
105
- & ServiceMessage
106
- & MsgWith<"migrate_from_chat_id">;
88
+ export type DeleteChatPhotoMessage = ServiceMessage &
89
+ MsgWith<"delete_chat_photo">;
90
+ export type GroupChatCreatedMessage = ServiceMessage &
91
+ MsgWith<"group_chat_created">;
92
+ export type SupergroupChatCreated = ServiceMessage &
93
+ MsgWith<"supergroup_chat_created">;
94
+ export type ChannelChatCreatedMessage = ServiceMessage &
95
+ MsgWith<"channel_chat_created">;
96
+ export type MessageAutoDeleteTimerChangedMessage = ServiceMessage &
97
+ MsgWith<"message_auto_delete_timer_changed">;
98
+ export type MigrateToChatIdMessage = ServiceMessage &
99
+ MsgWith<"migrate_to_chat_id">;
100
+ export type MigrateFromChatIdMessage = ServiceMessage &
101
+ MsgWith<"migrate_from_chat_id">;
107
102
  export type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
108
103
  export type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
109
- export type SuccessfulPaymentMessage =
110
- & ServiceMessage
111
- & MsgWith<"successful_payment">;
104
+ export type SuccessfulPaymentMessage = ServiceMessage &
105
+ MsgWith<"successful_payment">;
112
106
  export type UsersSharedMessage = ServiceMessage & MsgWith<"users_shared">;
113
107
  export type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
114
- export type ConnectedWebsiteMessage =
115
- & ServiceMessage
116
- & MsgWith<"connected_website">;
117
- export type WriteAccessAllowedMessage =
118
- & ServiceMessage
119
- & MsgWith<"write_access_allowed">;
108
+ export type ConnectedWebsiteMessage = ServiceMessage &
109
+ MsgWith<"connected_website">;
110
+ export type WriteAccessAllowedMessage = ServiceMessage &
111
+ MsgWith<"write_access_allowed">;
120
112
  export type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
121
- export type ProximityAlertTriggeredMessage =
122
- & ServiceMessage
123
- & MsgWith<"proximity_alert_triggered">;
124
- export type ForumTopicCreatedMessage =
125
- & ServiceMessage
126
- & MsgWith<"forum_topic_created">;
127
- export type ForumTopicEditedMessage =
128
- & ServiceMessage
129
- & MsgWith<"forum_topic_edited">;
130
- export type ForumTopicClosedMessage =
131
- & ServiceMessage
132
- & MsgWith<"forum_topic_closed">;
133
- export type ForumTopicReopenedMessage =
134
- & ServiceMessage
135
- & MsgWith<"forum_topic_reopened">;
136
- export type GeneralForumTopicHiddenMessage =
137
- & ServiceMessage
138
- & MsgWith<"general_forum_topic_hidden">;
139
- export type GeneralForumTopicUnhiddenMessage =
140
- & ServiceMessage
141
- & MsgWith<"general_forum_topic_unhidden">;
142
- export type GiveawayCreatedMessage =
143
- & ServiceMessage
144
- & MsgWith<"giveaway_created">;
113
+ export type ProximityAlertTriggeredMessage = ServiceMessage &
114
+ MsgWith<"proximity_alert_triggered">;
115
+ export type BoostAddedMessage = ServiceMessage & MsgWith<"boost_added">;
116
+ export type ForumTopicCreatedMessage = ServiceMessage &
117
+ MsgWith<"forum_topic_created">;
118
+ export type ForumTopicEditedMessage = ServiceMessage &
119
+ MsgWith<"forum_topic_edited">;
120
+ export type ForumTopicClosedMessage = ServiceMessage &
121
+ MsgWith<"forum_topic_closed">;
122
+ export type ForumTopicReopenedMessage = ServiceMessage &
123
+ MsgWith<"forum_topic_reopened">;
124
+ export type GeneralForumTopicHiddenMessage = ServiceMessage &
125
+ MsgWith<"general_forum_topic_hidden">;
126
+ export type GeneralForumTopicUnhiddenMessage = ServiceMessage &
127
+ MsgWith<"general_forum_topic_unhidden">;
128
+ export type GiveawayCreatedMessage = ServiceMessage &
129
+ MsgWith<"giveaway_created">;
145
130
  export type GiveawayMessage = ServiceMessage & MsgWith<"giveaway">;
146
- export type GiveawayWinnersMessage =
147
- & ServiceMessage
148
- & MsgWith<"giveaway_winners">;
149
- export type GiveawayCompletedMessage =
150
- & ServiceMessage
151
- & MsgWith<"giveaway_completed">;
152
- export type VideoChatScheduledMessage =
153
- & ServiceMessage
154
- & MsgWith<"video_chat_scheduled">;
155
- export type VideoChatStartedMessage =
156
- & ServiceMessage
157
- & MsgWith<"video_chat_started">;
158
- export type VideoChatEndedMessage =
159
- & ServiceMessage
160
- & MsgWith<"video_chat_ended">;
161
- export type VideoChatParticipantsInvitedMessage =
162
- & ServiceMessage
163
- & MsgWith<"video_chat_participants_invited">;
131
+ export type GiveawayWinnersMessage = ServiceMessage &
132
+ MsgWith<"giveaway_winners">;
133
+ export type GiveawayCompletedMessage = ServiceMessage &
134
+ MsgWith<"giveaway_completed">;
135
+ export type VideoChatScheduledMessage = ServiceMessage &
136
+ MsgWith<"video_chat_scheduled">;
137
+ export type VideoChatStartedMessage = ServiceMessage &
138
+ MsgWith<"video_chat_started">;
139
+ export type VideoChatEndedMessage = ServiceMessage &
140
+ MsgWith<"video_chat_ended">;
141
+ export type VideoChatParticipantsInvitedMessage = ServiceMessage &
142
+ MsgWith<"video_chat_participants_invited">;
164
143
  export type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
165
144
  }
166
145
 
@@ -241,6 +220,8 @@ export interface Message extends Message.MediaMessage {
241
220
  passport_data?: PassportData;
242
221
  /** Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */
243
222
  proximity_alert_triggered?: ProximityAlertTriggered;
223
+ /** Service message: user boosted the chat */
224
+ boost_added?: ChatBoostAdded;
244
225
  /** Service message: forum topic created */
245
226
  forum_topic_created?: ForumTopicCreated;
246
227
  /** Service message: forum topic edited */
@@ -286,8 +267,8 @@ export interface SentWebAppMessage {
286
267
  }
287
268
 
288
269
  /** This object describes a message that was deleted or is otherwise inaccessible to the bot. */
289
- export interface InaccessibleMessage extends
290
- Omit<
270
+ export interface InaccessibleMessage
271
+ extends Omit<
291
272
  // TypeScript cannot discriminate union types based on `0` and `number` so
292
273
  // we work around this by including all other properties here. This mostly
293
274
  // negates the benefit of having this interface in the first place, but not
@@ -307,9 +288,7 @@ export interface InaccessibleMessage extends
307
288
  /** This object describes a message that can be inaccessible to the bot. It can be one of
308
289
  - Message
309
290
  - InaccessibleMessage */
310
- export type MaybeInaccessibleMessage =
311
- | Message
312
- | InaccessibleMessage;
291
+ export type MaybeInaccessibleMessage = Message | InaccessibleMessage;
313
292
 
314
293
  /** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting.
315
294
 
@@ -350,7 +329,9 @@ pre-formatted fixed-width code block written in the Python programming language
350
329
  ```
351
330
  >Block quotation started
352
331
  >Block quotation continued
353
- >The last line of the block quotation
332
+ >The last line of the block quotation**
333
+ >The second block quotation started right after the previous\r
334
+ >The third block quotation started right after the previous
354
335
  ```
355
336
  Please note:
356
337
 
@@ -840,8 +821,13 @@ export interface Venue {
840
821
  google_place_type?: string;
841
822
  }
842
823
 
843
- /** This object represents a message about a forwarded story in the chat. Currently holds no information. */
844
- export interface Story {}
824
+ /** This object represents a story. */
825
+ export interface Story {
826
+ /** Chat that posted the story */
827
+ chat: Chat;
828
+ /** Unique identifier for the story in the chat */
829
+ id: number;
830
+ }
845
831
 
846
832
  /** This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. */
847
833
  export interface ProximityAlertTriggered {
@@ -889,6 +875,12 @@ export interface GeneralForumTopicHidden {}
889
875
  /** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
890
876
  export interface GeneralForumTopicUnhidden {}
891
877
 
878
+ /** This object represents a service message about a user boosting a chat. */
879
+ export interface ChatBoostAdded {
880
+ /** Number of boosts added by the user */
881
+ boost_count: number;
882
+ }
883
+
892
884
  /** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button. */
893
885
  export interface UsersShared {
894
886
  /** Identifier of the request */
@@ -1245,4 +1237,4 @@ export interface MessageReactionCountUpdated {
1245
1237
  date: number;
1246
1238
  /** List of reactions that are present on the message */
1247
1239
  reactions: ReactionCount[];
1248
- }
1240
+ }
@@ -31,7 +31,7 @@ export interface ApiSuccess<T> {
31
31
  * Describes additional parameters provided in an API error response.
32
32
  */
33
33
  export interface ResponseParameters {
34
- /** The group has been migrated to a supergroup with the specified identifier. */
34
+ /** The group has been migrated to a supergroup with the specified identifier. */
35
35
  migrate_to_chat_id?: number;
36
36
  /**
37
37
  * In case of exceeding flood control, the number of seconds left to wait before the request can be repeated.
@@ -78,10 +78,10 @@ export interface Update {
78
78
  * New version of a channel post known to the bot that has been edited.
79
79
  */
80
80
  edited_channel_post?: Message & Update.Edited & Update.Channel;
81
-
81
+
82
82
  /** A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots. */
83
83
  message_reaction?: MessageReactionUpdated;
84
-
84
+
85
85
  /** Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. */
86
86
  message_reaction_count?: MessageReactionCountUpdated;
87
87
 
@@ -139,10 +139,10 @@ export interface Update {
139
139
  * The bot must have the can_invite_users administrator right in the chat to receive these updates.
140
140
  */
141
141
  chat_join_request?: ChatJoinRequest;
142
-
142
+
143
143
  /** A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. */
144
144
  chat_boost?: ChatBoostUpdated;
145
-
145
+
146
146
  /** A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */
147
147
  removed_chat_boost?: ChatBoostRemoved;
148
148
  }