telegram-bot-api-nodejs 1.0.45 → 1.0.47
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 +2 -0
- package/index.js +10 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1111,6 +1111,8 @@ export declare function isTextMustBeNonEmptyError(err: unknown): boolean;
|
|
|
1111
1111
|
export declare function isTooManyRequestsError(err: unknown): boolean;
|
|
1112
1112
|
export declare function isMessageTooLongError(err: unknown): boolean;
|
|
1113
1113
|
export declare function isMessageCaptionTooLongError(err: unknown): boolean;
|
|
1114
|
+
export declare function isWebpageCurlFailedError(err: unknown): boolean;
|
|
1115
|
+
export declare function isWrongFileUrlError(err: unknown): boolean;
|
|
1114
1116
|
export declare function parseRetryAfterTime(err: unknown): number;
|
|
1115
1117
|
export declare function resolveNameFromMessageOrigin(messageOrigin: MessageOrigin): string;
|
|
1116
1118
|
export declare function resolveChatName(chat: any): 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: response.url.replace(/bot[\d]+\:[^\/]+/ig, "*")
|
|
531
|
+
});
|
|
529
532
|
throw new TelegramError(description, error_code, parameters);
|
|
530
533
|
});
|
|
531
534
|
}
|
|
@@ -583,6 +586,12 @@ export function isMessageTooLongError(err) {
|
|
|
583
586
|
export function isMessageCaptionTooLongError(err) {
|
|
584
587
|
return err instanceof Error && err.message.includes("message caption is too long");
|
|
585
588
|
}
|
|
589
|
+
export function isWebpageCurlFailedError(err) {
|
|
590
|
+
return err instanceof Error && err.message.includes("WEBPAGE_CURL_FAILED");
|
|
591
|
+
}
|
|
592
|
+
export function isWrongFileUrlError(err) {
|
|
593
|
+
return err instanceof Error && err.message.includes("Wrong file identifier/HTTP URL specified");
|
|
594
|
+
}
|
|
586
595
|
export function parseRetryAfterTime(err) {
|
|
587
596
|
if (!(err instanceof Error)) {
|
|
588
597
|
throw new RangeError("`err` needs to be an Error");
|