telegram-bot-api-nodejs 1.0.46 → 1.0.48
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/index.d.ts +1 -0
- package/index.js +9 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1116,6 +1116,7 @@ export declare function isWrongFileUrlError(err: unknown): boolean;
|
|
|
1116
1116
|
export declare function parseRetryAfterTime(err: unknown): number;
|
|
1117
1117
|
export declare function resolveNameFromMessageOrigin(messageOrigin: MessageOrigin): string;
|
|
1118
1118
|
export declare function resolveChatName(chat: any): string;
|
|
1119
|
+
export declare function removeTokenFromUrl(url: string): string;
|
|
1119
1120
|
export declare namespace currencies {
|
|
1120
1121
|
interface Currency {
|
|
1121
1122
|
code: string;
|
package/index.js
CHANGED
|
@@ -525,7 +525,10 @@ export function parseResponse(response) {
|
|
|
525
525
|
}
|
|
526
526
|
const error_code = Number(data.error_code ?? 0);
|
|
527
527
|
const description = String(data.description ?? "");
|
|
528
|
-
const parameters = data.parameters || {}
|
|
528
|
+
const parameters = Object.assign(data.parameters || {}, {
|
|
529
|
+
text,
|
|
530
|
+
url: removeTokenFromUrl(response.url)
|
|
531
|
+
});
|
|
529
532
|
throw new TelegramError(description, error_code, parameters);
|
|
530
533
|
});
|
|
531
534
|
}
|
|
@@ -626,6 +629,11 @@ export function resolveChatName(chat) {
|
|
|
626
629
|
`${chat.title}`.trim() ||
|
|
627
630
|
`@${chat.username || ""}`.trim();
|
|
628
631
|
}
|
|
632
|
+
export function removeTokenFromUrl(url) {
|
|
633
|
+
return String(url).replace(/bot([\d]+)\:([^\/]+)/ig, function (match, botId, token) {
|
|
634
|
+
return `bot${botId}:${"*".repeat(token.length)}`;
|
|
635
|
+
});
|
|
636
|
+
}
|
|
629
637
|
export var currencies;
|
|
630
638
|
(function (currencies_1) {
|
|
631
639
|
const __dirname = import.meta.dirname;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "telegram-bot-api-nodejs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.48",
|
|
4
4
|
"description": "Telegram Bot API client for nodejs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"prepublishOnly": "npm run build",
|
|
18
|
+
"prepublishOnly": "npm run build && node --test",
|
|
19
19
|
"build": "tsc",
|
|
20
20
|
"watch": "tsc --watch",
|
|
21
21
|
"pretest": "npm run build",
|