@grammyjs/types 3.19.0 → 3.20.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/manage.d.ts CHANGED
@@ -21,6 +21,17 @@ export interface WebhookInfo {
21
21
  /** A list of update types the bot is subscribed to. Defaults to all update types except chat_member */
22
22
  allowed_updates?: Array<Exclude<keyof Update, "update_id">>;
23
23
  }
24
+ /** This object describes the types of gifts that can be gifted to a user or a chat. */
25
+ export interface AcceptedGiftTypes {
26
+ /** True, if unlimited regular gifts are accepted */
27
+ unlimited_gifts: boolean;
28
+ /** True, if limited regular gifts are accepted */
29
+ limited_gifts: boolean;
30
+ /** True, if unique gifts or gifts that can be upgraded to unique for free are accepted */
31
+ unique_gifts: boolean;
32
+ /** True, if a Telegram Premium subscription is accepted */
33
+ premium_subscription: boolean;
34
+ }
24
35
  /** This object represents a Telegram user or bot. */
25
36
  export interface User {
26
37
  /** Unique identifier for this user or bot. */
@@ -192,8 +203,8 @@ export declare namespace ChatFullInfo {
192
203
  pinned_message?: Message;
193
204
  /** Default chat member permissions, for groups and supergroups */
194
205
  permissions?: undefined;
195
- /** True, if gifts can be sent to the chat */
196
- can_send_gift?: true;
206
+ /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */
207
+ accepted_gift_types: AcceptedGiftTypes;
197
208
  /** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
198
209
  can_send_paid_media?: undefined;
199
210
  /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
@@ -901,6 +912,37 @@ export interface UserChatBoosts {
901
912
  /** The list of boosts added to the chat by the user */
902
913
  boosts: ChatBoost[];
903
914
  }
915
+ /** Represents the rights of a business bot. */
916
+ export interface BusinessBotRights {
917
+ /** True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours */
918
+ can_reply?: true;
919
+ /** True, if the bot can mark incoming private messages as read */
920
+ can_read_messages?: true;
921
+ /** True, if the bot can delete messages sent by the bot */
922
+ can_delete_outgoing_messages?: true;
923
+ /** True, if the bot can delete all private messages in managed chats */
924
+ can_delete_all_messages?: true;
925
+ /** True, if the bot can edit the first and last name of the business account */
926
+ can_edit_name?: true;
927
+ /** True, if the bot can edit the bio of the business account */
928
+ can_edit_bio?: true;
929
+ /** True, if the bot can edit the profile photo of the business account */
930
+ can_edit_profile_photo?: true;
931
+ /** True, if the bot can edit the username of the business account */
932
+ can_edit_username?: true;
933
+ /** True, if the bot can change the privacy settings pertaining to gifts for the business account */
934
+ can_change_gift_settings?: true;
935
+ /** True, if the bot can view gifts and the amount of Telegram Stars owned by the business account */
936
+ can_view_gifts_and_stars?: true;
937
+ /** True, if the bot can convert regular gifts owned by the business account to Telegram Stars */
938
+ can_convert_gifts_to_stars?: true;
939
+ /** True, if the bot can transfer and upgrade gifts owned by the business account */
940
+ can_transfer_and_upgrade_gifts?: true;
941
+ /** True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts */
942
+ can_transfer_stars?: true;
943
+ /** True, if the bot can post, edit and delete stories on behalf of the business account */
944
+ can_manage_stories?: true;
945
+ }
904
946
  /** Describes the connection of the bot with a business account. */
905
947
  export interface BusinessConnection {
906
948
  /** Unique identifier of the business connection */
@@ -911,8 +953,8 @@ export interface BusinessConnection {
911
953
  user_chat_id: number;
912
954
  /** Date the connection was established in Unix time */
913
955
  date: number;
914
- /** True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours */
915
- can_reply: boolean;
956
+ /** Rights of the business bot */
957
+ rights?: BusinessBotRights;
916
958
  /** True, if the connection is active */
917
959
  is_enabled: boolean;
918
960
  }
package/message.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Chat, User } from "./manage.js";
2
2
  import type { InlineKeyboardMarkup } from "./markup.js";
3
3
  import type { PassportData } from "./passport.js";
4
- import type { Invoice, RefundedPayment, SuccessfulPayment } from "./payment.js";
4
+ import type { GiftInfo, Invoice, PaidMessagePriceChanged, RefundedPayment, SuccessfulPayment, UniqueGiftInfo } from "./payment.js";
5
5
  type MsgWith<P extends keyof Message> = Record<P, NonNullable<Message[P]>>;
6
6
  export declare namespace Message {
7
7
  interface ServiceMessage {
@@ -55,6 +55,8 @@ export declare namespace Message {
55
55
  link_preview_options?: LinkPreviewOptions;
56
56
  /** Unique identifier of the message effect added to the message */
57
57
  effect_id?: string;
58
+ /** The number of Telegram Stars that were paid by the sender of the message to send it */
59
+ paid_star_count?: number;
58
60
  /** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
59
61
  reply_markup?: InlineKeyboardMarkup;
60
62
  }
@@ -120,6 +122,9 @@ export declare namespace Message {
120
122
  type GiveawayMessage = ServiceMessage & MsgWith<"giveaway">;
121
123
  type GiveawayWinnersMessage = ServiceMessage & MsgWith<"giveaway_winners">;
122
124
  type GiveawayCompletedMessage = ServiceMessage & MsgWith<"giveaway_completed">;
125
+ type GiftMessage = ServiceMessage & MsgWith<"gift">;
126
+ type UniqueGiftMessage = ServiceMessage & MsgWith<"unique_gift">;
127
+ type PaidMessagePriceChangedMessage = ServiceMessage & MsgWith<"paid_message_price_changed">;
123
128
  type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
124
129
  type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
125
130
  type VideoChatEndedMessage = ServiceMessage & MsgWith<"video_chat_ended">;
@@ -232,6 +237,12 @@ export interface Message extends Message.MediaMessage {
232
237
  giveaway_winners?: GiveawayWinners;
233
238
  /** Service message: a giveaway without public winners was completed */
234
239
  giveaway_completed?: GiveawayCompleted;
240
+ /** Service message: a regular gift was sent or received */
241
+ gift?: GiftInfo;
242
+ /** Service message: a unique gift was sent or received */
243
+ unique_gift?: UniqueGiftInfo;
244
+ /** Service message: the price for paid messages has changed in the chat */
245
+ paid_message_price_changed?: PaidMessagePriceChanged;
235
246
  /** Service message: video chat scheduled */
236
247
  video_chat_scheduled?: VideoChatScheduled;
237
248
  /** Service message: video chat started */
package/methods.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { InlineQueryResult, InlineQueryResultsButton } from "./inline.js";
2
2
  import type { LanguageCode } from "./langs.js";
3
- import type { BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
3
+ import type { AcceptedGiftTypes, BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
4
4
  import type { ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "./markup.js";
5
- import type { File, GameHighScore, InputPollOption, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, PreparedInlineMessage, ReactionType, ReplyParameters, SentWebAppMessage, Sticker, StickerSet } from "./message.js";
5
+ import type { File, GameHighScore, InputPollOption, LinkPreviewOptions, MaskPosition, Message, MessageEntity, MessageId, ParseMode, Poll, PreparedInlineMessage, ReactionType, ReplyParameters, SentWebAppMessage, Sticker, StickerSet, Story } from "./message.js";
6
6
  import type { PassportElementError } from "./passport.js";
7
- import type { Gifts, LabeledPrice, ShippingOption, StarTransactions } from "./payment.js";
7
+ import type { Gifts, LabeledPrice, OwnedGifts, ShippingOption, StarAmount, StarTransactions } from "./payment.js";
8
8
  import type { BotCommandScope, BotDescription, BotName, BotShortDescription, MenuButton } from "./settings.js";
9
+ import { StoryArea } from "./story.js";
9
10
  import type { Update } from "./update.js";
10
11
  /** Extracts the parameters of a given method name */
11
12
  type Params<F, M extends keyof ApiMethods<F>> = Parameters<ApiMethods<F>[M]>;
@@ -1352,6 +1353,168 @@ export type ApiMethods<F> = {
1352
1353
  /** A list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted */
1353
1354
  message_ids: number[];
1354
1355
  }): true;
1356
+ /** Delete messages on behalf of a business account. Requires the can_delete_outgoing_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success. */
1357
+ deleteBusinessMessages(args: {
1358
+ /** Unique identifier of the business connection on behalf of which to delete the messages */
1359
+ business_connection_id: string;
1360
+ /** A list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted */
1361
+ message_ids: number[];
1362
+ }): true;
1363
+ /** Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success. */
1364
+ setBusinessAccountName(args: {
1365
+ /** Unique identifier of the business connection */
1366
+ business_connection_id: string;
1367
+ /** The new value of the first name for the business account; 1-64 characters */
1368
+ first_name: string;
1369
+ /** The new value of the last name for the business account; 0-64 characters */
1370
+ last_name?: string;
1371
+ }): true;
1372
+ /** Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success. */
1373
+ setBusinessAccountUsername(args: {
1374
+ /** Unique identifier of the business connection */
1375
+ business_connection_id: string;
1376
+ /** The new value of the username for the business account; 0-32 characters */
1377
+ username?: string;
1378
+ }): true;
1379
+ /** Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success. */
1380
+ setBusinessAccountBio(args: {
1381
+ /** Unique identifier of the business connection */
1382
+ business_connection_id: string;
1383
+ /** The new value of the bio for the business account; 0-140 characters */
1384
+ bio?: string;
1385
+ }): true;
1386
+ /** Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success. */
1387
+ setBusinessAccountProfilePhoto(args: {
1388
+ /** Unique identifier of the business connection */
1389
+ business_connection_id: string;
1390
+ /** The new profile photo to set */
1391
+ photo: InputProfilePhoto<F>;
1392
+ /** Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo. */
1393
+ is_public?: boolean;
1394
+ }): true;
1395
+ /** Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success. */
1396
+ removeBusinessAccountProfilePhoto(args: {
1397
+ /** Unique identifier of the business connection */
1398
+ business_connection_id: string;
1399
+ /** Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo. */
1400
+ is_public?: boolean;
1401
+ }): true;
1402
+ /** Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success. */
1403
+ setBusinessAccountGiftSettings(args: {
1404
+ /** Unique identifier of the business connection */
1405
+ business_connection_id: string;
1406
+ /** Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field */
1407
+ show_gift_button: boolean;
1408
+ /** Types of gifts accepted by the business account */
1409
+ accepted_gift_types: AcceptedGiftTypes;
1410
+ }): true;
1411
+ /** Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success. */
1412
+ getBusinessAccountStarBalance(args: {
1413
+ /** Unique identifier of the business connection */
1414
+ business_connection_id: string;
1415
+ }): StarAmount;
1416
+ /** Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success. */
1417
+ transferBusinessAccountStars(args: {
1418
+ /** Unique identifier of the business connection */
1419
+ business_connection_id: string;
1420
+ /** Number of Telegram Stars to transfer; 1-10000 */
1421
+ star_count: number;
1422
+ }): true;
1423
+ /** Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success. */
1424
+ getBusinessAccountGifts(args: {
1425
+ /** Unique identifier of the business connection */
1426
+ business_connection_id: string;
1427
+ /** Pass True to exclude gifts that aren't saved to the account's profile page */
1428
+ exclude_unsaved?: boolean;
1429
+ /** Pass True to exclude gifts that are saved to the account's profile page */
1430
+ exclude_saved?: boolean;
1431
+ /** Pass True to exclude gifts that can be purchased an unlimited number of times */
1432
+ exclude_unlimited?: boolean;
1433
+ /** Pass True to exclude gifts that can be purchased a limited number of times */
1434
+ exclude_limited?: boolean;
1435
+ /** Pass True to exclude unique gifts */
1436
+ exclude_unique?: boolean;
1437
+ /** Pass True to sort results by gift price instead of send date. Sorting is applied before pagination. */
1438
+ sort_by_price?: boolean;
1439
+ /** Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results */
1440
+ offset?: string;
1441
+ /** The maximum number of gifts to be returned; 1-100. Defaults to 100 */
1442
+ limit?: number;
1443
+ }): OwnedGifts;
1444
+ /** Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success. */
1445
+ convertGiftToStars(args: {
1446
+ /** Unique identifier of the business connection */
1447
+ business_connection_id: string;
1448
+ /** Unique identifier of the regular gift that should be converted to Telegram Stars */
1449
+ owned_gift_id: string;
1450
+ }): true;
1451
+ /** Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success. */
1452
+ upgradeGift(args: {
1453
+ /** Unique identifier of the business connection */
1454
+ business_connection_id: string;
1455
+ /** Unique identifier of the regular gift that should be upgraded to a unique one */
1456
+ owned_gift_id: string;
1457
+ /** Pass True to keep the original gift text, sender and receiver in the upgraded gift */
1458
+ keep_original_details?: boolean;
1459
+ /** The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed. */
1460
+ star_count?: number;
1461
+ }): true;
1462
+ /** Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success. */
1463
+ transferGift(args: {
1464
+ /** Unique identifier of the business connection */
1465
+ business_connection_id: string;
1466
+ /** Unique identifier of the regular gift that should be transferred */
1467
+ owned_gift_id: string;
1468
+ /** Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours. */
1469
+ new_owner_chat_id: number;
1470
+ /** The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required. */
1471
+ star_count: number;
1472
+ }): true;
1473
+ /** Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success. */
1474
+ postStory(args: {
1475
+ /** Unique identifier of the business connection */
1476
+ business_connection_id: string;
1477
+ /** Content of the story */
1478
+ content: InputStoryContent<F>;
1479
+ /** Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 */
1480
+ active_period: number;
1481
+ /** Caption of the story, 0-2048 characters after entities parsing */
1482
+ caption?: string;
1483
+ /** Mode for parsing entities in the story caption. See formatting options for more details. */
1484
+ parse_mode?: ParseMode;
1485
+ /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
1486
+ caption_entities?: MessageEntity[];
1487
+ /** A list of clickable areas to be shown on the story */
1488
+ areas?: StoryArea[];
1489
+ /** Pass True to keep the story accessible after it expires */
1490
+ post_to_chat_page?: boolean;
1491
+ /** Pass True if the content of the story must be protected from forwarding and screenshotting */
1492
+ protect_content?: boolean;
1493
+ }): Story;
1494
+ /** Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success. */
1495
+ editStory(args: {
1496
+ /** Unique identifier of the business connection */
1497
+ business_connection_id: string;
1498
+ /** Unique identifier of the story to edit */
1499
+ story_id: number;
1500
+ /** Content of the story */
1501
+ content: InputStoryContent<F>;
1502
+ /** Caption of the story, 0-2048 characters after entities parsing */
1503
+ caption?: string;
1504
+ /** Mode for parsing entities in the story caption. See formatting options for more details. */
1505
+ parse_mode?: ParseMode;
1506
+ /** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
1507
+ caption_entities?: MessageEntity[];
1508
+ /** A list of clickable areas to be shown on the story */
1509
+ areas?: StoryArea;
1510
+ }): Story;
1511
+ /** Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success. */
1512
+ deleteStory(args: {
1513
+ /** Unique identifier of the business connection */
1514
+ business_connection_id: string;
1515
+ /** Unique identifier of the story to delete */
1516
+ story_id: number;
1517
+ }): true;
1355
1518
  /** Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned. */
1356
1519
  sendSticker(args: {
1357
1520
  /** Unique identifier of the business connection on behalf of which the message will be sent */
@@ -1508,13 +1671,28 @@ export type ApiMethods<F> = {
1508
1671
  gift_id: string;
1509
1672
  /** Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver */
1510
1673
  pay_for_upgrade?: boolean;
1511
- /** Text that will be shown along with the gift; 0-255 characters */
1674
+ /** Text that will be shown along with the gift; 0-128 characters */
1512
1675
  text?: string;
1513
1676
  /** Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1514
1677
  text_parse_mode?: ParseMode;
1515
1678
  /** A list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1516
1679
  text_entities?: MessageEntity[];
1517
1680
  }): Gifts;
1681
+ /** Gifts a Telegram Premium subscription to the given user. Returns True on success. */
1682
+ giftPremiumSubscription(args: {
1683
+ /** Unique identifier of the target user who will receive a Telegram Premium subscription */
1684
+ user_id: number;
1685
+ /** Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12 */
1686
+ month_count: 3 | 6 | 12;
1687
+ /** Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months */
1688
+ star_count: 1000 | 1500 | 2500;
1689
+ /** Text that will be shown along with the service message about the subscription; 0-128 characters */
1690
+ text?: string;
1691
+ /** Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1692
+ text_parse_mode?: ParseMode;
1693
+ /** A list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored. */
1694
+ text_entities?: MessageEntity[];
1695
+ }): true;
1518
1696
  /** Use this method to send answers to an inline query. On success, True is returned.
1519
1697
  No more than 50 results per query are allowed.
1520
1698
 
@@ -1732,6 +1910,15 @@ export type ApiMethods<F> = {
1732
1910
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
1733
1911
  chat_id: number | string;
1734
1912
  }): true;
1913
+ /** Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success. */
1914
+ readBusinessMessage(args: {
1915
+ /** Unique identifier of the business connection on behalf of which to read the message */
1916
+ business_connection_id: string;
1917
+ /** Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours. */
1918
+ chat_id: number;
1919
+ /** Unique identifier of the message to mark as read */
1920
+ message_id: number;
1921
+ }): true;
1735
1922
  /** Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1736
1923
 
1737
1924
  Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. */
@@ -1961,4 +2148,50 @@ export interface InputPaidMediaVideo<F> {
1961
2148
  /** Pass True if the uploaded video is suitable for streaming */
1962
2149
  supports_streaming?: boolean;
1963
2150
  }
2151
+ /** This object describes a profile photo to set. Currently, it can be one of
2152
+
2153
+ - InputProfilePhotoStatic
2154
+ - InputProfilePhotoAnimated */
2155
+ export type InputProfilePhoto<F> = InputProfilePhotoStatic<F> | InputProfilePhotoAnimated<F>;
2156
+ /** A static profile photo in the .JPG format. */
2157
+ export interface InputProfilePhotoStatic<F> {
2158
+ /** Type of the profile photo, must be “static” */
2159
+ type: "static";
2160
+ /** The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » */
2161
+ photo: F;
2162
+ }
2163
+ /** An animated profile photo in the MPEG4 format. */
2164
+ export interface InputProfilePhotoAnimated<F> {
2165
+ /** Type of the profile photo, must be “animated” */
2166
+ type: "animated";
2167
+ /** The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » */
2168
+ animation: F;
2169
+ /** Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0. */
2170
+ main_frame_timestamp?: number;
2171
+ }
2172
+ /** This object describes the content of a story to post. Currently, it can be one of
2173
+
2174
+ - InputStoryContentPhoto
2175
+ - InputStoryContentVideo */
2176
+ export type InputStoryContent<F> = InputStoryContentPhoto<F> | InputStoryContentVideo<F>;
2177
+ /** Describes a photo to post as a story. */
2178
+ export interface InputStoryContentPhoto<F> {
2179
+ /** Type of the content, must be “photo” */
2180
+ type: "photo";
2181
+ /** The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » */
2182
+ photo: F;
2183
+ }
2184
+ /** Describes a video to post as a story. */
2185
+ export interface InputStoryContentVideo<F> {
2186
+ /** Type of the content, must be “video” */
2187
+ type: "video";
2188
+ /** The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the video was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » */
2189
+ video: F;
2190
+ /** Precise duration of the video in seconds; 0-60 */
2191
+ duration?: number;
2192
+ /** Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0. */
2193
+ cover_frame_timestamp?: number;
2194
+ /** Pass True if the video has no sound */
2195
+ is_animation?: boolean;
2196
+ }
1964
2197
  export {};
package/mod.d.ts CHANGED
@@ -7,5 +7,6 @@ export * from "./methods.js";
7
7
  export * from "./passport.js";
8
8
  export * from "./payment.js";
9
9
  export * from "./settings.js";
10
+ export * from "./story.js";
10
11
  export * from "./update.js";
11
12
  export * from "./langs.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {
package/payment.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Chat, User } from "./manage.js";
2
- import type { PaidMedia, Sticker } from "./message.js";
2
+ import type { MessageEntity, PaidMedia, Sticker } from "./message.js";
3
3
  /** This object represents a portion of the price for goods or services. */
4
4
  export interface LabeledPrice {
5
5
  /** Portion label */
@@ -171,20 +171,24 @@ export type TransactionPartner = TransactionPartnerUser | TransactionPartnerChat
171
171
  export interface TransactionPartnerUser {
172
172
  /** Type of the transaction partner, always “user” */
173
173
  type: "user";
174
+ /** Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts */
175
+ transaction_type: "invoice_payment" | "paid_media_payment" | "gift_purchase" | "premium_purchase" | "business_account_transfer";
174
176
  /** Information about the user */
175
177
  user: User;
176
- /** Information about the affiliate that received a commission via this transaction */
178
+ /** Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */
177
179
  affiliate?: AffiliateInfo;
178
- /** Bot-specified invoice payload */
180
+ /** Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. */
179
181
  invoice_payload?: string;
180
- /** The duration of the paid subscription */
182
+ /** The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */
181
183
  subscription_period?: number;
182
- /** Information about the paid media bought by the user */
184
+ /** Information about the paid media bought by the user; for “paid_media_payment” transactions only */
183
185
  paid_media?: PaidMedia[];
184
- /** Bot-specified paid media payload */
186
+ /** Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. */
185
187
  paid_media_payload?: string;
186
- /** The gift sent to the user by the bot */
188
+ /** The gift sent to the user by the bot; for “gift_purchase” transactions only */
187
189
  gift?: Gift;
190
+ /** Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only */
191
+ premium_subscription_duration?: number;
188
192
  }
189
193
  /** Describes a transaction with a chat. */
190
194
  export interface TransactionPartnerChat {
@@ -275,3 +279,160 @@ export interface Gifts {
275
279
  /** The list of gifts */
276
280
  gifts: Gift[];
277
281
  }
282
+ /** This object describes the model of a unique gift. */
283
+ export interface UniqueGiftModel {
284
+ /** Name of the model */
285
+ name: string;
286
+ /** The sticker that represents the unique gift */
287
+ sticker: Sticker;
288
+ /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
289
+ rarity_per_mille: number;
290
+ }
291
+ /** This object describes the symbol shown on the pattern of a unique gift. */
292
+ export interface UniqueGiftSymbol {
293
+ /** Name of the symbol */
294
+ name: string;
295
+ /** The sticker that represents the unique gift */
296
+ sticker: Sticker;
297
+ /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
298
+ rarity_per_mille: number;
299
+ }
300
+ /** This object describes the colors of the backdrop of a unique gift. */
301
+ export interface UniqueGiftBackdropColors {
302
+ /** The color in the center of the backdrop in RGB format */
303
+ center_color: number;
304
+ /** The color on the edges of the backdrop in RGB format */
305
+ edge_color: number;
306
+ /** The color to be applied to the symbol in RGB format */
307
+ symbol_color: number;
308
+ /** The color for the text on the backdrop in RGB format */
309
+ text_color: number;
310
+ }
311
+ /** This object describes the backdrop of a unique gift. */
312
+ export interface UniqueGiftBackdrop {
313
+ /** Name of the backdrop */
314
+ name: string;
315
+ /** Colors of the backdrop */
316
+ colors: UniqueGiftBackdropColors;
317
+ /** The number of unique gifts that receive this backdrop for every 1000 gifts upgraded */
318
+ rarity_per_mille: number;
319
+ }
320
+ /** This object describes a unique gift that was upgraded from a regular gift. */
321
+ export interface UniqueGift {
322
+ /** Human-readable name of the regular gift from which this unique gift was upgraded */
323
+ base_name: string;
324
+ /** Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas */
325
+ name: string;
326
+ /** Unique number of the upgraded gift among gifts upgraded from the same regular gift */
327
+ number: number;
328
+ /** Model of the gift */
329
+ model: UniqueGiftModel;
330
+ /** Symbol of the gift */
331
+ symbol: UniqueGiftSymbol;
332
+ /** Backdrop of the gift */
333
+ backdrop: UniqueGiftBackdrop;
334
+ }
335
+ /** Describes a service message about a regular gift that was sent or received. */
336
+ export interface GiftInfo {
337
+ /** Information about the gift */
338
+ gift: Gift;
339
+ /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
340
+ owned_gift_id?: string;
341
+ /** Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible */
342
+ convert_star_count?: number;
343
+ /** Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift */
344
+ prepaid_upgrade_star_count?: number;
345
+ /** True, if the gift can be upgraded to a unique gift */
346
+ can_be_upgraded?: true;
347
+ /** Text of the message that was added to the gift */
348
+ text?: string;
349
+ /** Special entities that appear in the text */
350
+ entities?: MessageEntity[];
351
+ /** True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */
352
+ is_private?: true;
353
+ }
354
+ /** Describes a service message about a unique gift that was sent or received. */
355
+ export interface UniqueGiftInfo {
356
+ /** Information about the gift */
357
+ gift: UniqueGift;
358
+ /** Origin of the gift. Currently, either “upgrade” or “transfer” */
359
+ origin: "upgrade" | "transfer";
360
+ /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
361
+ owned_gift_id?: string;
362
+ /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
363
+ transfer_star_count?: number;
364
+ }
365
+ /** Describes a service message about a change in the price of paid messages within a chat. */
366
+ export interface PaidMessagePriceChanged {
367
+ /** The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message */
368
+ paid_message_star_count: number;
369
+ }
370
+ /** Describes an amount of Telegram Stars. */
371
+ export interface StarAmount {
372
+ /** Integer amount of Telegram Stars, rounded to 0; can be negative */
373
+ amount: number;
374
+ /** The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive */
375
+ nanostar_amount?: number;
376
+ }
377
+ /** This object describes a gift received and owned by a user or a chat. Currently, it can be one of
378
+
379
+ - OwnedGiftRegular
380
+ - OwnedGiftUnique */
381
+ export type OwnedGift = OwnedGiftRegular | OwnedGiftUnique;
382
+ /** Describes a regular gift owned by a user or a chat. */
383
+ export interface OwnedGiftRegular {
384
+ /** Type of the gift, always “regular” */
385
+ type: "regular";
386
+ /** Information about the regular gift */
387
+ gift: Gift;
388
+ /** Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only */
389
+ owned_gift_id?: string;
390
+ /** Sender of the gift if it is a known user */
391
+ sender_user?: User;
392
+ /** Date the gift was sent in Unix time */
393
+ send_date: number;
394
+ /** Text of the message that was added to the gift */
395
+ text?: string;
396
+ /** Special entities that appear in the text */
397
+ entities?: MessageEntity[];
398
+ /** True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */
399
+ is_private?: true;
400
+ /** True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */
401
+ is_saved?: true;
402
+ /** True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only */
403
+ can_be_upgraded?: true;
404
+ /** True, if the gift was refunded and isn't available anymore */
405
+ was_refunded?: true;
406
+ /** Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars */
407
+ convert_star_count?: number;
408
+ /** Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift */
409
+ prepaid_upgrade_star_count?: number;
410
+ }
411
+ /** Describes a unique gift received and owned by a user or a chat. */
412
+ export interface OwnedGiftUnique {
413
+ /** Type of the gift, always “unique” */
414
+ type: "unique";
415
+ /** Information about the unique gift */
416
+ gift: UniqueGift;
417
+ /** Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only */
418
+ owned_gift_id?: string;
419
+ /** Sender of the gift if it is a known user */
420
+ sender_user?: User;
421
+ /** Date the gift was sent in Unix time */
422
+ send_date: number;
423
+ /** True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */
424
+ is_saved?: true;
425
+ /** True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only */
426
+ can_be_transferred?: true;
427
+ /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
428
+ transfer_star_count?: number;
429
+ }
430
+ /** Contains the list of gifts received and owned by a user or a chat. */
431
+ export interface OwnedGifts {
432
+ /** The total number of gifts owned by the user or the chat */
433
+ total_count: number;
434
+ /** The list of gifts */
435
+ gifts: OwnedGift[];
436
+ /** Offset for the next request. If empty, then there are no more results */
437
+ next_offset?: string;
438
+ }
package/story.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import type { ReactionType } from "./message.js";
2
+ /** Describes the position of a clickable area within a story. */
3
+ export interface StoryAreaPosition {
4
+ /** The abscissa of the area's center, as a percentage of the media width */
5
+ x_percentage: number;
6
+ /** The ordinate of the area's center, as a percentage of the media height */
7
+ y_percentage: number;
8
+ /** The width of the area's rectangle, as a percentage of the media width */
9
+ width_percentage: number;
10
+ /** The height of the area's rectangle, as a percentage of the media height */
11
+ height_percentage: number;
12
+ /** The clockwise rotation angle of the rectangle, in degrees; 0-360 */
13
+ rotation_angle: number;
14
+ /** The radius of the rectangle corner rounding, as a percentage of the media width */
15
+ corner_radius_percentage: number;
16
+ }
17
+ /** Describes the physical address of a location. */
18
+ export interface LocationAddress {
19
+ /** The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located */
20
+ country_code: string;
21
+ /** State of the location */
22
+ state?: string;
23
+ /** City of the location */
24
+ city?: string;
25
+ /** Street address of the location */
26
+ street?: string;
27
+ }
28
+ /** Describes the type of a clickable area on a story. Currently, it can be one of
29
+
30
+ - StoryAreaTypeLocation
31
+ - StoryAreaTypeSuggestedReaction
32
+ - StoryAreaTypeLink
33
+ - StoryAreaTypeWeather
34
+ - StoryAreaTypeUniqueGift */
35
+ export type StoryAreaType = StoryAreaTypeLocation | StoryAreaTypeSuggestedReaction | StoryAreaTypeLink | StoryAreaTypeWeather | StoryAreaTypeUniqueGift;
36
+ /** Describes a story area pointing to a location. Currently, a story can have up to 10 location areas. */
37
+ export interface StoryAreaTypeLocation {
38
+ /** Type of the area, always “location” */
39
+ type: "location";
40
+ /** Location latitude in degrees */
41
+ latitude: number;
42
+ /** Location longitude in degrees */
43
+ longitude: number;
44
+ /** Address of the location */
45
+ address?: LocationAddress;
46
+ }
47
+ /** Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas. */
48
+ export interface StoryAreaTypeSuggestedReaction {
49
+ /** Type of the area, always “suggested_reaction” */
50
+ type: "suggested_reaction";
51
+ /** Type of the reaction */
52
+ reaction_type: ReactionType;
53
+ /** Pass True if the reaction area has a dark background */
54
+ is_dark?: boolean;
55
+ /** Pass True if reaction area corner is flipped */
56
+ is_flipped?: boolean;
57
+ }
58
+ /** Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas. */
59
+ export interface StoryAreaTypeLink {
60
+ /** Type of the area, always “link” */
61
+ type: "link";
62
+ /** HTTP or tg:// URL to be opened when the area is clicked */
63
+ url: string;
64
+ }
65
+ /** Describes a story area containing weather information. Currently, a story can have up to 3 weather areas. */
66
+ export interface StoryAreaTypeWeather {
67
+ /** Type of the area, always “weather” */
68
+ type: "weather";
69
+ /** Temperature, in degree Celsius */
70
+ temperature: number;
71
+ /** Emoji representing the weather */
72
+ emoji: string;
73
+ /** A color of the area background in the ARGB format */
74
+ background_color: number;
75
+ }
76
+ /** Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area. */
77
+ export interface StoryAreaTypeUniqueGift {
78
+ /** Type of the area, always “unique_gift” */
79
+ type: "unique_gift";
80
+ /** Unique name of the gift */
81
+ name: string;
82
+ }
83
+ /** Describes a clickable area on a story media. */
84
+ export interface StoryArea {
85
+ /** Position of the area */
86
+ position: StoryAreaPosition;
87
+ /** Type of the area */
88
+ type: StoryAreaType;
89
+ }