telegram-bot-api-nodejs 1.0.8 → 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 +40 -0
- package/index.js +8 -0
- 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;
|
|
@@ -501,6 +540,7 @@ export declare function sendPhoto(token: string, payload: SendBasicOptions & {
|
|
|
501
540
|
}, signal: AbortSignal): Promise<Message>;
|
|
502
541
|
export declare function sendAnimation(token: string, payload: SendAnimationOptions, signal: AbortSignal): Promise<Message>;
|
|
503
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[]>;
|
|
504
544
|
export declare function setMessageReaction(token: string, payload: {
|
|
505
545
|
chat_id: string | number;
|
|
506
546
|
message_id: number;
|
package/index.js
CHANGED
|
@@ -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
|
},
|