grammy 1.38.2 → 1.38.4
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/bot.d.ts +1 -1
- package/out/bot.js +1 -0
- package/out/context.d.ts +4 -2
- package/out/context.js +2 -4
- package/out/convenience/constants.d.ts +1 -1
- package/out/convenience/frameworks.d.ts +14 -6
- package/out/convenience/frameworks.js +1 -1
- package/out/core/api.d.ts +6 -2
- package/out/web.mjs +75 -31
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -323,7 +323,7 @@ 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/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>
|
|
324
324
|
<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
325
|
<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>
|
|
326
|
-
<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>
|
|
326
|
+
<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> <a href="https://github.com/grammyjs/grammY/commits?author=rtyt3000" title="Documentation">📖</a></td>
|
|
327
327
|
<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>
|
|
328
328
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/eddienubes"><img src="https://avatars.githubusercontent.com/u/53977359?v=4?s=100" width="100px;" alt="Dmytro Tiapukhin"/><br /><sub><b>Dmytro Tiapukhin</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=eddienubes" title="Documentation">📖</a></td>
|
|
329
329
|
</tr>
|
|
@@ -331,6 +331,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
331
331
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/Arctomachine"><img src="https://avatars.githubusercontent.com/u/29041820?v=4?s=100" width="100px;" alt="Alexander"/><br /><sub><b>Alexander</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Arctomachine" title="Documentation">📖</a></td>
|
|
332
332
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/OfficialCodinary"><img src="https://avatars.githubusercontent.com/u/133005277?v=4?s=100" width="100px;" alt="Codinary"/><br /><sub><b>Codinary</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AOfficialCodinary" title="Reviewed Pull Requests">👀</a></td>
|
|
333
333
|
<td align="center" valign="top" width="11.11%"><a href="https://github.com/dotvhs"><img src="https://avatars.githubusercontent.com/u/681416?v=4?s=100" width="100px;" alt=".vhs"/><br /><sub><b>.vhs</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Adotvhs" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Adotvhs" title="Reviewed Pull Requests">👀</a></td>
|
|
334
|
+
<td align="center" valign="top" width="11.11%"><a href="https://agou.im/"><img src="https://avatars.githubusercontent.com/u/55237525?v=4?s=100" width="100px;" alt="agoudbg"/><br /><sub><b>agoudbg</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aagoudbg" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=agoudbg" title="Code">💻</a></td>
|
|
334
335
|
</tr>
|
|
335
336
|
</tbody>
|
|
336
337
|
</table>
|
package/out/bot.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Api } from "./core/api.js";
|
|
|
4
4
|
import { type ApiClientOptions, type WebhookReplyEnvelope } from "./core/client.js";
|
|
5
5
|
import { type Filter, type FilterQuery } from "./filter.js";
|
|
6
6
|
import { type ReactionType, type ReactionTypeEmoji, type Update, type UserFromGetMe } from "./types.js";
|
|
7
|
-
export declare const DEFAULT_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost"];
|
|
7
|
+
export declare const DEFAULT_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "purchased_paid_media", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost"];
|
|
8
8
|
/**
|
|
9
9
|
* Options that can be specified when running the bot via simple long polling.
|
|
10
10
|
*/
|
package/out/bot.js
CHANGED
package/out/context.d.ts
CHANGED
|
@@ -1079,7 +1079,7 @@ export declare class Context implements RenamedUpdate {
|
|
|
1079
1079
|
* **Official reference:** https://core.telegram.org/bots/api#getchatadministrators
|
|
1080
1080
|
*/
|
|
1081
1081
|
getChatAdministrators(signal?: AbortSignal): Promise<(import("@grammyjs/types/manage.js").ChatMemberOwner | import("@grammyjs/types/manage.js").ChatMemberAdministrator)[]>;
|
|
1082
|
-
/** @deprecated Use `
|
|
1082
|
+
/** @deprecated Use `getChatMemberCount` instead. */
|
|
1083
1083
|
getChatMembersCount(...args: Parameters<Context["getChatMemberCount"]>): Promise<number>;
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Context-aware alias for `api.getChatMemberCount`. Use this method to get the number of members in a chat. Returns Int on success.
|
|
@@ -1279,7 +1279,9 @@ export declare class Context implements RenamedUpdate {
|
|
|
1279
1279
|
*/
|
|
1280
1280
|
editMessageText(text: string, other?: Other<"editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (Update.Edited & Message.CommonMessage & {
|
|
1281
1281
|
text: string;
|
|
1282
|
-
}
|
|
1282
|
+
} & Partial<{
|
|
1283
|
+
entities: MessageEntity[];
|
|
1284
|
+
}>)>;
|
|
1283
1285
|
/**
|
|
1284
1286
|
* 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.
|
|
1285
1287
|
*
|
package/out/context.js
CHANGED
|
@@ -1119,9 +1119,7 @@ class Context {
|
|
|
1119
1119
|
const msg = this.msg;
|
|
1120
1120
|
return this.api.sendChatAction(orThrow(this.chatId, "sendChatAction"), action, {
|
|
1121
1121
|
business_connection_id: this.businessConnectionId,
|
|
1122
|
-
|
|
1123
|
-
? { message_thread_id: msg === null || msg === void 0 ? void 0 : msg.message_thread_id }
|
|
1124
|
-
: {}),
|
|
1122
|
+
message_thread_id: msg === null || msg === void 0 ? void 0 : msg.message_thread_id,
|
|
1125
1123
|
...other,
|
|
1126
1124
|
}, signal);
|
|
1127
1125
|
}
|
|
@@ -1572,7 +1570,7 @@ class Context {
|
|
|
1572
1570
|
getChatAdministrators(signal) {
|
|
1573
1571
|
return this.api.getChatAdministrators(orThrow(this.chatId, "getChatAdministrators"), signal);
|
|
1574
1572
|
}
|
|
1575
|
-
/** @deprecated Use `
|
|
1573
|
+
/** @deprecated Use `getChatMemberCount` instead. */
|
|
1576
1574
|
getChatMembersCount(...args) {
|
|
1577
1575
|
return this.getChatMemberCount(...args);
|
|
1578
1576
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_UPDATE_TYPES } from "../bot.js";
|
|
2
|
-
declare const ALL_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost", "chat_member", "message_reaction", "message_reaction_count"];
|
|
2
|
+
declare const ALL_UPDATE_TYPES: readonly ["message", "edited_message", "channel_post", "edited_channel_post", "business_connection", "business_message", "edited_business_message", "deleted_business_messages", "inline_query", "chosen_inline_result", "callback_query", "shipping_query", "pre_checkout_query", "purchased_paid_media", "poll", "poll_answer", "my_chat_member", "chat_join_request", "chat_boost", "removed_chat_boost", "chat_member", "message_reaction", "message_reaction_count"];
|
|
3
3
|
declare const ALL_CHAT_PERMISSIONS: {
|
|
4
4
|
readonly is_anonymous: true;
|
|
5
5
|
readonly can_manage_chat: true;
|
|
@@ -69,19 +69,27 @@ export type AzureAdapterV4 = (request: {
|
|
|
69
69
|
}>;
|
|
70
70
|
export type BunAdapter = (request: {
|
|
71
71
|
headers: Headers;
|
|
72
|
-
json: () => Promise<
|
|
72
|
+
json: () => Promise<unknown>;
|
|
73
73
|
}) => ReqResHandler<Response>;
|
|
74
74
|
export type CloudflareAdapter = (event: {
|
|
75
|
-
request:
|
|
75
|
+
request: Body & {
|
|
76
|
+
method: string;
|
|
77
|
+
url: string;
|
|
78
|
+
headers: Headers;
|
|
79
|
+
};
|
|
76
80
|
respondWith: (response: Promise<Response>) => void;
|
|
77
81
|
}) => ReqResHandler;
|
|
78
|
-
export type CloudflareModuleAdapter = (request:
|
|
82
|
+
export type CloudflareModuleAdapter = (request: Body & {
|
|
83
|
+
method: string;
|
|
84
|
+
url: string;
|
|
85
|
+
headers: Headers;
|
|
86
|
+
}) => ReqResHandler<Response>;
|
|
79
87
|
export type ElysiaAdapter = (ctx: {
|
|
80
|
-
body:
|
|
88
|
+
body: unknown;
|
|
81
89
|
headers: Record<string, string | undefined>;
|
|
82
90
|
set: {
|
|
83
|
-
headers: Record<string, string>;
|
|
84
|
-
status
|
|
91
|
+
headers: Record<string, string | number>;
|
|
92
|
+
status?: string | number;
|
|
85
93
|
};
|
|
86
94
|
}) => ReqResHandler<string>;
|
|
87
95
|
export type ExpressAdapter = (req: {
|
|
@@ -167,7 +167,7 @@ const fastify = (request, reply) => ({
|
|
|
167
167
|
return request.body;
|
|
168
168
|
},
|
|
169
169
|
header: request.headers[SECRET_HEADER_LOWERCASE],
|
|
170
|
-
end: () => reply.
|
|
170
|
+
end: () => reply.send(""),
|
|
171
171
|
respond: (json) => reply.headers({ "Content-Type": "application/json" }).send(json),
|
|
172
172
|
unauthorized: () => reply.code(401).send(WRONG_TOKEN_ERROR),
|
|
173
173
|
});
|
package/out/core/api.d.ts
CHANGED
|
@@ -1134,7 +1134,9 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1134
1134
|
*/
|
|
1135
1135
|
editMessageText(chat_id: number | string, message_id: number, text: string, other?: Other<R, "editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
|
|
1136
1136
|
text: string;
|
|
1137
|
-
}
|
|
1137
|
+
} & Partial<{
|
|
1138
|
+
entities: import("@grammyjs/types/message.js").MessageEntity[];
|
|
1139
|
+
}>)>;
|
|
1138
1140
|
/**
|
|
1139
1141
|
* Use this method to edit text and game inline 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.
|
|
1140
1142
|
*
|
|
@@ -1146,7 +1148,9 @@ export declare class Api<R extends RawApi = RawApi> {
|
|
|
1146
1148
|
*/
|
|
1147
1149
|
editMessageTextInline(inline_message_id: string, text: string, other?: Other<R, "editMessageText", "chat_id" | "message_id" | "inline_message_id" | "text">, signal?: AbortSignal): Promise<true | (import("@grammyjs/types/update.js").Update.Edited & import("@grammyjs/types/message.js").Message.CommonMessage & {
|
|
1148
1150
|
text: string;
|
|
1149
|
-
}
|
|
1151
|
+
} & Partial<{
|
|
1152
|
+
entities: import("@grammyjs/types/message.js").MessageEntity[];
|
|
1153
|
+
}>)>;
|
|
1150
1154
|
/**
|
|
1151
1155
|
* 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.
|
|
1152
1156
|
*
|
package/out/web.mjs
CHANGED
|
@@ -971,9 +971,7 @@ class Context {
|
|
|
971
971
|
const msg = this.msg;
|
|
972
972
|
return this.api.sendChatAction(orThrow(this.chatId, "sendChatAction"), action, {
|
|
973
973
|
business_connection_id: this.businessConnectionId,
|
|
974
|
-
|
|
975
|
-
message_thread_id: msg?.message_thread_id
|
|
976
|
-
} : {},
|
|
974
|
+
message_thread_id: msg?.message_thread_id,
|
|
977
975
|
...other
|
|
978
976
|
}, signal);
|
|
979
977
|
}
|
|
@@ -1972,50 +1970,64 @@ function setup(env) {
|
|
|
1972
1970
|
createDebug.namespaces = namespaces;
|
|
1973
1971
|
createDebug.names = [];
|
|
1974
1972
|
createDebug.skips = [];
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1973
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
1974
|
+
for (const ns of split){
|
|
1975
|
+
if (ns[0] === "-") {
|
|
1976
|
+
createDebug.skips.push(ns.slice(1));
|
|
1977
|
+
} else {
|
|
1978
|
+
createDebug.names.push(ns);
|
|
1981
1979
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
function matchesTemplate(search, template) {
|
|
1983
|
+
let searchIndex = 0;
|
|
1984
|
+
let templateIndex = 0;
|
|
1985
|
+
let starIndex = -1;
|
|
1986
|
+
let matchIndex = 0;
|
|
1987
|
+
while(searchIndex < search.length){
|
|
1988
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
1989
|
+
if (template[templateIndex] === "*") {
|
|
1990
|
+
starIndex = templateIndex;
|
|
1991
|
+
matchIndex = searchIndex;
|
|
1992
|
+
templateIndex++;
|
|
1993
|
+
} else {
|
|
1994
|
+
searchIndex++;
|
|
1995
|
+
templateIndex++;
|
|
1996
|
+
}
|
|
1997
|
+
} else if (starIndex !== -1) {
|
|
1998
|
+
templateIndex = starIndex + 1;
|
|
1999
|
+
matchIndex++;
|
|
2000
|
+
searchIndex = matchIndex;
|
|
1985
2001
|
} else {
|
|
1986
|
-
|
|
2002
|
+
return false;
|
|
1987
2003
|
}
|
|
1988
2004
|
}
|
|
2005
|
+
while(templateIndex < template.length && template[templateIndex] === "*"){
|
|
2006
|
+
templateIndex++;
|
|
2007
|
+
}
|
|
2008
|
+
return templateIndex === template.length;
|
|
1989
2009
|
}
|
|
1990
2010
|
function disable() {
|
|
1991
2011
|
const namespaces = [
|
|
1992
|
-
...createDebug.names
|
|
1993
|
-
...createDebug.skips.map(
|
|
2012
|
+
...createDebug.names,
|
|
2013
|
+
...createDebug.skips.map((namespace)=>"-" + namespace)
|
|
1994
2014
|
].join(",");
|
|
1995
2015
|
createDebug.enable("");
|
|
1996
2016
|
return namespaces;
|
|
1997
2017
|
}
|
|
1998
2018
|
function enabled(name) {
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
}
|
|
2002
|
-
let i;
|
|
2003
|
-
let len;
|
|
2004
|
-
for(i = 0, len = createDebug.skips.length; i < len; i++){
|
|
2005
|
-
if (createDebug.skips[i].test(name)) {
|
|
2019
|
+
for (const skip of createDebug.skips){
|
|
2020
|
+
if (matchesTemplate(name, skip)) {
|
|
2006
2021
|
return false;
|
|
2007
2022
|
}
|
|
2008
2023
|
}
|
|
2009
|
-
for(
|
|
2010
|
-
if (
|
|
2024
|
+
for (const ns of createDebug.names){
|
|
2025
|
+
if (matchesTemplate(name, ns)) {
|
|
2011
2026
|
return true;
|
|
2012
2027
|
}
|
|
2013
2028
|
}
|
|
2014
2029
|
return false;
|
|
2015
2030
|
}
|
|
2016
|
-
function toNamespace(regexp) {
|
|
2017
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
2018
|
-
}
|
|
2019
2031
|
function coerce(val) {
|
|
2020
2032
|
if (val instanceof Error) {
|
|
2021
2033
|
return val.stack || val.message;
|
|
@@ -2129,7 +2141,8 @@ var browser$1 = createCommonjsModule(function(module, exports) {
|
|
|
2129
2141
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
2130
2142
|
return false;
|
|
2131
2143
|
}
|
|
2132
|
-
|
|
2144
|
+
let m;
|
|
2145
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
2133
2146
|
}
|
|
2134
2147
|
function formatArgs2(args) {
|
|
2135
2148
|
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
@@ -2164,7 +2177,7 @@ var browser$1 = createCommonjsModule(function(module, exports) {
|
|
|
2164
2177
|
function load2() {
|
|
2165
2178
|
let r;
|
|
2166
2179
|
try {
|
|
2167
|
-
r = exports.storage.getItem("debug");
|
|
2180
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
2168
2181
|
} catch (error) {}
|
|
2169
2182
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
2170
2183
|
r = process.env.DEBUG;
|
|
@@ -2255,7 +2268,12 @@ function toHttpError(method, sensitiveLogs) {
|
|
|
2255
2268
|
throw new HttpError(msg, err);
|
|
2256
2269
|
};
|
|
2257
2270
|
}
|
|
2258
|
-
|
|
2271
|
+
function checkWindows() {
|
|
2272
|
+
const global = globalThis;
|
|
2273
|
+
const os = global.Deno?.build?.os;
|
|
2274
|
+
return typeof os === "string" ? os === "windows" : global.navigator?.platform?.startsWith("Win") ?? global.process?.platform?.startsWith("win") ?? false;
|
|
2275
|
+
}
|
|
2276
|
+
const isWindows = checkWindows();
|
|
2259
2277
|
function assertPath(path) {
|
|
2260
2278
|
if (typeof path !== "string") {
|
|
2261
2279
|
throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
|
|
@@ -2296,6 +2314,17 @@ function assertArgs(path, suffix) {
|
|
|
2296
2314
|
throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`);
|
|
2297
2315
|
}
|
|
2298
2316
|
}
|
|
2317
|
+
function assertArg(url) {
|
|
2318
|
+
url = url instanceof URL ? url : new URL(url);
|
|
2319
|
+
if (url.protocol !== "file:") {
|
|
2320
|
+
throw new TypeError(`URL must be a file URL: received "${url.protocol}"`);
|
|
2321
|
+
}
|
|
2322
|
+
return url;
|
|
2323
|
+
}
|
|
2324
|
+
function fromFileUrl(url) {
|
|
2325
|
+
url = assertArg(url);
|
|
2326
|
+
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
|
|
2327
|
+
}
|
|
2299
2328
|
function stripTrailingSeparators(segment, isSep) {
|
|
2300
2329
|
if (segment.length <= 1) {
|
|
2301
2330
|
return segment;
|
|
@@ -2314,6 +2343,9 @@ function isPosixPathSeparator(code) {
|
|
|
2314
2343
|
return code === 47;
|
|
2315
2344
|
}
|
|
2316
2345
|
function basename(path, suffix = "") {
|
|
2346
|
+
if (path instanceof URL) {
|
|
2347
|
+
path = fromFileUrl(path);
|
|
2348
|
+
}
|
|
2317
2349
|
assertArgs(path, suffix);
|
|
2318
2350
|
const lastSegment = lastPathSegment(path, isPosixPathSeparator);
|
|
2319
2351
|
const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
|
|
@@ -2325,7 +2357,18 @@ function isPathSeparator(code) {
|
|
|
2325
2357
|
function isWindowsDeviceRoot(code) {
|
|
2326
2358
|
return code >= 97 && code <= 122 || code >= 65 && code <= 90;
|
|
2327
2359
|
}
|
|
2360
|
+
function fromFileUrl1(url) {
|
|
2361
|
+
url = assertArg(url);
|
|
2362
|
+
let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\");
|
|
2363
|
+
if (url.hostname !== "") {
|
|
2364
|
+
path = `\\\\${url.hostname}${path}`;
|
|
2365
|
+
}
|
|
2366
|
+
return path;
|
|
2367
|
+
}
|
|
2328
2368
|
function basename1(path, suffix = "") {
|
|
2369
|
+
if (path instanceof URL) {
|
|
2370
|
+
path = fromFileUrl1(path);
|
|
2371
|
+
}
|
|
2329
2372
|
assertArgs(path, suffix);
|
|
2330
2373
|
let start = 0;
|
|
2331
2374
|
if (path.length >= 2) {
|
|
@@ -3793,6 +3836,7 @@ const DEFAULT_UPDATE_TYPES = [
|
|
|
3793
3836
|
"callback_query",
|
|
3794
3837
|
"shipping_query",
|
|
3795
3838
|
"pre_checkout_query",
|
|
3839
|
+
"purchased_paid_media",
|
|
3796
3840
|
"poll",
|
|
3797
3841
|
"poll_answer",
|
|
3798
3842
|
"my_chat_member",
|
|
@@ -5267,7 +5311,7 @@ const fastify = (request, reply)=>({
|
|
|
5267
5311
|
return request.body;
|
|
5268
5312
|
},
|
|
5269
5313
|
header: request.headers[SECRET_HEADER_LOWERCASE],
|
|
5270
|
-
end: ()=>reply.
|
|
5314
|
+
end: ()=>reply.send(""),
|
|
5271
5315
|
respond: (json)=>reply.headers({
|
|
5272
5316
|
"Content-Type": "application/json"
|
|
5273
5317
|
}).send(json),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grammy",
|
|
3
3
|
"description": "The Telegram Bot Framework.",
|
|
4
|
-
"version": "1.38.
|
|
4
|
+
"version": "1.38.4",
|
|
5
5
|
"author": "KnorpelSenf",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"backport": "deno2node tsconfig.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@grammyjs/types": "3.22.
|
|
20
|
+
"@grammyjs/types": "3.22.2",
|
|
21
21
|
"abort-controller": "^3.0.0",
|
|
22
|
-
"debug": "^4.3
|
|
22
|
+
"debug": "^4.4.3",
|
|
23
23
|
"node-fetch": "^2.7.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/debug": "^4.1.12",
|
|
27
27
|
"@types/node": "^12.20.55",
|
|
28
28
|
"@types/node-fetch": "2.6.2",
|
|
29
|
-
"deno2node": "^1.
|
|
29
|
+
"deno2node": "^1.16.0"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"out/"
|