grammy 1.31.2 β 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/out/context.d.ts +39 -0
- package/out/context.js +47 -0
- package/out/convenience/frameworks.js +3 -0
- package/out/core/api.d.ts +51 -0
- package/out/core/api.js +61 -0
- package/out/core/client.js +9 -1
- package/out/web.mjs +47 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<!-- deno-fmt-ignore-start -->
|
|
12
12
|
|
|
13
|
-
[](https://core.telegram.org/bots/api)
|
|
14
14
|
[](https://deno.land/x/grammy)
|
|
15
15
|
[](https://www.npmjs.org/package/grammy)
|
|
16
16
|
[](#contributors-)
|
|
@@ -315,6 +315,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
315
315
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/ExposedCat"><img src="https://avatars.githubusercontent.com/u/44642024?v=4?s=100" width="100px;" alt="Artem Prokop"/><br /><sub><b>Artem Prokop</b></sub></a><br /><a href="#userTesting-ExposedCat" title="User Testing">π</a></td>
|
|
316
316
|
<td align="center" valign="top" width="11.11%"><a href="https://chinoman10.com/"><img src="https://avatars.githubusercontent.com/u/8300763?v=4?s=100" width="100px;" alt="SΓ©rgio Rebelo"/><br /><sub><b>SΓ©rgio Rebelo</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AChinoman10" title="Reviewed Pull Requests">π</a></td>
|
|
317
317
|
<td align="center" valign="top" width="11.11%"><a href="https://blog.katsuba.dev"><img src="https://avatars.githubusercontent.com/u/10637135?v=4?s=100" width="100px;" alt="Igor Katsuba"/><br /><sub><b>Igor Katsuba</b></sub></a><br /><a href="#ideas-IKatsuba" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/grammyjs/grammY/commits?author=IKatsuba" title="Code">π»</a></td>
|
|
318
|
+
<td align="center" valign="top" width="11.11%"><a href="https://tilon.uz"><img src="https://avatars.githubusercontent.com/u/105904746?v=4?s=100" width="100px;" alt="Oyatillo"/><br /><sub><b>Oyatillo</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3ABilagoNet" title="Reviewed Pull Requests">π</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3ABilagoNet" title="Bug reports">π</a> <a href="https://github.com/grammyjs/grammY/commits?author=BilagoNet" title="Code">π»</a></td>
|
|
319
|
+
</tr>
|
|
320
|
+
<tr>
|
|
321
|
+
<td align="center" valign="top" width="11.11%"><a href="https://www.vorant94.io/"><img src="https://avatars.githubusercontent.com/u/9719319?v=4?s=100" width="100px;" alt="Mordechai Dror"/><br /><sub><b>Mordechai Dror</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Avorant94" title="Reviewed Pull Requests">π</a></td>
|
|
318
322
|
</tr>
|
|
319
323
|
</tbody>
|
|
320
324
|
</table>
|
package/out/context.d.ts
CHANGED
|
@@ -722,6 +722,15 @@ export declare class Context implements RenamedUpdate {
|
|
|
722
722
|
* **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
|
|
723
723
|
*/
|
|
724
724
|
getUserProfilePhotos(other?: Other<"getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
|
|
725
|
+
/**
|
|
726
|
+
* Contex-aware alias for `api.serUserEmojiStatus`. Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
727
|
+
*
|
|
728
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
729
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
730
|
+
*
|
|
731
|
+
* **Official reference:** https://core.telegram.org/bots/api#setuseremojistatus
|
|
732
|
+
*/
|
|
733
|
+
setUserEmojiStatus(other?: Other<"setUserEmojiStatus", "user_id">, signal?: AbortSignal): Promise<true>;
|
|
725
734
|
/**
|
|
726
735
|
* Context-aware alias for `api.getUserChatBoosts`. Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
|
|
727
736
|
*
|
|
@@ -1314,6 +1323,16 @@ export declare class Context implements RenamedUpdate {
|
|
|
1314
1323
|
* **Official reference:** https://core.telegram.org/bots/api#getcustomemojistickers
|
|
1315
1324
|
*/
|
|
1316
1325
|
getCustomEmojiStickers(signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Sticker[]>;
|
|
1326
|
+
/**
|
|
1327
|
+
* Context-aware alias for `api.sendGift`. Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.
|
|
1328
|
+
*
|
|
1329
|
+
* @param gift_id Identifier of the gift
|
|
1330
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1331
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1332
|
+
*
|
|
1333
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1334
|
+
*/
|
|
1335
|
+
replyWithGift(gift_id: string, other?: Other<"sendGift", "user_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1317
1336
|
/**
|
|
1318
1337
|
* Context-aware alias for `api.answerInlineQuery`. Use this method to send answers to an inline query. On success, True is returned.
|
|
1319
1338
|
* No more than 50 results per query are allowed.
|
|
@@ -1327,6 +1346,16 @@ export declare class Context implements RenamedUpdate {
|
|
|
1327
1346
|
* **Official reference:** https://core.telegram.org/bots/api#answerinlinequery
|
|
1328
1347
|
*/
|
|
1329
1348
|
answerInlineQuery(results: readonly InlineQueryResult[], other?: Other<"answerInlineQuery", "inline_query_id" | "results">, signal?: AbortSignal): Promise<true>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Context-aware alias for `api.savePreparedInlineMessage`. Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
|
|
1351
|
+
*
|
|
1352
|
+
* @param result An object describing the message to be sent
|
|
1353
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1354
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1355
|
+
*
|
|
1356
|
+
* **Official reference:** https://core.telegram.org/bots/api#savepreparedinlinemessage
|
|
1357
|
+
*/
|
|
1358
|
+
savePreparedInlineMessage(result: InlineQueryResult, other?: Other<"savePreparedInlineMessage", "user_id" | "result">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").PreparedInlineMessage>;
|
|
1330
1359
|
/**
|
|
1331
1360
|
* Context-aware alias for `api.sendInvoice`. Use this method to send invoices. On success, the sent Message is returned.
|
|
1332
1361
|
*
|
|
@@ -1370,6 +1399,16 @@ export declare class Context implements RenamedUpdate {
|
|
|
1370
1399
|
* **Official reference:** https://core.telegram.org/bots/api#refundstarpayment
|
|
1371
1400
|
*/
|
|
1372
1401
|
refundStarPayment(signal?: AbortSignal): Promise<true>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Context-aware alias for `api.editUserStarSubscription`. Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
|
|
1404
|
+
*
|
|
1405
|
+
* @param telegram_payment_charge_id Telegram payment identifier for the subscription
|
|
1406
|
+
* @param is_canceled Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
|
|
1407
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1408
|
+
*
|
|
1409
|
+
* **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
|
|
1410
|
+
*/
|
|
1411
|
+
editUserStarSubscription(telegram_payment_charge_id: string, is_canceled: boolean, signal?: AbortSignal): Promise<true>;
|
|
1373
1412
|
/**
|
|
1374
1413
|
* Context-aware alias for `api.setPassportDataErrors`. 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.
|
|
1375
1414
|
*
|
package/out/context.js
CHANGED
|
@@ -971,6 +971,17 @@ class Context {
|
|
|
971
971
|
getUserProfilePhotos(other, signal) {
|
|
972
972
|
return this.api.getUserProfilePhotos(orThrow(this.from, "getUserProfilePhotos").id, other, signal);
|
|
973
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Contex-aware alias for `api.serUserEmojiStatus`. Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
976
|
+
*
|
|
977
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
978
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
979
|
+
*
|
|
980
|
+
* **Official reference:** https://core.telegram.org/bots/api#setuseremojistatus
|
|
981
|
+
*/
|
|
982
|
+
setUserEmojiStatus(other, signal) {
|
|
983
|
+
return this.api.setUserEmojiStatus(orThrow(this.from, "setUserEmojiStatus").id, other, signal);
|
|
984
|
+
}
|
|
974
985
|
/**
|
|
975
986
|
* Context-aware alias for `api.getUserChatBoosts`. Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
|
|
976
987
|
*
|
|
@@ -1731,6 +1742,18 @@ class Context {
|
|
|
1731
1742
|
.filter((e) => e.type === "custom_emoji")
|
|
1732
1743
|
.map((e) => e.custom_emoji_id), signal);
|
|
1733
1744
|
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Context-aware alias for `api.sendGift`. Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.
|
|
1747
|
+
*
|
|
1748
|
+
* @param gift_id Identifier of the gift
|
|
1749
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1750
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1751
|
+
*
|
|
1752
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1753
|
+
*/
|
|
1754
|
+
replyWithGift(gift_id, other, signal) {
|
|
1755
|
+
return this.api.sendGift(orThrow(this.from, "sendGift").id, gift_id, other, signal);
|
|
1756
|
+
}
|
|
1734
1757
|
/**
|
|
1735
1758
|
* Context-aware alias for `api.answerInlineQuery`. Use this method to send answers to an inline query. On success, True is returned.
|
|
1736
1759
|
* No more than 50 results per query are allowed.
|
|
@@ -1746,6 +1769,18 @@ class Context {
|
|
|
1746
1769
|
answerInlineQuery(results, other, signal) {
|
|
1747
1770
|
return this.api.answerInlineQuery(orThrow(this.inlineQuery, "answerInlineQuery").id, results, other, signal);
|
|
1748
1771
|
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Context-aware alias for `api.savePreparedInlineMessage`. Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
|
|
1774
|
+
*
|
|
1775
|
+
* @param result An object describing the message to be sent
|
|
1776
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1777
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1778
|
+
*
|
|
1779
|
+
* **Official reference:** https://core.telegram.org/bots/api#savepreparedinlinemessage
|
|
1780
|
+
*/
|
|
1781
|
+
savePreparedInlineMessage(result, other, signal) {
|
|
1782
|
+
return this.api.savePreparedInlineMessage(orThrow(this.from, "savePreparedInlineMessage").id, result, other, signal);
|
|
1783
|
+
}
|
|
1749
1784
|
/**
|
|
1750
1785
|
* Context-aware alias for `api.sendInvoice`. Use this method to send invoices. On success, the sent Message is returned.
|
|
1751
1786
|
*
|
|
@@ -1799,6 +1834,18 @@ class Context {
|
|
|
1799
1834
|
return this.api.refundStarPayment(orThrow(this.from, "refundStarPayment").id, orThrow((_a = this.msg) === null || _a === void 0 ? void 0 : _a.successful_payment, "refundStarPayment")
|
|
1800
1835
|
.telegram_payment_charge_id, signal);
|
|
1801
1836
|
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Context-aware alias for `api.editUserStarSubscription`. Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
|
|
1839
|
+
*
|
|
1840
|
+
* @param telegram_payment_charge_id Telegram payment identifier for the subscription
|
|
1841
|
+
* @param is_canceled Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
|
|
1842
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1843
|
+
*
|
|
1844
|
+
* **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
|
|
1845
|
+
*/
|
|
1846
|
+
editUserStarSubscription(telegram_payment_charge_id, is_canceled, signal) {
|
|
1847
|
+
return this.api.editUserStarSubscription(orThrow(this.from, "editUserStarSubscription").id, telegram_payment_charge_id, is_canceled, signal);
|
|
1848
|
+
}
|
|
1802
1849
|
/**
|
|
1803
1850
|
* Context-aware alias for `api.setPassportDataErrors`. 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.
|
|
1804
1851
|
*
|
package/out/core/api.d.ts
CHANGED
|
@@ -457,6 +457,16 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
457
457
|
* **Official reference:** https://core.telegram.org/bots/api#getuserprofilephotos
|
|
458
458
|
*/
|
|
459
459
|
getUserProfilePhotos(user_id: number, other?: Other<R, "getUserProfilePhotos", "user_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/manage.js").UserProfilePhotos>;
|
|
460
|
+
/**
|
|
461
|
+
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
462
|
+
*
|
|
463
|
+
* @param user_id Unique identifier of the target user
|
|
464
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
465
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
466
|
+
*
|
|
467
|
+
* **Official reference:** https://core.telegram.org/bots/api#setuseremojistatus
|
|
468
|
+
*/
|
|
469
|
+
setUserEmojiStatus(user_id: number, other?: Other<R, "setUserEmojiStatus", "user_id">, signal?: AbortSignal): Promise<true>;
|
|
460
470
|
/**
|
|
461
471
|
* Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
|
|
462
472
|
*
|
|
@@ -1352,6 +1362,25 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1352
1362
|
* **Official reference:** https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
|
|
1353
1363
|
*/
|
|
1354
1364
|
setCustomEmojiStickerSetThumbnail(name: string, custom_emoji_id: string, signal?: AbortSignal): Promise<true>;
|
|
1365
|
+
/**
|
|
1366
|
+
* Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.
|
|
1367
|
+
*
|
|
1368
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1369
|
+
*
|
|
1370
|
+
* **Official reference:** https://core.telegram.org/bots/api#getavailablegifts
|
|
1371
|
+
*/
|
|
1372
|
+
getAvailableGifts(signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1373
|
+
/**
|
|
1374
|
+
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.
|
|
1375
|
+
*
|
|
1376
|
+
* @param user_id Unique identifier of the target user that will receive the gift
|
|
1377
|
+
* @param gift_id Identifier of the gift
|
|
1378
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1379
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1380
|
+
*
|
|
1381
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1382
|
+
*/
|
|
1383
|
+
sendGift(user_id: number, gift_id: string, other?: Other<R, "sendGift", "user_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1355
1384
|
/**
|
|
1356
1385
|
* Use this method to send answers to an inline query. On success, True is returned.
|
|
1357
1386
|
* No more than 50 results per query are allowed.
|
|
@@ -1376,6 +1405,17 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1376
1405
|
* **Official reference:** https://core.telegram.org/bots/api#answerwebappquery
|
|
1377
1406
|
*/
|
|
1378
1407
|
answerWebAppQuery(web_app_query_id: string, result: InlineQueryResult, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").SentWebAppMessage>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
|
|
1410
|
+
*
|
|
1411
|
+
* @param user_id Unique identifier of the target user that can use the prepared message
|
|
1412
|
+
* @param result An object describing the message to be sent
|
|
1413
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1414
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1415
|
+
*
|
|
1416
|
+
* **Official reference:** https://core.telegram.org/bots/api#savepreparedinlinemessage
|
|
1417
|
+
*/
|
|
1418
|
+
savePreparedInlineMessage(user_id: number, result: InlineQueryResult, other?: Other<R, "savePreparedInlineMessage", "user_id" | "result">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").PreparedInlineMessage>;
|
|
1379
1419
|
/**
|
|
1380
1420
|
* Use this method to send invoices. On success, the sent Message is returned.
|
|
1381
1421
|
*
|
|
@@ -1447,6 +1487,17 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1447
1487
|
* **Official reference:** https://core.telegram.org/bots/api#refundstarpayment
|
|
1448
1488
|
*/
|
|
1449
1489
|
refundStarPayment(user_id: number, telegram_payment_charge_id: string, signal?: AbortSignal): Promise<true>;
|
|
1490
|
+
/**
|
|
1491
|
+
* Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
|
|
1492
|
+
*
|
|
1493
|
+
* @param user_id Identifier of the user whose subscription will be edited
|
|
1494
|
+
* @param telegram_payment_charge_id Telegram payment identifier for the subscription
|
|
1495
|
+
* @param is_canceled Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
|
|
1496
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1497
|
+
*
|
|
1498
|
+
* **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
|
|
1499
|
+
*/
|
|
1500
|
+
editUserStarSubscription(user_id: number, telegram_payment_charge_id: string, is_canceled: boolean, signal?: AbortSignal): Promise<true>;
|
|
1450
1501
|
/**
|
|
1451
1502
|
* 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.
|
|
1452
1503
|
*
|
package/out/core/api.js
CHANGED
|
@@ -499,6 +499,18 @@ class Api {
|
|
|
499
499
|
getUserProfilePhotos(user_id, other, signal) {
|
|
500
500
|
return this.raw.getUserProfilePhotos({ user_id, ...other }, signal);
|
|
501
501
|
}
|
|
502
|
+
/**
|
|
503
|
+
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
504
|
+
*
|
|
505
|
+
* @param user_id Unique identifier of the target user
|
|
506
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
507
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
508
|
+
*
|
|
509
|
+
* **Official reference:** https://core.telegram.org/bots/api#setuseremojistatus
|
|
510
|
+
*/
|
|
511
|
+
setUserEmojiStatus(user_id, other, signal) {
|
|
512
|
+
return this.raw.setUserEmojiStatus({ user_id, ...other }, signal);
|
|
513
|
+
}
|
|
502
514
|
/**
|
|
503
515
|
* Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
|
|
504
516
|
*
|
|
@@ -1571,6 +1583,29 @@ class Api {
|
|
|
1571
1583
|
custom_emoji_id,
|
|
1572
1584
|
}, signal);
|
|
1573
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.
|
|
1588
|
+
*
|
|
1589
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1590
|
+
*
|
|
1591
|
+
* **Official reference:** https://core.telegram.org/bots/api#getavailablegifts
|
|
1592
|
+
*/
|
|
1593
|
+
getAvailableGifts(signal) {
|
|
1594
|
+
return this.raw.getAvailableGifts(signal);
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.
|
|
1598
|
+
*
|
|
1599
|
+
* @param user_id Unique identifier of the target user that will receive the gift
|
|
1600
|
+
* @param gift_id Identifier of the gift
|
|
1601
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1602
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1603
|
+
*
|
|
1604
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1605
|
+
*/
|
|
1606
|
+
sendGift(user_id, gift_id, other, signal) {
|
|
1607
|
+
return this.raw.sendGift({ user_id, gift_id, ...other }, signal);
|
|
1608
|
+
}
|
|
1574
1609
|
/**
|
|
1575
1610
|
* Use this method to send answers to an inline query. On success, True is returned.
|
|
1576
1611
|
* No more than 50 results per query are allowed.
|
|
@@ -1599,6 +1634,19 @@ class Api {
|
|
|
1599
1634
|
answerWebAppQuery(web_app_query_id, result, signal) {
|
|
1600
1635
|
return this.raw.answerWebAppQuery({ web_app_query_id, result }, signal);
|
|
1601
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
|
|
1639
|
+
*
|
|
1640
|
+
* @param user_id Unique identifier of the target user that can use the prepared message
|
|
1641
|
+
* @param result An object describing the message to be sent
|
|
1642
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1643
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1644
|
+
*
|
|
1645
|
+
* **Official reference:** https://core.telegram.org/bots/api#savepreparedinlinemessage
|
|
1646
|
+
*/
|
|
1647
|
+
savePreparedInlineMessage(user_id, result, other, signal) {
|
|
1648
|
+
return this.raw.savePreparedInlineMessage({ user_id, result, ...other }, signal);
|
|
1649
|
+
}
|
|
1602
1650
|
/**
|
|
1603
1651
|
* Use this method to send invoices. On success, the sent Message is returned.
|
|
1604
1652
|
*
|
|
@@ -1698,6 +1746,19 @@ class Api {
|
|
|
1698
1746
|
refundStarPayment(user_id, telegram_payment_charge_id, signal) {
|
|
1699
1747
|
return this.raw.refundStarPayment({ user_id, telegram_payment_charge_id }, signal);
|
|
1700
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
|
|
1751
|
+
*
|
|
1752
|
+
* @param user_id Identifier of the user whose subscription will be edited
|
|
1753
|
+
* @param telegram_payment_charge_id Telegram payment identifier for the subscription
|
|
1754
|
+
* @param is_canceled Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
|
|
1755
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1756
|
+
*
|
|
1757
|
+
* **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
|
|
1758
|
+
*/
|
|
1759
|
+
editUserStarSubscription(user_id, telegram_payment_charge_id, is_canceled, signal) {
|
|
1760
|
+
return this.raw.editUserStarSubscription({ user_id, telegram_payment_charge_id, is_canceled }, signal);
|
|
1761
|
+
}
|
|
1701
1762
|
/**
|
|
1702
1763
|
* 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.
|
|
1703
1764
|
*
|
package/out/core/client.js
CHANGED
|
@@ -116,7 +116,15 @@ function createRawApi(token, options, webhookReplyEnvelope) {
|
|
|
116
116
|
get(_, m) {
|
|
117
117
|
return m === "toJSON"
|
|
118
118
|
? "__internal"
|
|
119
|
-
|
|
119
|
+
// Methods with zero parameters are called without any payload,
|
|
120
|
+
// so we have to manually inject an empty payload.
|
|
121
|
+
: m === "getMe" ||
|
|
122
|
+
m === "getWebhookInfo" ||
|
|
123
|
+
m === "getForumTopicIconStickers" ||
|
|
124
|
+
m === "logOut" ||
|
|
125
|
+
m === "close"
|
|
126
|
+
? client.callApi.bind(client, m, {})
|
|
127
|
+
: client.callApi.bind(client, m);
|
|
120
128
|
},
|
|
121
129
|
...proxyMethods,
|
|
122
130
|
};
|
package/out/web.mjs
CHANGED
|
@@ -855,6 +855,9 @@ class Context {
|
|
|
855
855
|
getUserProfilePhotos(other, signal) {
|
|
856
856
|
return this.api.getUserProfilePhotos(orThrow(this.from, "getUserProfilePhotos").id, other, signal);
|
|
857
857
|
}
|
|
858
|
+
setUserEmojiStatus(other, signal) {
|
|
859
|
+
return this.api.setUserEmojiStatus(orThrow(this.from, "setUserEmojiStatus").id, other, signal);
|
|
860
|
+
}
|
|
858
861
|
getUserChatBoosts(chat_id, signal) {
|
|
859
862
|
return this.api.getUserChatBoosts(chat_id, orThrow(this.from, "getUserChatBoosts").id, signal);
|
|
860
863
|
}
|
|
@@ -1077,9 +1080,15 @@ class Context {
|
|
|
1077
1080
|
getCustomEmojiStickers(signal) {
|
|
1078
1081
|
return this.api.getCustomEmojiStickers((this.msg?.entities ?? []).filter((e)=>e.type === "custom_emoji").map((e)=>e.custom_emoji_id), signal);
|
|
1079
1082
|
}
|
|
1083
|
+
replyWithGift(gift_id, other, signal) {
|
|
1084
|
+
return this.api.sendGift(orThrow(this.from, "sendGift").id, gift_id, other, signal);
|
|
1085
|
+
}
|
|
1080
1086
|
answerInlineQuery(results, other, signal) {
|
|
1081
1087
|
return this.api.answerInlineQuery(orThrow(this.inlineQuery, "answerInlineQuery").id, results, other, signal);
|
|
1082
1088
|
}
|
|
1089
|
+
savePreparedInlineMessage(result, other, signal) {
|
|
1090
|
+
return this.api.savePreparedInlineMessage(orThrow(this.from, "savePreparedInlineMessage").id, result, other, signal);
|
|
1091
|
+
}
|
|
1083
1092
|
replyWithInvoice(title, description, payload, currency, prices, other, signal) {
|
|
1084
1093
|
return this.api.sendInvoice(orThrow(this.chatId, "sendInvoice"), title, description, payload, currency, prices, other, signal);
|
|
1085
1094
|
}
|
|
@@ -1094,6 +1103,9 @@ class Context {
|
|
|
1094
1103
|
refundStarPayment(signal) {
|
|
1095
1104
|
return this.api.refundStarPayment(orThrow(this.from, "refundStarPayment").id, orThrow(this.msg?.successful_payment, "refundStarPayment").telegram_payment_charge_id, signal);
|
|
1096
1105
|
}
|
|
1106
|
+
editUserStarSubscription(telegram_payment_charge_id, is_canceled, signal) {
|
|
1107
|
+
return this.api.editUserStarSubscription(orThrow(this.from, "editUserStarSubscription").id, telegram_payment_charge_id, is_canceled, signal);
|
|
1108
|
+
}
|
|
1097
1109
|
setPassportDataErrors(errors, signal) {
|
|
1098
1110
|
return this.api.setPassportDataErrors(orThrow(this.from, "setPassportDataErrors").id, errors, signal);
|
|
1099
1111
|
}
|
|
@@ -2327,7 +2339,7 @@ function createRawApi(token, options, webhookReplyEnvelope) {
|
|
|
2327
2339
|
const client = new ApiClient(token, options, webhookReplyEnvelope);
|
|
2328
2340
|
const proxyHandler = {
|
|
2329
2341
|
get (_, m) {
|
|
2330
|
-
return m === "toJSON" ? "__internal" : client.callApi.bind(client, m);
|
|
2342
|
+
return m === "toJSON" ? "__internal" : m === "getMe" || m === "getWebhookInfo" || m === "getForumTopicIconStickers" || m === "logOut" || m === "close" ? client.callApi.bind(client, m, {}) : client.callApi.bind(client, m);
|
|
2331
2343
|
},
|
|
2332
2344
|
...proxyMethods
|
|
2333
2345
|
};
|
|
@@ -2664,6 +2676,12 @@ class Api {
|
|
|
2664
2676
|
...other
|
|
2665
2677
|
}, signal);
|
|
2666
2678
|
}
|
|
2679
|
+
setUserEmojiStatus(user_id, other, signal) {
|
|
2680
|
+
return this.raw.setUserEmojiStatus({
|
|
2681
|
+
user_id,
|
|
2682
|
+
...other
|
|
2683
|
+
}, signal);
|
|
2684
|
+
}
|
|
2667
2685
|
getUserChatBoosts(chat_id, user_id, signal) {
|
|
2668
2686
|
return this.raw.getUserChatBoosts({
|
|
2669
2687
|
chat_id,
|
|
@@ -3192,6 +3210,16 @@ class Api {
|
|
|
3192
3210
|
custom_emoji_id
|
|
3193
3211
|
}, signal);
|
|
3194
3212
|
}
|
|
3213
|
+
getAvailableGifts(signal) {
|
|
3214
|
+
return this.raw.getAvailableGifts(signal);
|
|
3215
|
+
}
|
|
3216
|
+
sendGift(user_id, gift_id, other, signal) {
|
|
3217
|
+
return this.raw.sendGift({
|
|
3218
|
+
user_id,
|
|
3219
|
+
gift_id,
|
|
3220
|
+
...other
|
|
3221
|
+
}, signal);
|
|
3222
|
+
}
|
|
3195
3223
|
answerInlineQuery(inline_query_id, results, other, signal) {
|
|
3196
3224
|
return this.raw.answerInlineQuery({
|
|
3197
3225
|
inline_query_id,
|
|
@@ -3205,6 +3233,13 @@ class Api {
|
|
|
3205
3233
|
result
|
|
3206
3234
|
}, signal);
|
|
3207
3235
|
}
|
|
3236
|
+
savePreparedInlineMessage(user_id, result, other, signal) {
|
|
3237
|
+
return this.raw.savePreparedInlineMessage({
|
|
3238
|
+
user_id,
|
|
3239
|
+
result,
|
|
3240
|
+
...other
|
|
3241
|
+
}, signal);
|
|
3242
|
+
}
|
|
3208
3243
|
sendInvoice(chat_id, title, description, payload, currency, prices, other, signal) {
|
|
3209
3244
|
return this.raw.sendInvoice({
|
|
3210
3245
|
chat_id,
|
|
@@ -3252,6 +3287,13 @@ class Api {
|
|
|
3252
3287
|
telegram_payment_charge_id
|
|
3253
3288
|
}, signal);
|
|
3254
3289
|
}
|
|
3290
|
+
editUserStarSubscription(user_id, telegram_payment_charge_id, is_canceled, signal) {
|
|
3291
|
+
return this.raw.editUserStarSubscription({
|
|
3292
|
+
user_id,
|
|
3293
|
+
telegram_payment_charge_id,
|
|
3294
|
+
is_canceled
|
|
3295
|
+
}, signal);
|
|
3296
|
+
}
|
|
3255
3297
|
setPassportDataErrors(user_id, errors, signal) {
|
|
3256
3298
|
return this.raw.setPassportDataErrors({
|
|
3257
3299
|
user_id,
|
|
@@ -4695,7 +4737,10 @@ const bun = (request)=>{
|
|
|
4695
4737
|
},
|
|
4696
4738
|
unauthorized: ()=>{
|
|
4697
4739
|
resolveResponse(unauthorized());
|
|
4698
|
-
}
|
|
4740
|
+
},
|
|
4741
|
+
handlerReturn: new Promise((resolve)=>{
|
|
4742
|
+
resolveResponse = resolve;
|
|
4743
|
+
})
|
|
4699
4744
|
};
|
|
4700
4745
|
};
|
|
4701
4746
|
const cloudflare = (event)=>{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grammy",
|
|
3
3
|
"description": "The Telegram Bot Framework.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.32.0",
|
|
5
5
|
"author": "KnorpelSenf",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"backport": "deno2node tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@grammyjs/types": "3.
|
|
20
|
+
"@grammyjs/types": "3.16.0",
|
|
21
21
|
"abort-controller": "^3.0.0",
|
|
22
22
|
"debug": "^4.3.4",
|
|
23
23
|
"node-fetch": "^2.7.0"
|