@grammyjs/types 3.9.0 → 3.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/manage.d.ts +8 -0
- package/message.d.ts +48 -2
- package/methods.d.ts +56 -2
- package/package.json +1 -1
- package/payment.d.ts +29 -8
- package/settings.d.ts +1 -1
package/manage.d.ts
CHANGED
|
@@ -214,6 +214,8 @@ export declare namespace ChatFullInfo {
|
|
|
214
214
|
linked_chat_id?: undefined;
|
|
215
215
|
/** For supergroups, the location to which the supergroup is connected */
|
|
216
216
|
location?: undefined;
|
|
217
|
+
/** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
|
|
218
|
+
can_send_paid_media?: undefined;
|
|
217
219
|
}
|
|
218
220
|
/** Internal type for group chats */
|
|
219
221
|
interface GroupChat {
|
|
@@ -303,6 +305,8 @@ export declare namespace ChatFullInfo {
|
|
|
303
305
|
linked_chat_id?: undefined;
|
|
304
306
|
/** For supergroups, the location to which the supergroup is connected */
|
|
305
307
|
location?: undefined;
|
|
308
|
+
/** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
|
|
309
|
+
can_send_paid_media?: undefined;
|
|
306
310
|
}
|
|
307
311
|
/** Internal type for supergroup chats */
|
|
308
312
|
interface SupergroupChat {
|
|
@@ -392,6 +396,8 @@ export declare namespace ChatFullInfo {
|
|
|
392
396
|
linked_chat_id?: number;
|
|
393
397
|
/** For supergroups, the location to which the supergroup is connected */
|
|
394
398
|
location?: ChatLocation;
|
|
399
|
+
/** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
|
|
400
|
+
can_send_paid_media?: undefined;
|
|
395
401
|
}
|
|
396
402
|
/** Internal type for channel chats */
|
|
397
403
|
interface ChannelChat {
|
|
@@ -481,6 +487,8 @@ export declare namespace ChatFullInfo {
|
|
|
481
487
|
linked_chat_id?: number;
|
|
482
488
|
/** For supergroups, the location to which the supergroup is connected */
|
|
483
489
|
location?: undefined;
|
|
490
|
+
/** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
|
|
491
|
+
can_send_paid_media?: true;
|
|
484
492
|
}
|
|
485
493
|
}
|
|
486
494
|
/** This object contains full information about a chat. */
|
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, SuccessfulPayment } from "./payment.js";
|
|
4
|
+
import type { Invoice, RefundedPayment, SuccessfulPayment } 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 {
|
|
@@ -84,8 +84,9 @@ export declare namespace Message {
|
|
|
84
84
|
type DiceMessage = CommonMessage & MsgWith<"dice">;
|
|
85
85
|
type GameMessage = CommonMessage & MsgWith<"game">;
|
|
86
86
|
type PollMessage = CommonMessage & MsgWith<"poll">;
|
|
87
|
-
type LocationMessage = CommonMessage & MsgWith<"location">;
|
|
88
87
|
type VenueMessage = LocationMessage & MsgWith<"venue">;
|
|
88
|
+
type LocationMessage = CommonMessage & MsgWith<"location">;
|
|
89
|
+
type PaidMediaMessage = CommonMessage & MsgWith<"paid_media">;
|
|
89
90
|
type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
|
|
90
91
|
type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
|
|
91
92
|
type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
|
|
@@ -100,6 +101,7 @@ export declare namespace Message {
|
|
|
100
101
|
type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
|
|
101
102
|
type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
|
|
102
103
|
type SuccessfulPaymentMessage = ServiceMessage & MsgWith<"successful_payment">;
|
|
104
|
+
type RefundedPaymentMessage = ServiceMessage & MsgWith<"refunded_payment">;
|
|
103
105
|
type UsersSharedMessage = ServiceMessage & MsgWith<"users_shared">;
|
|
104
106
|
type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
|
|
105
107
|
type ConnectedWebsiteMessage = ServiceMessage & MsgWith<"connected_website">;
|
|
@@ -162,6 +164,8 @@ export interface Message extends Message.MediaMessage {
|
|
|
162
164
|
venue?: Venue;
|
|
163
165
|
/** Message is a shared location, information about the location */
|
|
164
166
|
location?: Location;
|
|
167
|
+
/** Message contains paid media; information about the paid media */
|
|
168
|
+
paid_media?: PaidMediaInfo;
|
|
165
169
|
/** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
|
|
166
170
|
new_chat_members?: User[];
|
|
167
171
|
/** A member was removed from the group, information about them (this member may be the bot itself) */
|
|
@@ -190,6 +194,8 @@ export interface Message extends Message.MediaMessage {
|
|
|
190
194
|
invoice?: Invoice;
|
|
191
195
|
/** Message is a service message about a successful payment, information about the payment. More about payments » */
|
|
192
196
|
successful_payment?: SuccessfulPayment;
|
|
197
|
+
/** Message is a service message about a refunded payment, information about the payment. More about payments » */
|
|
198
|
+
refunded_payment?: RefundedPayment;
|
|
193
199
|
/** Service message: users were shared with the bot */
|
|
194
200
|
users_shared?: UsersShared;
|
|
195
201
|
/** Service message: a chat was shared with the bot */
|
|
@@ -462,6 +468,8 @@ export interface ExternalReplyInfo {
|
|
|
462
468
|
invoice?: Invoice;
|
|
463
469
|
/** Message is a shared location, information about the location */
|
|
464
470
|
location?: Location;
|
|
471
|
+
/** Message contains paid media; information about the paid media */
|
|
472
|
+
paid_media?: PaidMediaInfo;
|
|
465
473
|
/** Message is a native poll, information about the poll */
|
|
466
474
|
poll?: Poll;
|
|
467
475
|
/** Message is a venue, information about the venue */
|
|
@@ -754,6 +762,44 @@ export interface Location {
|
|
|
754
762
|
/** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
|
|
755
763
|
proximity_alert_radius?: number;
|
|
756
764
|
}
|
|
765
|
+
/** Describes the paid media added to a message. */
|
|
766
|
+
export interface PaidMediaInfo {
|
|
767
|
+
/** The number of Telegram Stars that must be paid to buy access to the media */
|
|
768
|
+
star_count: number;
|
|
769
|
+
/** Information about the paid media */
|
|
770
|
+
paid_media: PaidMedia[];
|
|
771
|
+
}
|
|
772
|
+
/** This object describes paid media. Currently, it can be one of
|
|
773
|
+
|
|
774
|
+
- PaidMediaPreview
|
|
775
|
+
- PaidMediaPhoto
|
|
776
|
+
- PaidMediaVideo */
|
|
777
|
+
export type PaidMedia = PaidMediaPreview | PaidMediaPhoto | PaidMediaVideo;
|
|
778
|
+
/** The paid media isn't available before the payment. */
|
|
779
|
+
export interface PaidMediaPreview {
|
|
780
|
+
/** Type of the paid media, always “preview” */
|
|
781
|
+
type: "preview";
|
|
782
|
+
/** Media width as defined by the sender */
|
|
783
|
+
width?: number;
|
|
784
|
+
/** Media height as defined by the sender */
|
|
785
|
+
height?: number;
|
|
786
|
+
/** Duration of the media in seconds as defined by the sender */
|
|
787
|
+
duration?: number;
|
|
788
|
+
}
|
|
789
|
+
/** The paid media is a photo. */
|
|
790
|
+
export interface PaidMediaPhoto {
|
|
791
|
+
/** Type of the paid media, always “photo” */
|
|
792
|
+
type: "photo";
|
|
793
|
+
/** The photo */
|
|
794
|
+
photo: PhotoSize[];
|
|
795
|
+
}
|
|
796
|
+
/** The paid media is a video. */
|
|
797
|
+
export interface PaidMediaVideo {
|
|
798
|
+
/** Type of the paid media, always “video” */
|
|
799
|
+
type: "video";
|
|
800
|
+
/** The video */
|
|
801
|
+
video: Video;
|
|
802
|
+
}
|
|
757
803
|
/** This object represents a venue. */
|
|
758
804
|
export interface Venue {
|
|
759
805
|
/** Venue location. Can't be a live location */
|
package/methods.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export type ApiMethods<F> = {
|
|
|
133
133
|
/** Protects the contents of the forwarded messages from forwarding and saving */
|
|
134
134
|
protect_content?: boolean;
|
|
135
135
|
}): MessageId[];
|
|
136
|
-
/** Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */
|
|
136
|
+
/** Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. */
|
|
137
137
|
copyMessage(args: {
|
|
138
138
|
/** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
|
|
139
139
|
chat_id: number | string;
|
|
@@ -162,7 +162,7 @@ export type ApiMethods<F> = {
|
|
|
162
162
|
/** @deprecated Use `reply_parameters` instead. */
|
|
163
163
|
reply_to_message_id?: number;
|
|
164
164
|
}): MessageId;
|
|
165
|
-
/** Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. */
|
|
165
|
+
/** Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned. */
|
|
166
166
|
copyMessages(args: {
|
|
167
167
|
/** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
|
|
168
168
|
chat_id: number | string;
|
|
@@ -521,6 +521,31 @@ 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. */
|
|
525
|
+
sendPaidMedia(args: {
|
|
526
|
+
/** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */
|
|
527
|
+
chat_id: number | string;
|
|
528
|
+
/** The number of Telegram Stars that must be paid to buy access to the media */
|
|
529
|
+
star_count: number;
|
|
530
|
+
/** An array describing the media to be sent; up to 10 items */
|
|
531
|
+
media: InputPaidMedia<F>[];
|
|
532
|
+
/** Media caption, 0-1024 characters after entities parsing */
|
|
533
|
+
caption?: string;
|
|
534
|
+
/** Mode for parsing entities in the media caption. See formatting options for more details. */
|
|
535
|
+
parse_mode?: string;
|
|
536
|
+
/** A list of special entities that appear in the caption, which can be specified instead of parse_mode */
|
|
537
|
+
caption_entities?: MessageEntity[];
|
|
538
|
+
/** Pass True, if the caption must be shown above the message media */
|
|
539
|
+
show_caption_above_media?: boolean;
|
|
540
|
+
/** Sends the message silently. Users will receive a notification with no sound. */
|
|
541
|
+
disable_notification?: boolean;
|
|
542
|
+
/** Protects the contents of the sent message from forwarding and saving */
|
|
543
|
+
protect_content?: boolean;
|
|
544
|
+
/** Description of the message to reply to */
|
|
545
|
+
reply_parameters?: ReplyParameters;
|
|
546
|
+
/** Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user */
|
|
547
|
+
reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
548
|
+
}): Message.PaidMediaMessage;
|
|
524
549
|
/** Use this method to send information about a venue. On success, the sent Message is returned. */
|
|
525
550
|
sendVenue(args: {
|
|
526
551
|
/** Unique identifier of the business connection on behalf of which the message will be sent */
|
|
@@ -1746,4 +1771,33 @@ export interface InputMediaDocument<F> {
|
|
|
1746
1771
|
/** Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always true, if the document is sent as part of an album. */
|
|
1747
1772
|
disable_content_type_detection?: boolean;
|
|
1748
1773
|
}
|
|
1774
|
+
/** This object describes the paid media to be sent. Currently, it can be one of
|
|
1775
|
+
|
|
1776
|
+
- InputPaidMediaPhoto
|
|
1777
|
+
- InputPaidMediaVideo */
|
|
1778
|
+
export type InputPaidMedia<F> = InputMediaPhoto<F> | InputPaidMediaVideo<F>;
|
|
1779
|
+
/** The paid media to send is a photo. */
|
|
1780
|
+
export interface InputPaidMediaPhoto<F> {
|
|
1781
|
+
/** Type of the media, must be photo */
|
|
1782
|
+
type: "photo";
|
|
1783
|
+
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files » */
|
|
1784
|
+
media: F | string;
|
|
1785
|
+
}
|
|
1786
|
+
/** The paid media to send is a video. */
|
|
1787
|
+
export interface InputPaidMediaVideo<F> {
|
|
1788
|
+
/** Type of the media, must be video */
|
|
1789
|
+
type: "video";
|
|
1790
|
+
/** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files » */
|
|
1791
|
+
media: F | string;
|
|
1792
|
+
/** Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » */
|
|
1793
|
+
thumbnail?: F | string;
|
|
1794
|
+
/** Video width */
|
|
1795
|
+
width?: number;
|
|
1796
|
+
/** Video height */
|
|
1797
|
+
height?: number;
|
|
1798
|
+
/** Video duration in seconds */
|
|
1799
|
+
duration?: number;
|
|
1800
|
+
/** Pass True if the uploaded video is suitable for streaming */
|
|
1801
|
+
supports_streaming?: boolean;
|
|
1802
|
+
}
|
|
1749
1803
|
export {};
|
package/package.json
CHANGED
package/payment.d.ts
CHANGED
|
@@ -71,6 +71,19 @@ export interface SuccessfulPayment {
|
|
|
71
71
|
/** Provider payment identifier */
|
|
72
72
|
provider_payment_charge_id: string;
|
|
73
73
|
}
|
|
74
|
+
/** This object contains basic information about a refunded payment. */
|
|
75
|
+
export interface RefundedPayment {
|
|
76
|
+
/** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR” */
|
|
77
|
+
currency: string;
|
|
78
|
+
/** Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
|
|
79
|
+
total_amount: number;
|
|
80
|
+
/** Bot-specified invoice payload */
|
|
81
|
+
invoice_payload: string;
|
|
82
|
+
/** Telegram payment identifier */
|
|
83
|
+
telegram_payment_charge_id: string;
|
|
84
|
+
/** Provider payment identifier */
|
|
85
|
+
provider_payment_charge_id?: string;
|
|
86
|
+
}
|
|
74
87
|
/** This object contains information about an incoming shipping query. */
|
|
75
88
|
export interface ShippingQuery {
|
|
76
89
|
/** Unique query identifier */
|
|
@@ -126,10 +139,20 @@ export interface RevenueWithdrawalStateFailed {
|
|
|
126
139
|
}
|
|
127
140
|
/** This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
|
|
128
141
|
|
|
129
|
-
- TransactionPartnerFragment
|
|
130
142
|
- TransactionPartnerUser
|
|
143
|
+
- TransactionPartnerFragment
|
|
144
|
+
- TransactionPartnerTelegramAds
|
|
131
145
|
- TransactionPartnerOther */
|
|
132
|
-
export type TransactionPartner = TransactionPartnerFragment |
|
|
146
|
+
export type TransactionPartner = TransactionPartnerUser | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerOther;
|
|
147
|
+
/** Describes a transaction with a user. */
|
|
148
|
+
export interface TransactionPartnerUser {
|
|
149
|
+
/** Type of the transaction partner, always “user” */
|
|
150
|
+
type: "user";
|
|
151
|
+
/** Information about the user */
|
|
152
|
+
user: User;
|
|
153
|
+
/** Bot-specified invoice payload */
|
|
154
|
+
invoice_payload?: string;
|
|
155
|
+
}
|
|
133
156
|
/** Describes a withdrawal transaction with Fragment. */
|
|
134
157
|
export interface TransactionPartnerFragment {
|
|
135
158
|
/** Type of the transaction partner, always “fragment” */
|
|
@@ -137,12 +160,10 @@ export interface TransactionPartnerFragment {
|
|
|
137
160
|
/** State of the transaction if the transaction is outgoing */
|
|
138
161
|
withdrawal_state?: RevenueWithdrawalState;
|
|
139
162
|
}
|
|
140
|
-
/** Describes a transaction
|
|
141
|
-
export interface
|
|
142
|
-
/** Type of the transaction partner, always “
|
|
143
|
-
type: "
|
|
144
|
-
/** Information about the user */
|
|
145
|
-
user: User;
|
|
163
|
+
/** Describes a withdrawal transaction to the Telegram Ads platform. */
|
|
164
|
+
export interface TransactionPartnerTelegramAds {
|
|
165
|
+
/** Type of the transaction partner, always “telegram_ads” */
|
|
166
|
+
type: "telegram_ads";
|
|
146
167
|
}
|
|
147
168
|
/** Describes a transaction with an unknown source or recipient. */
|
|
148
169
|
export interface TransactionPartnerOther {
|
package/settings.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface MenuButtonWebApp {
|
|
|
32
32
|
type: "web_app";
|
|
33
33
|
/** Text on the button */
|
|
34
34
|
text: string;
|
|
35
|
-
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. */
|
|
35
|
+
/** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. */
|
|
36
36
|
web_app: WebAppInfo;
|
|
37
37
|
}
|
|
38
38
|
/** Describes that no specific value for the menu button was set. */
|