@grammyjs/types 3.12.0 → 3.14.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/inline.d.ts CHANGED
@@ -621,7 +621,7 @@ export interface InputInvoiceMessageContent {
621
621
  title: string;
622
622
  /** Product description, 1-255 characters */
623
623
  description: string;
624
- /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
624
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. */
625
625
  payload: string;
626
626
  /** Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. */
627
627
  provider_token?: string;
package/manage.d.ts CHANGED
@@ -535,6 +535,10 @@ export interface ChatInviteLink {
535
535
  member_limit?: number;
536
536
  /** Number of pending join requests created using this link */
537
537
  pending_join_request_count?: number;
538
+ /** The number of seconds the subscription will be active for before the next payment */
539
+ subscription_period?: number;
540
+ /** The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link */
541
+ subscription_price?: number;
538
542
  }
539
543
  /** Represents the rights of an administrator in a chat. */
540
544
  export interface ChatAdministratorRights {
@@ -654,6 +658,8 @@ export interface ChatMemberMember {
654
658
  status: "member";
655
659
  /** Information about the user */
656
660
  user: User;
661
+ /** Date when the user's subscription will expire; Unix time */
662
+ until_date?: number;
657
663
  }
658
664
  /** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
659
665
  export interface ChatMemberRestricted {
@@ -840,14 +846,16 @@ export interface ChatBoostSourceGiftCode {
840
846
  /** User for which the gift code was created */
841
847
  user: User;
842
848
  }
843
- /** The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
849
+ /** The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways. */
844
850
  export interface ChatBoostSourceGiveaway {
845
851
  /** Source of the boost, always “giveaway” */
846
852
  source: "giveaway";
847
853
  /** Identifier of a message in the chat with the giveaway; the message could have been deleted already */
848
854
  giveaway_message_id: number;
849
- /** User that won the prize in the giveaway if any */
855
+ /** User that won the prize in the giveaway if any; for Telegram Premium giveaways only */
850
856
  user?: User;
857
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
858
+ prize_star_count?: number;
851
859
  /** True, if the giveaway was completed, but there was no user to win the prize */
852
860
  is_unclaimed?: true;
853
861
  }
package/message.d.ts CHANGED
@@ -9,9 +9,9 @@ export declare namespace Message {
9
9
  message_id: number;
10
10
  /** Unique identifier of a message thread or a forum topic to which the message belongs; for supergroups only */
11
11
  message_thread_id?: number;
12
- /** Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
12
+ /** Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats */
13
13
  from?: User;
14
- /** Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */
14
+ /** Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. */
15
15
  sender_chat?: Chat;
16
16
  /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
17
17
  date: number;
@@ -129,6 +129,7 @@ export declare namespace Message {
129
129
  type ReplyMessage = Message & {
130
130
  reply_to_message: undefined;
131
131
  };
132
+ /** This object represents a message. */
132
133
  export interface Message extends Message.MediaMessage {
133
134
  /** For text messages, the actual UTF-8 text of the message */
134
135
  text?: string;
@@ -1019,8 +1020,10 @@ export interface VideoChatParticipantsInvited {
1019
1020
  /** New members that were invited to the video chat */
1020
1021
  users: User[];
1021
1022
  }
1022
- /** This object represents a service message about the creation of a scheduled giveaway. Currently holds no information. */
1023
+ /** This object represents a service message about the creation of a scheduled giveaway. */
1023
1024
  export interface GiveawayCreated {
1025
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
1026
+ prize_star_count?: number;
1024
1027
  }
1025
1028
  /** This object represents a message about a scheduled giveaway. */
1026
1029
  export interface Giveaway {
@@ -1038,7 +1041,9 @@ export interface Giveaway {
1038
1041
  prize_description?: string;
1039
1042
  /** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. */
1040
1043
  country_codes?: string[];
1041
- /** The number of months the Telegram Premium subscription won from the giveaway will be active for */
1044
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
1045
+ prize_star_count?: number;
1046
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */
1042
1047
  premium_subscription_month_count?: number;
1043
1048
  }
1044
1049
  /** This object represents a message about the completion of a giveaway with public winners. */
@@ -1055,7 +1060,9 @@ export interface GiveawayWinners {
1055
1060
  winners: User[];
1056
1061
  /** The number of other chats the user had to join in order to be eligible for the giveaway */
1057
1062
  additional_chat_count?: number;
1058
- /** The number of months the Telegram Premium subscription won from the giveaway will be active for */
1063
+ /** The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only */
1064
+ prize_star_count?: number;
1065
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */
1059
1066
  premium_subscription_month_count?: number;
1060
1067
  /** Number of undistributed prizes */
1061
1068
  unclaimed_prize_count?: number;
@@ -1074,6 +1081,8 @@ export interface GiveawayCompleted {
1074
1081
  unclaimed_prize_count?: number;
1075
1082
  /** Message with the giveaway that was completed, if it wasn't deleted */
1076
1083
  giveaway_message?: Message;
1084
+ /** True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. */
1085
+ is_star_giveaway?: true;
1077
1086
  }
1078
1087
  /** Describes the options used for link preview generation. */
1079
1088
  export interface LinkPreviewOptions {
@@ -1181,8 +1190,9 @@ export interface File {
1181
1190
  /** This object describes the type of a reaction. Currently, it can be one of
1182
1191
 
1183
1192
  - ReactionTypeEmoji
1184
- - ReactionTypeCustomEmoji */
1185
- export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji;
1193
+ - ReactionTypeCustomEmoji
1194
+ - ReactionTypePaid */
1195
+ export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji | ReactionTypePaid;
1186
1196
  /** The reaction is based on an emoji. */
1187
1197
  export interface ReactionTypeEmoji {
1188
1198
  /** Type of the reaction, always “emoji” */
@@ -1197,6 +1207,11 @@ export interface ReactionTypeCustomEmoji {
1197
1207
  /** Custom emoji identifier */
1198
1208
  custom_emoji_id: string;
1199
1209
  }
1210
+ /** The reaction is paid. */
1211
+ export interface ReactionTypePaid {
1212
+ /** Type of the reaction, always “paid” */
1213
+ type: "paid";
1214
+ }
1200
1215
  /** Represents a reaction added to a message along with the number of times it was added. */
1201
1216
  export interface ReactionCount {
1202
1217
  /** Type of the reaction */
package/methods.d.ts CHANGED
@@ -521,14 +521,18 @@ export type ApiMethods<F> = {
521
521
  /** An object for a new inline keyboard. */
522
522
  reply_markup?: InlineKeyboardMarkup;
523
523
  }): (Update.Edited & Message.LocationMessage) | true;
524
- /** Use this method to send paid media to channel chats. On success, the sent Message is returned. */
524
+ /** Use this method to send paid media. On success, the sent Message is returned. */
525
525
  sendPaidMedia(args: {
526
- /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
526
+ /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
527
+ business_connection_id?: string;
528
+ /** Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance. */
527
529
  chat_id: number | string;
528
- /** The number of Telegram Stars that must be paid to buy access to the media */
530
+ /** The number of Telegram Stars that must be paid to buy access to the media; 1-2500 */
529
531
  star_count: number;
530
532
  /** An array describing the media to be sent; up to 10 items */
531
533
  media: InputPaidMedia<F>[];
534
+ /** Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. */
535
+ payload?: string;
532
536
  /** Media caption, 0-1024 characters after entities parsing */
533
537
  caption?: string;
534
538
  /** Mode for parsing entities in the media caption. See formatting options for more details. */
@@ -670,7 +674,7 @@ export type ApiMethods<F> = {
670
674
  /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
671
675
  message_thread_id?: number;
672
676
  /** Emoji on which the dice throw animation is based. Currently, must be one of "🎲", "🎯", "🏀", "⚽", "🎳", or "🎰". Dice can have values 1-6 for "🎲", "🎯" and "🎳", values 1-5 for "🏀" and "⚽", and values 1-64 for "🎰". Defaults to "🎲" */
673
- emoji?: string;
677
+ emoji?: (string & Record<never, never>) | "🎲" | "🎯" | "🏀" | "⚽" | "🎳" | "🎰";
674
678
  /** Sends the message silently. Users will receive a notification with no sound. */
675
679
  disable_notification?: boolean;
676
680
  /** Protects the contents of the sent message from forwarding */
@@ -699,13 +703,13 @@ export type ApiMethods<F> = {
699
703
  /** Unique identifier for the target message thread; for supergroups only */
700
704
  message_thread_id?: number;
701
705
  }): true;
702
- /** Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. In albums, bots must react to the first message. Returns True on success. */
706
+ /** Use this method to change the chosen reactions on a message. Service messages can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success. */
703
707
  setMessageReaction(args: {
704
708
  /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
705
709
  chat_id: number | string;
706
710
  /** Identifier of the target message */
707
711
  message_id: number;
708
- /** A list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. */
712
+ /** A list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots. */
709
713
  reaction?: ReactionType[];
710
714
  /** Pass True to set the reaction with a big animation */
711
715
  is_big?: boolean;
@@ -866,6 +870,26 @@ export type ApiMethods<F> = {
866
870
  /** True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified */
867
871
  creates_join_request?: boolean;
868
872
  }): ChatInviteLink;
873
+ /** Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object. */
874
+ createChatSubscriptionInviteLink(args: {
875
+ /** Unique identifier for the target channel chat or username of the target channel (in the format @channelusername) */
876
+ chat_id: number | string;
877
+ /** Invite link name; 0-32 characters */
878
+ name?: string;
879
+ /** The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days). */
880
+ subscription_period: number;
881
+ /** The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500 */
882
+ subscription_price: number;
883
+ }): ChatInviteLink;
884
+ /** Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object. */
885
+ editChatSubscriptionInviteLink(args: {
886
+ /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
887
+ chat_id: number | string;
888
+ /** The invite link to edit */
889
+ invite_link: string;
890
+ /** Invite link name; 0-32 characters */
891
+ name?: string;
892
+ }): ChatInviteLink;
869
893
  /** Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object. */
870
894
  revokeChatInviteLink(args: {
871
895
  /** Unique identifier of the target chat or username of the target channel (in the format @channelusername) */
@@ -993,7 +1017,7 @@ export type ApiMethods<F> = {
993
1017
  /** Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. */
994
1018
  icon_custom_emoji_id?: string;
995
1019
  }): ForumTopic;
996
- /** Use this method to edit name and icon of a 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, unless it is the creator of the topic. Returns True on success. */
1020
+ /** Use this method to edit name and icon of a 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. */
997
1021
  editForumTopic(args: {
998
1022
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
999
1023
  chat_id: number | string;
@@ -1032,7 +1056,7 @@ export type ApiMethods<F> = {
1032
1056
  /** Unique identifier for the target message thread of the forum topic */
1033
1057
  message_thread_id: number;
1034
1058
  }): true;
1035
- /** 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. */
1059
+ /** 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 the can_manage_topics administrator rights. Returns True on success. */
1036
1060
  editGeneralForumTopic(args: {
1037
1061
  /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1038
1062
  chat_id: number | string;
@@ -1457,7 +1481,7 @@ export type ApiMethods<F> = {
1457
1481
  title: string;
1458
1482
  /** Product description, 1-255 characters */
1459
1483
  description: string;
1460
- /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
1484
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. */
1461
1485
  payload: string;
1462
1486
  /** Payment provider token, obtained via BotFather. Pass an empty string for payments in Telegram Stars. */
1463
1487
  provider_token?: string;
@@ -1514,7 +1538,7 @@ export type ApiMethods<F> = {
1514
1538
  title: string;
1515
1539
  /** Product description, 1-255 characters */
1516
1540
  description: string;
1517
- /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */
1541
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. */
1518
1542
  payload: string;
1519
1543
  /** Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. */
1520
1544
  provider_token?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.12.0",
3
+ "version": "3.14.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,4 +1,5 @@
1
1
  import type { User } from "./manage.js";
2
+ import type { PaidMedia } from "./message.js";
2
3
  /** This object represents a portion of the price for goods or services. */
3
4
  export interface LabeledPrice {
4
5
  /** Portion label */
@@ -152,6 +153,10 @@ export interface TransactionPartnerUser {
152
153
  user: User;
153
154
  /** Bot-specified invoice payload */
154
155
  invoice_payload?: string;
156
+ /** Information about the paid media bought by the user */
157
+ paid_media?: PaidMedia[];
158
+ /** Bot-specified paid media payload */
159
+ paid_media_payload?: string;
155
160
  }
156
161
  /** Describes a withdrawal transaction with Fragment. */
157
162
  export interface TransactionPartnerFragment {
@@ -188,3 +193,10 @@ export interface StarTransactions {
188
193
  /** The list of transactions */
189
194
  transactions: StarTransaction[];
190
195
  }
196
+ /** This object contains information about a paid media purchase. */
197
+ export interface PaidMediaPurchased {
198
+ /** User who purchased the media */
199
+ from: User;
200
+ /** Bot-specified paid media payload */
201
+ paid_media_payload: string;
202
+ }
package/update.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { ChosenInlineResult, InlineQuery } from "./inline.js";
2
2
  import type { BusinessConnection, BusinessMessagesDeleted, Chat, ChatBoostRemoved, ChatBoostUpdated, ChatJoinRequest, ChatMemberUpdated, User } from "./manage.js";
3
3
  import type { CallbackQuery } from "./markup.js";
4
4
  import type { Message, MessageReactionCountUpdated, MessageReactionUpdated, Poll, PollAnswer } from "./message.js";
5
- import type { PreCheckoutQuery, ShippingQuery } from "./payment.js";
5
+ import type { PaidMediaPurchased, PreCheckoutQuery, ShippingQuery } from "./payment.js";
6
6
  /** Internal namespace used to make some message types more accurate */
7
7
  export declare namespace Update {
8
8
  /** Internal type holding properties that message updates in private chats share. */
@@ -73,4 +73,6 @@ export interface Update {
73
73
  chat_boost?: ChatBoostUpdated;
74
74
  /** A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */
75
75
  removed_chat_boost?: ChatBoostRemoved;
76
+ /** A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat */
77
+ purchased_paid_media?: PaidMediaPurchased;
76
78
  }