grammy 1.34.1 → 1.35.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 +2 -1
- package/out/context.d.ts +13 -3
- package/out/context.js +14 -2
- package/out/convenience/frameworks.d.ts +9 -0
- package/out/convenience/frameworks.js +25 -0
- package/out/convenience/webhook.d.ts +1 -0
- package/out/core/api.d.ts +16 -5
- package/out/core/api.js +17 -4
- package/out/web.mjs +31 -0
- 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-)
|
|
@@ -322,6 +322,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
322
322
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/mahovich"><img src="https://avatars.githubusercontent.com/u/2377626?v=4?s=100" width="100px;" alt="mahovich"/><br /><sub><b>mahovich</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=mahovich" title="Documentation">📖</a></td>
|
|
323
323
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/Hth4nh"><img src="https://avatars.githubusercontent.com/u/63627651?v=4?s=100" width="100px;" alt="Thành Hoàng Trần"/><br /><sub><b>Thành Hoàng Trần</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Hth4nh" title="Documentation">📖</a></td>
|
|
324
324
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/ikelax"><img src="https://avatars.githubusercontent.com/u/163678144?v=4?s=100" width="100px;" alt="ikelax"/><br /><sub><b>ikelax</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=ikelax" title="Documentation">📖</a></td>
|
|
325
|
+
<td align="center" valign="top" width="11.11%"><a href="http://zeokku.com"><img src="https://avatars.githubusercontent.com/u/22231294?v=4?s=100" width="100px;" alt="Lutymane"/><br /><sub><b>Lutymane</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Lutymane" title="Code">💻</a></td>
|
|
325
326
|
</tr>
|
|
326
327
|
</tbody>
|
|
327
328
|
</table>
|
package/out/context.d.ts
CHANGED
|
@@ -703,7 +703,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
703
703
|
*/
|
|
704
704
|
replyWithChatAction(action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note", other?: Other<"sendChatAction", "chat_id" | "action">, signal?: AbortSignal): Promise<true>;
|
|
705
705
|
/**
|
|
706
|
-
* Context-aware alias for `api.setMessageReaction`. 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.
|
|
706
|
+
* Context-aware alias for `api.setMessageReaction`. Use this method to change the chosen reactions on a message. Service messages of some types 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.
|
|
707
707
|
*
|
|
708
708
|
* @param reaction 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
709
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1324,7 +1324,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1324
1324
|
*/
|
|
1325
1325
|
getCustomEmojiStickers(signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Sticker[]>;
|
|
1326
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
|
|
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 receiver. Returns True on success.
|
|
1328
1328
|
*
|
|
1329
1329
|
* @param gift_id Identifier of the gift
|
|
1330
1330
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1332,7 +1332,17 @@ export declare class Context implements RenamedUpdate {
|
|
|
1332
1332
|
*
|
|
1333
1333
|
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1334
1334
|
*/
|
|
1335
|
-
replyWithGift(gift_id: string, other?: Other<"sendGift", "user_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1335
|
+
replyWithGift(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Context-aware alias for `api.sendGift`. Sends a gift to the given channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1338
|
+
*
|
|
1339
|
+
* @param gift_id Identifier of the gift
|
|
1340
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1341
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1342
|
+
*
|
|
1343
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1344
|
+
*/
|
|
1345
|
+
replyWithGiftToChannel(gift_id: string, other?: Other<"sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1336
1346
|
/**
|
|
1337
1347
|
* Context-aware alias for `api.answerInlineQuery`. Use this method to send answers to an inline query. On success, True is returned.
|
|
1338
1348
|
* No more than 50 results per query are allowed.
|
package/out/context.js
CHANGED
|
@@ -943,7 +943,7 @@ class Context {
|
|
|
943
943
|
return this.api.sendChatAction(orThrow(this.chatId, "sendChatAction"), action, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
944
944
|
}
|
|
945
945
|
/**
|
|
946
|
-
* Context-aware alias for `api.setMessageReaction`. 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.
|
|
946
|
+
* Context-aware alias for `api.setMessageReaction`. Use this method to change the chosen reactions on a message. Service messages of some types 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.
|
|
947
947
|
*
|
|
948
948
|
* @param reaction 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.
|
|
949
949
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1743,7 +1743,7 @@ class Context {
|
|
|
1743
1743
|
.map((e) => e.custom_emoji_id), signal);
|
|
1744
1744
|
}
|
|
1745
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
|
|
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 receiver. Returns True on success.
|
|
1747
1747
|
*
|
|
1748
1748
|
* @param gift_id Identifier of the gift
|
|
1749
1749
|
* @param other Optional remaining parameters, confer the official reference below
|
|
@@ -1754,6 +1754,18 @@ class Context {
|
|
|
1754
1754
|
replyWithGift(gift_id, other, signal) {
|
|
1755
1755
|
return this.api.sendGift(orThrow(this.from, "sendGift").id, gift_id, other, signal);
|
|
1756
1756
|
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Context-aware alias for `api.sendGift`. Sends a gift to the given channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1759
|
+
*
|
|
1760
|
+
* @param gift_id Identifier of the gift
|
|
1761
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1762
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1763
|
+
*
|
|
1764
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1765
|
+
*/
|
|
1766
|
+
replyWithGiftToChannel(gift_id, other, signal) {
|
|
1767
|
+
return this.api.sendGiftToChannel(orThrow(this.chat, "sendGift").id, gift_id, other, signal);
|
|
1768
|
+
}
|
|
1757
1769
|
/**
|
|
1758
1770
|
* Context-aware alias for `api.answerInlineQuery`. Use this method to send answers to an inline query. On success, True is returned.
|
|
1759
1771
|
* No more than 50 results per query are allowed.
|
|
@@ -71,6 +71,14 @@ export type CloudflareAdapter = (event: {
|
|
|
71
71
|
respondWith: (response: Promise<Response>) => void;
|
|
72
72
|
}) => ReqResHandler;
|
|
73
73
|
export type CloudflareModuleAdapter = (request: Request) => ReqResHandler<Response>;
|
|
74
|
+
export type ElysiaAdapter = (ctx: {
|
|
75
|
+
body: Update;
|
|
76
|
+
headers: Record<string, string | undefined>;
|
|
77
|
+
set: {
|
|
78
|
+
headers: Record<string, string>;
|
|
79
|
+
status: number;
|
|
80
|
+
};
|
|
81
|
+
}) => ReqResHandler<string>;
|
|
74
82
|
export type ExpressAdapter = (req: {
|
|
75
83
|
body: Update;
|
|
76
84
|
header: (header: string) => string | undefined;
|
|
@@ -186,6 +194,7 @@ export declare const adapters: {
|
|
|
186
194
|
bun: BunAdapter;
|
|
187
195
|
cloudflare: CloudflareAdapter;
|
|
188
196
|
"cloudflare-mod": CloudflareModuleAdapter;
|
|
197
|
+
elysia: ElysiaAdapter;
|
|
189
198
|
express: ExpressAdapter;
|
|
190
199
|
fastify: FastifyAdapter;
|
|
191
200
|
hono: HonoAdapter;
|
|
@@ -307,6 +307,30 @@ const worktop = (req, res) => {
|
|
|
307
307
|
unauthorized: () => res.send(401, WRONG_TOKEN_ERROR),
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
+
const elysia = (ctx) => {
|
|
311
|
+
// @note upgrade target to use modern code?
|
|
312
|
+
// const { promise, resolve } = Promise.withResolvers<string>();
|
|
313
|
+
let resolve;
|
|
314
|
+
const handlerReturn = new Promise((res) => resolve = res);
|
|
315
|
+
return {
|
|
316
|
+
// @note technically the type shouldn't be limited to Promise, because it's fine to await plain values as well
|
|
317
|
+
update: Promise.resolve(ctx.body),
|
|
318
|
+
header: ctx.headers[SECRET_HEADER_LOWERCASE],
|
|
319
|
+
end() {
|
|
320
|
+
resolve("");
|
|
321
|
+
},
|
|
322
|
+
respond(json) {
|
|
323
|
+
// @note since json is passed as string here, we gotta define proper content-type
|
|
324
|
+
ctx.set.headers["content-type"] = "application/json";
|
|
325
|
+
resolve(json);
|
|
326
|
+
},
|
|
327
|
+
unauthorized() {
|
|
328
|
+
ctx.set.status = 401;
|
|
329
|
+
resolve("");
|
|
330
|
+
},
|
|
331
|
+
handlerReturn,
|
|
332
|
+
};
|
|
333
|
+
};
|
|
310
334
|
// Please open a pull request if you want to add another adapter
|
|
311
335
|
exports.adapters = {
|
|
312
336
|
"aws-lambda": awsLambda,
|
|
@@ -315,6 +339,7 @@ exports.adapters = {
|
|
|
315
339
|
bun,
|
|
316
340
|
cloudflare,
|
|
317
341
|
"cloudflare-mod": cloudflareModule,
|
|
342
|
+
elysia,
|
|
318
343
|
express,
|
|
319
344
|
fastify,
|
|
320
345
|
hono,
|
|
@@ -9,6 +9,7 @@ declare const adapters: {
|
|
|
9
9
|
bun: import("./frameworks.js").BunAdapter;
|
|
10
10
|
cloudflare: import("./frameworks.js").CloudflareAdapter;
|
|
11
11
|
"cloudflare-mod": import("./frameworks.js").CloudflareModuleAdapter;
|
|
12
|
+
elysia: import("./frameworks.js").ElysiaAdapter;
|
|
12
13
|
express: import("./frameworks.js").ExpressAdapter;
|
|
13
14
|
fastify: import("./frameworks.js").FastifyAdapter;
|
|
14
15
|
hono: import("./frameworks.js").HonoAdapter;
|
package/out/core/api.d.ts
CHANGED
|
@@ -421,7 +421,7 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
421
421
|
*/
|
|
422
422
|
sendDice(chat_id: number | string, emoji: (string & Record<never, never>) | "🎲" | "🎯" | "🏀" | "⚽" | "🎳" | "🎰", other?: Other<R, "sendDice", "chat_id" | "emoji">, signal?: AbortSignal): Promise<import("@grammyjs/types/message.js").Message.DiceMessage>;
|
|
423
423
|
/**
|
|
424
|
-
* 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.
|
|
424
|
+
* Use this method to change the chosen reactions on a message. Service messages of some types 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.
|
|
425
425
|
*
|
|
426
426
|
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
427
427
|
* @param message_id Identifier of the target message
|
|
@@ -1363,7 +1363,7 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1363
1363
|
*/
|
|
1364
1364
|
setCustomEmojiStickerSetThumbnail(name: string, custom_emoji_id: string, signal?: AbortSignal): Promise<true>;
|
|
1365
1365
|
/**
|
|
1366
|
-
* Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.
|
|
1366
|
+
* Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.
|
|
1367
1367
|
*
|
|
1368
1368
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1369
1369
|
*
|
|
@@ -1371,16 +1371,27 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1371
1371
|
*/
|
|
1372
1372
|
getAvailableGifts(signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1373
1373
|
/**
|
|
1374
|
-
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the
|
|
1374
|
+
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1375
1375
|
*
|
|
1376
|
-
* @param user_id Unique identifier of the target user
|
|
1376
|
+
* @param user_id Unique identifier of the target user who will receive the gift
|
|
1377
1377
|
* @param gift_id Identifier of the gift
|
|
1378
1378
|
* @param other Optional remaining parameters, confer the official reference below
|
|
1379
1379
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1380
1380
|
*
|
|
1381
1381
|
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1382
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>;
|
|
1383
|
+
sendGift(user_id: number, gift_id: string, other?: Other<R, "sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1384
|
+
/**
|
|
1385
|
+
* Sends a gift to the given channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1386
|
+
*
|
|
1387
|
+
* @param chat_id Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift
|
|
1388
|
+
* @param gift_id Identifier of the gift
|
|
1389
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1390
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1391
|
+
*
|
|
1392
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1393
|
+
*/
|
|
1394
|
+
sendGiftToChannel(chat_id: number | string, gift_id: string, other?: Other<R, "sendGift", "user_id" | "chat_id" | "gift_id">, signal?: AbortSignal): Promise<import("@grammyjs/types/payment.js").Gifts>;
|
|
1384
1395
|
/**
|
|
1385
1396
|
* Use this method to send answers to an inline query. On success, True is returned.
|
|
1386
1397
|
* No more than 50 results per query are allowed.
|
package/out/core/api.js
CHANGED
|
@@ -452,7 +452,7 @@ class Api {
|
|
|
452
452
|
return this.raw.sendDice({ chat_id, emoji, ...other }, signal);
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
|
-
* 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.
|
|
455
|
+
* Use this method to change the chosen reactions on a message. Service messages of some types 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.
|
|
456
456
|
*
|
|
457
457
|
* @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
458
458
|
* @param message_id Identifier of the target message
|
|
@@ -1584,7 +1584,7 @@ class Api {
|
|
|
1584
1584
|
}, signal);
|
|
1585
1585
|
}
|
|
1586
1586
|
/**
|
|
1587
|
-
* Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.
|
|
1587
|
+
* Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.
|
|
1588
1588
|
*
|
|
1589
1589
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
1590
1590
|
*
|
|
@@ -1594,9 +1594,9 @@ class Api {
|
|
|
1594
1594
|
return this.raw.getAvailableGifts(signal);
|
|
1595
1595
|
}
|
|
1596
1596
|
/**
|
|
1597
|
-
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the
|
|
1597
|
+
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1598
1598
|
*
|
|
1599
|
-
* @param user_id Unique identifier of the target user
|
|
1599
|
+
* @param user_id Unique identifier of the target user who will receive the gift
|
|
1600
1600
|
* @param gift_id Identifier of the gift
|
|
1601
1601
|
* @param other Optional remaining parameters, confer the official reference below
|
|
1602
1602
|
* @param signal Optional `AbortSignal` to cancel the request
|
|
@@ -1606,6 +1606,19 @@ class Api {
|
|
|
1606
1606
|
sendGift(user_id, gift_id, other, signal) {
|
|
1607
1607
|
return this.raw.sendGift({ user_id, gift_id, ...other }, signal);
|
|
1608
1608
|
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Sends a gift to the given channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
|
|
1611
|
+
*
|
|
1612
|
+
* @param chat_id Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift
|
|
1613
|
+
* @param gift_id Identifier of the gift
|
|
1614
|
+
* @param other Optional remaining parameters, confer the official reference below
|
|
1615
|
+
* @param signal Optional `AbortSignal` to cancel the request
|
|
1616
|
+
*
|
|
1617
|
+
* **Official reference:** https://core.telegram.org/bots/api#sendgift
|
|
1618
|
+
*/
|
|
1619
|
+
sendGiftToChannel(chat_id, gift_id, other, signal) {
|
|
1620
|
+
return this.raw.sendGift({ chat_id, gift_id, ...other }, signal);
|
|
1621
|
+
}
|
|
1609
1622
|
/**
|
|
1610
1623
|
* Use this method to send answers to an inline query. On success, True is returned.
|
|
1611
1624
|
* No more than 50 results per query are allowed.
|
package/out/web.mjs
CHANGED
|
@@ -1083,6 +1083,9 @@ class Context {
|
|
|
1083
1083
|
replyWithGift(gift_id, other, signal) {
|
|
1084
1084
|
return this.api.sendGift(orThrow(this.from, "sendGift").id, gift_id, other, signal);
|
|
1085
1085
|
}
|
|
1086
|
+
replyWithGiftToChannel(gift_id, other, signal) {
|
|
1087
|
+
return this.api.sendGiftToChannel(orThrow(this.chat, "sendGift").id, gift_id, other, signal);
|
|
1088
|
+
}
|
|
1086
1089
|
answerInlineQuery(results, other, signal) {
|
|
1087
1090
|
return this.api.answerInlineQuery(orThrow(this.inlineQuery, "answerInlineQuery").id, results, other, signal);
|
|
1088
1091
|
}
|
|
@@ -3232,6 +3235,13 @@ class Api {
|
|
|
3232
3235
|
...other
|
|
3233
3236
|
}, signal);
|
|
3234
3237
|
}
|
|
3238
|
+
sendGiftToChannel(chat_id, gift_id, other, signal) {
|
|
3239
|
+
return this.raw.sendGift({
|
|
3240
|
+
chat_id,
|
|
3241
|
+
gift_id,
|
|
3242
|
+
...other
|
|
3243
|
+
}, signal);
|
|
3244
|
+
}
|
|
3235
3245
|
answerInlineQuery(inline_query_id, results, other, signal) {
|
|
3236
3246
|
return this.raw.answerInlineQuery({
|
|
3237
3247
|
inline_query_id,
|
|
@@ -4971,6 +4981,26 @@ const worktop = (req, res)=>({
|
|
|
4971
4981
|
respond: (json)=>res.send(200, json),
|
|
4972
4982
|
unauthorized: ()=>res.send(401, WRONG_TOKEN_ERROR)
|
|
4973
4983
|
});
|
|
4984
|
+
const elysia = (ctx)=>{
|
|
4985
|
+
let resolve;
|
|
4986
|
+
const handlerReturn = new Promise((res)=>resolve = res);
|
|
4987
|
+
return {
|
|
4988
|
+
update: Promise.resolve(ctx.body),
|
|
4989
|
+
header: ctx.headers[SECRET_HEADER_LOWERCASE],
|
|
4990
|
+
end () {
|
|
4991
|
+
resolve("");
|
|
4992
|
+
},
|
|
4993
|
+
respond (json) {
|
|
4994
|
+
ctx.set.headers["content-type"] = "application/json";
|
|
4995
|
+
resolve(json);
|
|
4996
|
+
},
|
|
4997
|
+
unauthorized () {
|
|
4998
|
+
ctx.set.status = 401;
|
|
4999
|
+
resolve("");
|
|
5000
|
+
},
|
|
5001
|
+
handlerReturn
|
|
5002
|
+
};
|
|
5003
|
+
};
|
|
4974
5004
|
const adapters = {
|
|
4975
5005
|
"aws-lambda": awsLambda,
|
|
4976
5006
|
"aws-lambda-async": awsLambdaAsync,
|
|
@@ -4978,6 +5008,7 @@ const adapters = {
|
|
|
4978
5008
|
bun,
|
|
4979
5009
|
cloudflare,
|
|
4980
5010
|
"cloudflare-mod": cloudflareModule,
|
|
5011
|
+
elysia,
|
|
4981
5012
|
express,
|
|
4982
5013
|
fastify,
|
|
4983
5014
|
hono,
|
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.35.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.19.0",
|
|
21
21
|
"abort-controller": "^3.0.0",
|
|
22
22
|
"debug": "^4.3.4",
|
|
23
23
|
"node-fetch": "^2.7.0"
|