telegram-bot-api-nodejs 1.0.48 → 1.0.50
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 +4 -0
- package/index.js +11 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1073,6 +1073,9 @@ export declare function getFile(token: string, payload: {
|
|
|
1073
1073
|
file_id: string;
|
|
1074
1074
|
}, signal: AbortSignal): Promise<File>;
|
|
1075
1075
|
export declare function answerCallbackQuery(token: string, payload: AnswerCallbackQueryOptions, signal: AbortSignal): Promise<File>;
|
|
1076
|
+
export declare function leaveChat(token: string, payload: {
|
|
1077
|
+
chat_id: string;
|
|
1078
|
+
}, signal: AbortSignal): Promise<true>;
|
|
1076
1079
|
export declare function getChat(token: string, payload: {
|
|
1077
1080
|
chat_id: string;
|
|
1078
1081
|
}, signal: AbortSignal): Promise<Chat>;
|
|
@@ -1113,6 +1116,7 @@ export declare function isMessageTooLongError(err: unknown): boolean;
|
|
|
1113
1116
|
export declare function isMessageCaptionTooLongError(err: unknown): boolean;
|
|
1114
1117
|
export declare function isWebpageCurlFailedError(err: unknown): boolean;
|
|
1115
1118
|
export declare function isWrongFileUrlError(err: unknown): boolean;
|
|
1119
|
+
export declare function isBadGatewayError(err: unknown): boolean;
|
|
1116
1120
|
export declare function parseRetryAfterTime(err: unknown): number;
|
|
1117
1121
|
export declare function resolveNameFromMessageOrigin(messageOrigin: MessageOrigin): string;
|
|
1118
1122
|
export declare function resolveChatName(chat: any): string;
|
package/index.js
CHANGED
|
@@ -151,6 +151,14 @@ export function answerCallbackQuery(token, payload, signal) {
|
|
|
151
151
|
signal
|
|
152
152
|
}).then((parseResponse));
|
|
153
153
|
}
|
|
154
|
+
export function leaveChat(token, payload, signal) {
|
|
155
|
+
return fetch(`https://api.telegram.org/bot${token}/leaveChat`, {
|
|
156
|
+
method: "POST",
|
|
157
|
+
body: JSON.stringify(payload),
|
|
158
|
+
headers,
|
|
159
|
+
signal
|
|
160
|
+
}).then((parseResponse));
|
|
161
|
+
}
|
|
154
162
|
export function getChat(token, payload, signal) {
|
|
155
163
|
return fetch(`https://api.telegram.org/bot${token}/getChat`, {
|
|
156
164
|
method: "POST",
|
|
@@ -592,6 +600,9 @@ export function isWebpageCurlFailedError(err) {
|
|
|
592
600
|
export function isWrongFileUrlError(err) {
|
|
593
601
|
return err instanceof Error && err.message.includes("Wrong file identifier/HTTP URL specified");
|
|
594
602
|
}
|
|
603
|
+
export function isBadGatewayError(err) {
|
|
604
|
+
return err instanceof Error && err.message === "Bad Gateway";
|
|
605
|
+
}
|
|
595
606
|
export function parseRetryAfterTime(err) {
|
|
596
607
|
if (!(err instanceof Error)) {
|
|
597
608
|
throw new RangeError("`err` needs to be an Error");
|