telegram-bot-api-nodejs 1.0.7 → 1.0.9
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 +43 -1
- package/index.js +10 -2
- package/package.json +2 -1
package/index.d.ts
CHANGED
|
@@ -33,6 +33,9 @@ interface SendDocumentOptions extends SendBasicOptions {
|
|
|
33
33
|
parse_mode?: ParseMode;
|
|
34
34
|
caption?: string;
|
|
35
35
|
}
|
|
36
|
+
interface SendMediaGroupOptions extends SendBasicOptions {
|
|
37
|
+
media: Array<InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo>;
|
|
38
|
+
}
|
|
36
39
|
export interface AnswerCallbackQueryOptions {
|
|
37
40
|
callback_query_id: string;
|
|
38
41
|
text?: string;
|
|
@@ -264,6 +267,42 @@ export interface Voice extends FileBase {
|
|
|
264
267
|
duration: number;
|
|
265
268
|
mime_type?: string;
|
|
266
269
|
}
|
|
270
|
+
interface InputMediaBase {
|
|
271
|
+
media: string;
|
|
272
|
+
caption?: string;
|
|
273
|
+
parse_mode?: ParseMode;
|
|
274
|
+
}
|
|
275
|
+
export interface InputMediaAudio extends InputMediaBase {
|
|
276
|
+
type: "audio";
|
|
277
|
+
media: string;
|
|
278
|
+
caption?: string;
|
|
279
|
+
parse_mode?: ParseMode;
|
|
280
|
+
duration?: number;
|
|
281
|
+
performer?: string;
|
|
282
|
+
title?: string;
|
|
283
|
+
}
|
|
284
|
+
export interface InputMediaDocument extends InputMediaBase {
|
|
285
|
+
type: "document";
|
|
286
|
+
media: string;
|
|
287
|
+
caption?: string;
|
|
288
|
+
parse_mode?: ParseMode;
|
|
289
|
+
}
|
|
290
|
+
export interface InputMediaPhoto extends InputMediaBase {
|
|
291
|
+
type: "photo";
|
|
292
|
+
media: string;
|
|
293
|
+
caption?: string;
|
|
294
|
+
parse_mode?: ParseMode;
|
|
295
|
+
}
|
|
296
|
+
export interface InputMediaVideo extends InputMediaBase {
|
|
297
|
+
type: "video";
|
|
298
|
+
caption?: string;
|
|
299
|
+
parse_mode?: ParseMode;
|
|
300
|
+
width?: number;
|
|
301
|
+
height?: number;
|
|
302
|
+
duration?: number;
|
|
303
|
+
supports_streaming?: boolean;
|
|
304
|
+
}
|
|
305
|
+
export type InputMedia = InputMediaPhoto | InputMediaVideo | InputMediaDocument | InputMediaPhoto;
|
|
267
306
|
export interface VideoNote extends FileBase {
|
|
268
307
|
length: number;
|
|
269
308
|
duration: number;
|
|
@@ -486,7 +525,9 @@ interface BotCommand {
|
|
|
486
525
|
description: string;
|
|
487
526
|
}
|
|
488
527
|
export declare function setWebhook(token: string, body: SetWebHookOptions, signal: AbortSignal): Promise<Boolean>;
|
|
489
|
-
export declare function deleteWebhook(token: string,
|
|
528
|
+
export declare function deleteWebhook(token: string, params: {
|
|
529
|
+
drop_pending_updates?: boolean;
|
|
530
|
+
}, signal: AbortSignal): Promise<Boolean>;
|
|
490
531
|
/** @todo cehck if response is the same as in typings */
|
|
491
532
|
export declare function getWebhookInfo(token: string, signal: AbortSignal): Promise<WebhookInfo>;
|
|
492
533
|
export declare function getMe(token: string, signal: AbortSignal): Promise<User>;
|
|
@@ -499,6 +540,7 @@ export declare function sendPhoto(token: string, payload: SendBasicOptions & {
|
|
|
499
540
|
}, signal: AbortSignal): Promise<Message>;
|
|
500
541
|
export declare function sendAnimation(token: string, payload: SendAnimationOptions, signal: AbortSignal): Promise<Message>;
|
|
501
542
|
export declare function sendDocument(token: string, payload: SendDocumentOptions, signal: AbortSignal): Promise<Message>;
|
|
543
|
+
export declare function sendMediaGroup(token: string, payload: SendMediaGroupOptions, signal: AbortSignal): Promise<Message[]>;
|
|
502
544
|
export declare function setMessageReaction(token: string, payload: {
|
|
503
545
|
chat_id: string | number;
|
|
504
546
|
message_id: number;
|
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));
|
|
@@ -78,6 +78,14 @@ export function sendDocument(token, payload, signal) {
|
|
|
78
78
|
signal
|
|
79
79
|
}).then((parseResponse));
|
|
80
80
|
}
|
|
81
|
+
export function sendMediaGroup(token, payload, signal) {
|
|
82
|
+
return fetch(`https://api.telegram.org/bot${token}/sendMediaGroup`, {
|
|
83
|
+
method: "POST",
|
|
84
|
+
body: JSON.stringify(payload),
|
|
85
|
+
headers,
|
|
86
|
+
signal
|
|
87
|
+
}).then((parseResponse));
|
|
88
|
+
}
|
|
81
89
|
export function setMessageReaction(token, payload, signal) {
|
|
82
90
|
return fetch(`https://api.telegram.org/bot${token}/setMessageReaction`, {
|
|
83
91
|
method: "POST",
|
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.9",
|
|
4
4
|
"description": "Telegram Bot API client for nodejs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"prepublishOnly": "npm run build",
|
|
17
17
|
"build": "tsc",
|
|
18
|
+
"watch": "tsc --watch",
|
|
18
19
|
"pretest": "npm run build",
|
|
19
20
|
"test": "node --test"
|
|
20
21
|
},
|