telegram-bot-api-nodejs 1.0.5 → 1.0.8
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 +5 -3
- package/index.js +5 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -486,7 +486,9 @@ interface BotCommand {
|
|
|
486
486
|
description: string;
|
|
487
487
|
}
|
|
488
488
|
export declare function setWebhook(token: string, body: SetWebHookOptions, signal: AbortSignal): Promise<Boolean>;
|
|
489
|
-
export declare function deleteWebhook(token: string,
|
|
489
|
+
export declare function deleteWebhook(token: string, params: {
|
|
490
|
+
drop_pending_updates?: boolean;
|
|
491
|
+
}, signal: AbortSignal): Promise<Boolean>;
|
|
490
492
|
/** @todo cehck if response is the same as in typings */
|
|
491
493
|
export declare function getWebhookInfo(token: string, signal: AbortSignal): Promise<WebhookInfo>;
|
|
492
494
|
export declare function getMe(token: string, signal: AbortSignal): Promise<User>;
|
|
@@ -618,8 +620,8 @@ export declare function parseCallbackQuery(v?: CallbackQuery): CallbackQuery | u
|
|
|
618
620
|
export declare function parseResponse<T>(response: Response): Promise<T>;
|
|
619
621
|
export declare class TelegramError extends Error {
|
|
620
622
|
status: number;
|
|
621
|
-
|
|
622
|
-
constructor(message: string, status: number,
|
|
623
|
+
data: Record<string, any>;
|
|
624
|
+
constructor(message: string, status: number, data?: Record<string, any>);
|
|
623
625
|
}
|
|
624
626
|
/**
|
|
625
627
|
* Helpers
|
package/index.js
CHANGED
|
@@ -13,10 +13,10 @@ export function setWebhook(token, body, signal) {
|
|
|
13
13
|
signal
|
|
14
14
|
}).then((parseResponse));
|
|
15
15
|
}
|
|
16
|
-
export function deleteWebhook(token, signal) {
|
|
16
|
+
export function deleteWebhook(token, params, signal) {
|
|
17
17
|
return fetch(`https://api.telegram.org/bot${token}/deleteWebhook`, {
|
|
18
18
|
method: "POST",
|
|
19
|
-
body: JSON.stringify(
|
|
19
|
+
body: JSON.stringify(params),
|
|
20
20
|
headers,
|
|
21
21
|
signal
|
|
22
22
|
}).then((parseResponse));
|
|
@@ -468,11 +468,11 @@ export function parseResponse(response) {
|
|
|
468
468
|
}
|
|
469
469
|
export class TelegramError extends Error {
|
|
470
470
|
status;
|
|
471
|
-
|
|
472
|
-
constructor(message, status,
|
|
471
|
+
data;
|
|
472
|
+
constructor(message, status, data = {}) {
|
|
473
473
|
super(message);
|
|
474
474
|
this.status = status;
|
|
475
|
-
this.
|
|
475
|
+
this.data = data;
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
/**
|