telegram-bot-api-nodejs 1.0.47 → 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 +6 -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
|
@@ -527,7 +527,7 @@ export function parseResponse(response) {
|
|
|
527
527
|
const description = String(data.description ?? "");
|
|
528
528
|
const parameters = Object.assign(data.parameters || {}, {
|
|
529
529
|
text,
|
|
530
|
-
url: response.url
|
|
530
|
+
url: removeTokenFromUrl(response.url)
|
|
531
531
|
});
|
|
532
532
|
throw new TelegramError(description, error_code, parameters);
|
|
533
533
|
});
|
|
@@ -629,6 +629,11 @@ export function resolveChatName(chat) {
|
|
|
629
629
|
`${chat.title}`.trim() ||
|
|
630
630
|
`@${chat.username || ""}`.trim();
|
|
631
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
|
+
}
|
|
632
637
|
export var currencies;
|
|
633
638
|
(function (currencies_1) {
|
|
634
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",
|