grammy 1.35.0 → 1.35.1
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 +3 -0
- package/out/context.d.ts +2 -2
- package/out/context.js +17 -17
- package/out/convenience/frameworks.d.ts +16 -11
- package/out/convenience/frameworks.js +16 -2
- package/out/convenience/webhook.d.ts +1 -0
- package/out/core/api.d.ts +1 -1
- package/out/core/api.js +2 -2
- package/out/filter.d.ts +1 -1
- package/out/mod.d.ts +1 -1
- package/out/web.mjs +84 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -323,6 +323,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
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
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>
|
|
326
|
+
<td align="center" valign="top" width="11.11%"><a href="https://thadaw.com"><img src="https://avatars.githubusercontent.com/u/3647850?v=4?s=100" width="100px;" alt="Thada Wangthammang"/><br /><sub><b>Thada Wangthammang</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Amildronize" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=mildronize" title="Tests">⚠️</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Amildronize" title="Reviewed Pull Requests">👀</a></td>
|
|
327
|
+
<td align="center" valign="top" width="11.11%"><a href="https://github.com/rtyt3000"><img src="https://avatars.githubusercontent.com/u/123096124?v=4?s=100" width="100px;" alt="Konstantin Ryshkov"/><br /><sub><b>Konstantin Ryshkov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Artyt3000" title="Bug reports">🐛</a></td>
|
|
328
|
+
<td align="center" valign="top" width="11.11%"><a href="https://github.com/mishkatik"><img src="https://avatars.githubusercontent.com/u/101044644?v=4?s=100" width="100px;" alt="mish"/><br /><sub><b>mish</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Amishkatik" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=mishkatik" title="Code">💻</a></td>
|
|
326
329
|
</tr>
|
|
327
330
|
</tbody>
|
|
328
331
|
</table>
|
package/out/context.d.ts
CHANGED
|
@@ -1007,7 +1007,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1007
1007
|
*
|
|
1008
1008
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
|
1009
1009
|
*/
|
|
1010
|
-
unpinChatMessage(message_id?: number, signal?: AbortSignal): Promise<true>;
|
|
1010
|
+
unpinChatMessage(message_id?: number, other?: Other<"unpinChatMessage", "chat_id" | "message_id">, signal?: AbortSignal): Promise<true>;
|
|
1011
1011
|
/**
|
|
1012
1012
|
* Context-aware alias for `api.unpinAllChatMessages`. Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
1013
1013
|
*
|
|
@@ -1589,7 +1589,7 @@ type ShippingQueryContextCore = FilterCore<"shipping_query">;
|
|
|
1589
1589
|
* in separate files and still have the correct types.
|
|
1590
1590
|
*/
|
|
1591
1591
|
export type ShippingQueryContext<C extends Context> = Filter<NarrowMatch<C, string | RegExpMatchArray>, "shipping_query">;
|
|
1592
|
-
type ChatTypeContextCore<T extends Chat["type"]> = Record<"update", ChatTypeUpdate<T>> & ChatType<T> & Record<"chatId", number> & ChatFrom<T> & ChatTypeRecord<"msg", T> & AliasProps<ChatTypeUpdate<T
|
|
1592
|
+
type ChatTypeContextCore<T extends Chat["type"]> = T extends unknown ? Record<"update", ChatTypeUpdate<T>> & ChatType<T> & Record<"chatId", number> & ChatFrom<T> & ChatTypeRecord<"msg", T> & AliasProps<ChatTypeUpdate<T>> : never;
|
|
1593
1593
|
/**
|
|
1594
1594
|
* Type of the context object that is available inside the handlers for
|
|
1595
1595
|
* `bot.chatType`.
|
package/out/context.js
CHANGED
|
@@ -843,8 +843,8 @@ class Context {
|
|
|
843
843
|
editMessageLiveLocation(latitude, longitude, other, signal) {
|
|
844
844
|
const inlineId = this.inlineMessageId;
|
|
845
845
|
return inlineId !== undefined
|
|
846
|
-
? this.api.editMessageLiveLocationInline(inlineId, latitude, longitude, other)
|
|
847
|
-
: this.api.editMessageLiveLocation(orThrow(this.chatId, "editMessageLiveLocation"), orThrow(this.msgId, "editMessageLiveLocation"), latitude, longitude, other, signal);
|
|
846
|
+
? this.api.editMessageLiveLocationInline(inlineId, latitude, longitude, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
847
|
+
: this.api.editMessageLiveLocation(orThrow(this.chatId, "editMessageLiveLocation"), orThrow(this.msgId, "editMessageLiveLocation"), latitude, longitude, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
848
848
|
}
|
|
849
849
|
/**
|
|
850
850
|
* Context-aware alias for `api.stopMessageLiveLocation`. Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
|
|
@@ -857,8 +857,8 @@ class Context {
|
|
|
857
857
|
stopMessageLiveLocation(other, signal) {
|
|
858
858
|
const inlineId = this.inlineMessageId;
|
|
859
859
|
return inlineId !== undefined
|
|
860
|
-
? this.api.stopMessageLiveLocationInline(inlineId, other)
|
|
861
|
-
: this.api.stopMessageLiveLocation(orThrow(this.chatId, "stopMessageLiveLocation"), orThrow(this.msgId, "stopMessageLiveLocation"), other, signal);
|
|
860
|
+
? this.api.stopMessageLiveLocationInline(inlineId, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
861
|
+
: this.api.stopMessageLiveLocation(orThrow(this.chatId, "stopMessageLiveLocation"), orThrow(this.msgId, "stopMessageLiveLocation"), { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
862
862
|
}
|
|
863
863
|
/**
|
|
864
864
|
* Context-aware alias for `api.sendPaidMedia`. Use this method to send paid media. On success, the sent Message is returned.
|
|
@@ -871,7 +871,7 @@ class Context {
|
|
|
871
871
|
* **Official reference:** https://core.telegram.org/bots/api#sendpaidmedia
|
|
872
872
|
*/
|
|
873
873
|
sendPaidMedia(star_count, media, other, signal) {
|
|
874
|
-
return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media, other, signal);
|
|
874
|
+
return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
875
875
|
}
|
|
876
876
|
/**
|
|
877
877
|
* Context-aware alias for `api.sendVenue`. Use this method to send information about a venue. On success, the sent Message is returned.
|
|
@@ -1313,7 +1313,7 @@ class Context {
|
|
|
1313
1313
|
* **Official reference:** https://core.telegram.org/bots/api#pinchatmessage
|
|
1314
1314
|
*/
|
|
1315
1315
|
pinChatMessage(message_id, other, signal) {
|
|
1316
|
-
return this.api.pinChatMessage(orThrow(this.chatId, "pinChatMessage"), message_id, other, signal);
|
|
1316
|
+
return this.api.pinChatMessage(orThrow(this.chatId, "pinChatMessage"), message_id, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1317
1317
|
}
|
|
1318
1318
|
/**
|
|
1319
1319
|
* Context-aware alias for `api.unpinChatMessage`. Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
@@ -1323,8 +1323,8 @@ class Context {
|
|
|
1323
1323
|
*
|
|
1324
1324
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
|
1325
1325
|
*/
|
|
1326
|
-
unpinChatMessage(message_id, signal) {
|
|
1327
|
-
return this.api.unpinChatMessage(orThrow(this.chatId, "unpinChatMessage"), message_id, signal);
|
|
1326
|
+
unpinChatMessage(message_id, other, signal) {
|
|
1327
|
+
return this.api.unpinChatMessage(orThrow(this.chatId, "unpinChatMessage"), message_id, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1328
1328
|
}
|
|
1329
1329
|
/**
|
|
1330
1330
|
* Context-aware alias for `api.unpinAllChatMessages`. Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
@@ -1624,8 +1624,8 @@ class Context {
|
|
|
1624
1624
|
var _a, _b, _c, _d, _e;
|
|
1625
1625
|
const inlineId = this.inlineMessageId;
|
|
1626
1626
|
return inlineId !== undefined
|
|
1627
|
-
? this.api.editMessageTextInline(inlineId, text, other)
|
|
1628
|
-
: this.api.editMessageText(orThrow(this.chatId, "editMessageText"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageText"), text, other, signal);
|
|
1627
|
+
? this.api.editMessageTextInline(inlineId, text, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
1628
|
+
: this.api.editMessageText(orThrow(this.chatId, "editMessageText"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageText"), text, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1629
1629
|
}
|
|
1630
1630
|
/**
|
|
1631
1631
|
* Context-aware alias for `api.editMessageCaption`. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
|
|
@@ -1639,8 +1639,8 @@ class Context {
|
|
|
1639
1639
|
var _a, _b, _c, _d, _e;
|
|
1640
1640
|
const inlineId = this.inlineMessageId;
|
|
1641
1641
|
return inlineId !== undefined
|
|
1642
|
-
? this.api.editMessageCaptionInline(inlineId, other)
|
|
1643
|
-
: this.api.editMessageCaption(orThrow(this.chatId, "editMessageCaption"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageCaption"), other, signal);
|
|
1642
|
+
? this.api.editMessageCaptionInline(inlineId, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
1643
|
+
: this.api.editMessageCaption(orThrow(this.chatId, "editMessageCaption"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageCaption"), { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1644
1644
|
}
|
|
1645
1645
|
/**
|
|
1646
1646
|
* Context-aware alias for `api.editMessageMedia`. Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
|
|
@@ -1655,8 +1655,8 @@ class Context {
|
|
|
1655
1655
|
var _a, _b, _c, _d, _e;
|
|
1656
1656
|
const inlineId = this.inlineMessageId;
|
|
1657
1657
|
return inlineId !== undefined
|
|
1658
|
-
? this.api.editMessageMediaInline(inlineId, media, other)
|
|
1659
|
-
: this.api.editMessageMedia(orThrow(this.chatId, "editMessageMedia"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageMedia"), media, other, signal);
|
|
1658
|
+
? this.api.editMessageMediaInline(inlineId, media, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
1659
|
+
: this.api.editMessageMedia(orThrow(this.chatId, "editMessageMedia"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageMedia"), media, { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1660
1660
|
}
|
|
1661
1661
|
/**
|
|
1662
1662
|
* Context-aware alias for `api.editMessageReplyMarkup`. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
|
|
@@ -1670,8 +1670,8 @@ class Context {
|
|
|
1670
1670
|
var _a, _b, _c, _d, _e;
|
|
1671
1671
|
const inlineId = this.inlineMessageId;
|
|
1672
1672
|
return inlineId !== undefined
|
|
1673
|
-
? this.api.editMessageReplyMarkupInline(inlineId, other)
|
|
1674
|
-
: this.api.editMessageReplyMarkup(orThrow(this.chatId, "editMessageReplyMarkup"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageReplyMarkup"), other, signal);
|
|
1673
|
+
? this.api.editMessageReplyMarkupInline(inlineId, { business_connection_id: this.businessConnectionId, ...other }, signal)
|
|
1674
|
+
: this.api.editMessageReplyMarkup(orThrow(this.chatId, "editMessageReplyMarkup"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "editMessageReplyMarkup"), { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1675
1675
|
}
|
|
1676
1676
|
/**
|
|
1677
1677
|
* Context-aware alias for `api.stopPoll`. Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.
|
|
@@ -1683,7 +1683,7 @@ class Context {
|
|
|
1683
1683
|
*/
|
|
1684
1684
|
stopPoll(other, signal) {
|
|
1685
1685
|
var _a, _b, _c, _d, _e;
|
|
1686
|
-
return this.api.stopPoll(orThrow(this.chatId, "stopPoll"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "stopPoll"), other, signal);
|
|
1686
|
+
return this.api.stopPoll(orThrow(this.chatId, "stopPoll"), orThrow((_d = (_b = (_a = this.msg) === null || _a === void 0 ? void 0 : _a.message_id) !== null && _b !== void 0 ? _b : (_c = this.messageReaction) === null || _c === void 0 ? void 0 : _c.message_id) !== null && _d !== void 0 ? _d : (_e = this.messageReactionCount) === null || _e === void 0 ? void 0 : _e.message_id, "stopPoll"), { business_connection_id: this.businessConnectionId, ...other }, signal);
|
|
1687
1687
|
}
|
|
1688
1688
|
/**
|
|
1689
1689
|
* Context-aware alias for `api.deleteMessage`. Use this method to delete a message, including service messages, with the following limitations:
|
|
@@ -48,20 +48,24 @@ export type LambdaAsyncAdapter = (event: {
|
|
|
48
48
|
body?: string;
|
|
49
49
|
headers: Record<string, string | undefined>;
|
|
50
50
|
}, _context: unknown) => ReqResHandler;
|
|
51
|
-
export type AzureAdapter = (
|
|
52
|
-
body?: unknown;
|
|
53
|
-
}, context: {
|
|
51
|
+
export type AzureAdapter = (context: {
|
|
54
52
|
res?: {
|
|
55
|
-
|
|
56
|
-
body: string;
|
|
57
|
-
headers?: Record<string, string>;
|
|
58
|
-
set?: (key: string, value: string) => void;
|
|
59
|
-
send?: {
|
|
60
|
-
(body: unknown): void;
|
|
61
|
-
(status: number, body: unknown): void;
|
|
62
|
-
};
|
|
53
|
+
[key: string]: any;
|
|
63
54
|
};
|
|
55
|
+
}, request: {
|
|
56
|
+
body?: unknown;
|
|
64
57
|
}) => ReqResHandler;
|
|
58
|
+
export type AzureAdapterV4 = (request: {
|
|
59
|
+
headers: {
|
|
60
|
+
get(name: string): string | null;
|
|
61
|
+
};
|
|
62
|
+
json(): Promise<unknown>;
|
|
63
|
+
}) => ReqResHandler<{
|
|
64
|
+
status: number;
|
|
65
|
+
body?: string;
|
|
66
|
+
} | {
|
|
67
|
+
jsonBody: string;
|
|
68
|
+
}>;
|
|
65
69
|
export type BunAdapter = (request: {
|
|
66
70
|
headers: Headers;
|
|
67
71
|
json: () => Promise<Update>;
|
|
@@ -191,6 +195,7 @@ export declare const adapters: {
|
|
|
191
195
|
"aws-lambda": LambdaAdapter;
|
|
192
196
|
"aws-lambda-async": LambdaAsyncAdapter;
|
|
193
197
|
azure: AzureAdapter;
|
|
198
|
+
"azure-v4": AzureAdapterV4;
|
|
194
199
|
bun: BunAdapter;
|
|
195
200
|
cloudflare: CloudflareAdapter;
|
|
196
201
|
"cloudflare-mod": CloudflareModuleAdapter;
|
|
@@ -48,8 +48,8 @@ const awsLambdaAsync = (event, _context) => {
|
|
|
48
48
|
}),
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
/** Azure Functions */
|
|
52
|
-
const azure = (
|
|
51
|
+
/** Azure Functions v3 and v4 */
|
|
52
|
+
const azure = (context, request) => {
|
|
53
53
|
var _a, _b;
|
|
54
54
|
return ({
|
|
55
55
|
update: Promise.resolve(request.body),
|
|
@@ -69,6 +69,19 @@ const azure = (request, context) => {
|
|
|
69
69
|
},
|
|
70
70
|
});
|
|
71
71
|
};
|
|
72
|
+
const azureV4 = (request) => {
|
|
73
|
+
let resolveResponse;
|
|
74
|
+
return {
|
|
75
|
+
update: Promise.resolve(request.json()),
|
|
76
|
+
header: request.headers.get(SECRET_HEADER) || undefined,
|
|
77
|
+
end: () => resolveResponse({ status: 204 }),
|
|
78
|
+
respond: (json) => resolveResponse({ jsonBody: json }),
|
|
79
|
+
unauthorized: () => resolveResponse({ status: 401, body: WRONG_TOKEN_ERROR }),
|
|
80
|
+
handlerReturn: new Promise((resolve) => {
|
|
81
|
+
resolveResponse = resolve;
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
72
85
|
/** Bun.serve */
|
|
73
86
|
const bun = (request) => {
|
|
74
87
|
let resolveResponse;
|
|
@@ -336,6 +349,7 @@ exports.adapters = {
|
|
|
336
349
|
"aws-lambda": awsLambda,
|
|
337
350
|
"aws-lambda-async": awsLambdaAsync,
|
|
338
351
|
azure,
|
|
352
|
+
"azure-v4": azureV4,
|
|
339
353
|
bun,
|
|
340
354
|
cloudflare,
|
|
341
355
|
"cloudflare-mod": cloudflareModule,
|
|
@@ -6,6 +6,7 @@ declare const adapters: {
|
|
|
6
6
|
"aws-lambda": import("./frameworks.js").LambdaAdapter;
|
|
7
7
|
"aws-lambda-async": import("./frameworks.js").LambdaAsyncAdapter;
|
|
8
8
|
azure: import("./frameworks.js").AzureAdapter;
|
|
9
|
+
"azure-v4": import("./frameworks.js").AzureAdapterV4;
|
|
9
10
|
bun: import("./frameworks.js").BunAdapter;
|
|
10
11
|
cloudflare: import("./frameworks.js").CloudflareAdapter;
|
|
11
12
|
"cloudflare-mod": import("./frameworks.js").CloudflareModuleAdapter;
|
package/out/core/api.d.ts
CHANGED
|
@@ -731,7 +731,7 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
731
731
|
*
|
|
732
732
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
|
733
733
|
*/
|
|
734
|
-
unpinChatMessage(chat_id: number | string, message_id?: number, signal?: AbortSignal): Promise<true>;
|
|
734
|
+
unpinChatMessage(chat_id: number | string, message_id?: number, other?: Other<R, "unpinChatMessage", "chat_id" | "message_id">, signal?: AbortSignal): Promise<true>;
|
|
735
735
|
/**
|
|
736
736
|
* Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
|
737
737
|
*
|
package/out/core/api.js
CHANGED
|
@@ -825,8 +825,8 @@ class Api {
|
|
|
825
825
|
*
|
|
826
826
|
* **Official reference:** https://core.telegram.org/bots/api#unpinchatmessage
|
|
827
827
|
*/
|
|
828
|
-
unpinChatMessage(chat_id, message_id, signal) {
|
|
829
|
-
return this.raw.unpinChatMessage({ chat_id, message_id }, signal);
|
|
828
|
+
unpinChatMessage(chat_id, message_id, other, signal) {
|
|
829
|
+
return this.raw.unpinChatMessage({ chat_id, message_id, ...other }, signal);
|
|
830
830
|
}
|
|
831
831
|
/**
|
|
832
832
|
* Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
|
package/out/filter.d.ts
CHANGED
|
@@ -853,7 +853,7 @@ export type FilterQuery = ComputeFilterQueryList;
|
|
|
853
853
|
* Any kind of value that appears in the Telegram Bot API. When intersected with
|
|
854
854
|
* an optional field, it effectively removes `| undefined`.
|
|
855
855
|
*/
|
|
856
|
-
type NotUndefined =
|
|
856
|
+
type NotUndefined = {};
|
|
857
857
|
/**
|
|
858
858
|
* Given a FilterQuery, returns an object that, when intersected with an Update,
|
|
859
859
|
* marks those properties as required that are guaranteed to exist.
|
package/out/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Bot, type BotConfig, BotError, type ErrorHandler, type PollingOptions, } from "./bot.js";
|
|
2
2
|
export { InputFile } from "./types.js";
|
|
3
|
-
export { type CallbackQueryContext, type ChatTypeContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type ReactionContext, } from "./context.js";
|
|
3
|
+
export { type CallbackQueryContext, type ChatTypeContext, type ChosenInlineResultContext, type CommandContext, Context, type GameQueryContext, type HearsContext, type InlineQueryContext, type ReactionContext, } from "./context.js";
|
|
4
4
|
export * from "./convenience/constants.js";
|
|
5
5
|
export * from "./convenience/inline_query.js";
|
|
6
6
|
export * from "./convenience/input_media.js";
|
package/out/web.mjs
CHANGED
|
@@ -800,14 +800,29 @@ class Context {
|
|
|
800
800
|
}
|
|
801
801
|
editMessageLiveLocation(latitude, longitude, other, signal) {
|
|
802
802
|
const inlineId = this.inlineMessageId;
|
|
803
|
-
return inlineId !== undefined ? this.api.editMessageLiveLocationInline(inlineId, latitude, longitude,
|
|
803
|
+
return inlineId !== undefined ? this.api.editMessageLiveLocationInline(inlineId, latitude, longitude, {
|
|
804
|
+
business_connection_id: this.businessConnectionId,
|
|
805
|
+
...other
|
|
806
|
+
}, signal) : this.api.editMessageLiveLocation(orThrow(this.chatId, "editMessageLiveLocation"), orThrow(this.msgId, "editMessageLiveLocation"), latitude, longitude, {
|
|
807
|
+
business_connection_id: this.businessConnectionId,
|
|
808
|
+
...other
|
|
809
|
+
}, signal);
|
|
804
810
|
}
|
|
805
811
|
stopMessageLiveLocation(other, signal) {
|
|
806
812
|
const inlineId = this.inlineMessageId;
|
|
807
|
-
return inlineId !== undefined ? this.api.stopMessageLiveLocationInline(inlineId,
|
|
813
|
+
return inlineId !== undefined ? this.api.stopMessageLiveLocationInline(inlineId, {
|
|
814
|
+
business_connection_id: this.businessConnectionId,
|
|
815
|
+
...other
|
|
816
|
+
}, signal) : this.api.stopMessageLiveLocation(orThrow(this.chatId, "stopMessageLiveLocation"), orThrow(this.msgId, "stopMessageLiveLocation"), {
|
|
817
|
+
business_connection_id: this.businessConnectionId,
|
|
818
|
+
...other
|
|
819
|
+
}, signal);
|
|
808
820
|
}
|
|
809
821
|
sendPaidMedia(star_count, media, other, signal) {
|
|
810
|
-
return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media,
|
|
822
|
+
return this.api.sendPaidMedia(orThrow(this.chatId, "sendPaidMedia"), star_count, media, {
|
|
823
|
+
business_connection_id: this.businessConnectionId,
|
|
824
|
+
...other
|
|
825
|
+
}, signal);
|
|
811
826
|
}
|
|
812
827
|
replyWithVenue(latitude, longitude, title, address, other, signal) {
|
|
813
828
|
return this.api.sendVenue(orThrow(this.chatId, "sendVenue"), latitude, longitude, title, address, {
|
|
@@ -948,10 +963,16 @@ class Context {
|
|
|
948
963
|
return this.api.setChatDescription(orThrow(this.chatId, "setChatDescription"), description, signal);
|
|
949
964
|
}
|
|
950
965
|
pinChatMessage(message_id, other, signal) {
|
|
951
|
-
return this.api.pinChatMessage(orThrow(this.chatId, "pinChatMessage"), message_id,
|
|
966
|
+
return this.api.pinChatMessage(orThrow(this.chatId, "pinChatMessage"), message_id, {
|
|
967
|
+
business_connection_id: this.businessConnectionId,
|
|
968
|
+
...other
|
|
969
|
+
}, signal);
|
|
952
970
|
}
|
|
953
|
-
unpinChatMessage(message_id, signal) {
|
|
954
|
-
return this.api.unpinChatMessage(orThrow(this.chatId, "unpinChatMessage"), message_id,
|
|
971
|
+
unpinChatMessage(message_id, other, signal) {
|
|
972
|
+
return this.api.unpinChatMessage(orThrow(this.chatId, "unpinChatMessage"), message_id, {
|
|
973
|
+
business_connection_id: this.businessConnectionId,
|
|
974
|
+
...other
|
|
975
|
+
}, signal);
|
|
955
976
|
}
|
|
956
977
|
unpinAllChatMessages(signal) {
|
|
957
978
|
return this.api.unpinAllChatMessages(orThrow(this.chatId, "unpinAllChatMessages"), signal);
|
|
@@ -1048,22 +1069,49 @@ class Context {
|
|
|
1048
1069
|
}
|
|
1049
1070
|
editMessageText(text, other, signal) {
|
|
1050
1071
|
const inlineId = this.inlineMessageId;
|
|
1051
|
-
return inlineId !== undefined ? this.api.editMessageTextInline(inlineId, text,
|
|
1072
|
+
return inlineId !== undefined ? this.api.editMessageTextInline(inlineId, text, {
|
|
1073
|
+
business_connection_id: this.businessConnectionId,
|
|
1074
|
+
...other
|
|
1075
|
+
}, signal) : this.api.editMessageText(orThrow(this.chatId, "editMessageText"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "editMessageText"), text, {
|
|
1076
|
+
business_connection_id: this.businessConnectionId,
|
|
1077
|
+
...other
|
|
1078
|
+
}, signal);
|
|
1052
1079
|
}
|
|
1053
1080
|
editMessageCaption(other, signal) {
|
|
1054
1081
|
const inlineId = this.inlineMessageId;
|
|
1055
|
-
return inlineId !== undefined ? this.api.editMessageCaptionInline(inlineId,
|
|
1082
|
+
return inlineId !== undefined ? this.api.editMessageCaptionInline(inlineId, {
|
|
1083
|
+
business_connection_id: this.businessConnectionId,
|
|
1084
|
+
...other
|
|
1085
|
+
}, signal) : this.api.editMessageCaption(orThrow(this.chatId, "editMessageCaption"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "editMessageCaption"), {
|
|
1086
|
+
business_connection_id: this.businessConnectionId,
|
|
1087
|
+
...other
|
|
1088
|
+
}, signal);
|
|
1056
1089
|
}
|
|
1057
1090
|
editMessageMedia(media, other, signal) {
|
|
1058
1091
|
const inlineId = this.inlineMessageId;
|
|
1059
|
-
return inlineId !== undefined ? this.api.editMessageMediaInline(inlineId, media,
|
|
1092
|
+
return inlineId !== undefined ? this.api.editMessageMediaInline(inlineId, media, {
|
|
1093
|
+
business_connection_id: this.businessConnectionId,
|
|
1094
|
+
...other
|
|
1095
|
+
}, signal) : this.api.editMessageMedia(orThrow(this.chatId, "editMessageMedia"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "editMessageMedia"), media, {
|
|
1096
|
+
business_connection_id: this.businessConnectionId,
|
|
1097
|
+
...other
|
|
1098
|
+
}, signal);
|
|
1060
1099
|
}
|
|
1061
1100
|
editMessageReplyMarkup(other, signal) {
|
|
1062
1101
|
const inlineId = this.inlineMessageId;
|
|
1063
|
-
return inlineId !== undefined ? this.api.editMessageReplyMarkupInline(inlineId,
|
|
1102
|
+
return inlineId !== undefined ? this.api.editMessageReplyMarkupInline(inlineId, {
|
|
1103
|
+
business_connection_id: this.businessConnectionId,
|
|
1104
|
+
...other
|
|
1105
|
+
}, signal) : this.api.editMessageReplyMarkup(orThrow(this.chatId, "editMessageReplyMarkup"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "editMessageReplyMarkup"), {
|
|
1106
|
+
business_connection_id: this.businessConnectionId,
|
|
1107
|
+
...other
|
|
1108
|
+
}, signal);
|
|
1064
1109
|
}
|
|
1065
1110
|
stopPoll(other, signal) {
|
|
1066
|
-
return this.api.stopPoll(orThrow(this.chatId, "stopPoll"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "stopPoll"),
|
|
1111
|
+
return this.api.stopPoll(orThrow(this.chatId, "stopPoll"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "stopPoll"), {
|
|
1112
|
+
business_connection_id: this.businessConnectionId,
|
|
1113
|
+
...other
|
|
1114
|
+
}, signal);
|
|
1067
1115
|
}
|
|
1068
1116
|
deleteMessage(signal) {
|
|
1069
1117
|
return this.api.deleteMessage(orThrow(this.chatId, "deleteMessage"), orThrow(this.msg?.message_id ?? this.messageReaction?.message_id ?? this.messageReactionCount?.message_id, "deleteMessage"), signal);
|
|
@@ -2852,10 +2900,11 @@ class Api {
|
|
|
2852
2900
|
...other
|
|
2853
2901
|
}, signal);
|
|
2854
2902
|
}
|
|
2855
|
-
unpinChatMessage(chat_id, message_id, signal) {
|
|
2903
|
+
unpinChatMessage(chat_id, message_id, other, signal) {
|
|
2856
2904
|
return this.raw.unpinChatMessage({
|
|
2857
2905
|
chat_id,
|
|
2858
|
-
message_id
|
|
2906
|
+
message_id,
|
|
2907
|
+
...other
|
|
2859
2908
|
}, signal);
|
|
2860
2909
|
}
|
|
2861
2910
|
unpinAllChatMessages(chat_id, signal) {
|
|
@@ -4756,7 +4805,7 @@ const awsLambdaAsync = (event, _context)=>{
|
|
|
4756
4805
|
})
|
|
4757
4806
|
};
|
|
4758
4807
|
};
|
|
4759
|
-
const azure = (
|
|
4808
|
+
const azure = (context, request)=>({
|
|
4760
4809
|
update: Promise.resolve(request.body),
|
|
4761
4810
|
header: context.res?.headers?.[SECRET_HEADER],
|
|
4762
4811
|
end: ()=>context.res = {
|
|
@@ -4771,6 +4820,26 @@ const azure = (request, context)=>({
|
|
|
4771
4820
|
context.res?.send?.(401, WRONG_TOKEN_ERROR);
|
|
4772
4821
|
}
|
|
4773
4822
|
});
|
|
4823
|
+
const azureV4 = (request)=>{
|
|
4824
|
+
let resolveResponse;
|
|
4825
|
+
return {
|
|
4826
|
+
update: Promise.resolve(request.json()),
|
|
4827
|
+
header: request.headers.get(SECRET_HEADER) || undefined,
|
|
4828
|
+
end: ()=>resolveResponse({
|
|
4829
|
+
status: 204
|
|
4830
|
+
}),
|
|
4831
|
+
respond: (json)=>resolveResponse({
|
|
4832
|
+
jsonBody: json
|
|
4833
|
+
}),
|
|
4834
|
+
unauthorized: ()=>resolveResponse({
|
|
4835
|
+
status: 401,
|
|
4836
|
+
body: WRONG_TOKEN_ERROR
|
|
4837
|
+
}),
|
|
4838
|
+
handlerReturn: new Promise((resolve)=>{
|
|
4839
|
+
resolveResponse = resolve;
|
|
4840
|
+
})
|
|
4841
|
+
};
|
|
4842
|
+
};
|
|
4774
4843
|
const bun = (request)=>{
|
|
4775
4844
|
let resolveResponse;
|
|
4776
4845
|
return {
|
|
@@ -5005,6 +5074,7 @@ const adapters = {
|
|
|
5005
5074
|
"aws-lambda": awsLambda,
|
|
5006
5075
|
"aws-lambda-async": awsLambdaAsync,
|
|
5007
5076
|
azure,
|
|
5077
|
+
"azure-v4": azureV4,
|
|
5008
5078
|
bun,
|
|
5009
5079
|
cloudflare,
|
|
5010
5080
|
"cloudflare-mod": cloudflareModule,
|