telegram-bot-api-nodejs 1.0.8 → 1.0.10
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 +41 -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;
|
|
@@ -111,6 +114,7 @@ export interface User {
|
|
|
111
114
|
last_name?: string;
|
|
112
115
|
username?: string;
|
|
113
116
|
language_code?: string;
|
|
117
|
+
is_premium?: boolean;
|
|
114
118
|
can_join_groups?: boolean;
|
|
115
119
|
supports_inline_queries?: boolean;
|
|
116
120
|
can_read_all_group_messages?: boolean;
|
|
@@ -264,6 +268,42 @@ export interface Voice extends FileBase {
|
|
|
264
268
|
duration: number;
|
|
265
269
|
mime_type?: string;
|
|
266
270
|
}
|
|
271
|
+
interface InputMediaBase {
|
|
272
|
+
media: string;
|
|
273
|
+
caption?: string;
|
|
274
|
+
parse_mode?: ParseMode;
|
|
275
|
+
}
|
|
276
|
+
export interface InputMediaAudio extends InputMediaBase {
|
|
277
|
+
type: "audio";
|
|
278
|
+
media: string;
|
|
279
|
+
caption?: string;
|
|
280
|
+
parse_mode?: ParseMode;
|
|
281
|
+
duration?: number;
|
|
282
|
+
performer?: string;
|
|
283
|
+
title?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface InputMediaDocument extends InputMediaBase {
|
|
286
|
+
type: "document";
|
|
287
|
+
media: string;
|
|
288
|
+
caption?: string;
|
|
289
|
+
parse_mode?: ParseMode;
|
|
290
|
+
}
|
|
291
|
+
export interface InputMediaPhoto extends InputMediaBase {
|
|
292
|
+
type: "photo";
|
|
293
|
+
media: string;
|
|
294
|
+
caption?: string;
|
|
295
|
+
parse_mode?: ParseMode;
|
|
296
|
+
}
|
|
297
|
+
export interface InputMediaVideo extends InputMediaBase {
|
|
298
|
+
type: "video";
|
|
299
|
+
caption?: string;
|
|
300
|
+
parse_mode?: ParseMode;
|
|
301
|
+
width?: number;
|
|
302
|
+
height?: number;
|
|
303
|
+
duration?: number;
|
|
304
|
+
supports_streaming?: boolean;
|
|
305
|
+
}
|
|
306
|
+
export type InputMedia = InputMediaPhoto | InputMediaVideo | InputMediaDocument | InputMediaPhoto;
|
|
267
307
|
export interface VideoNote extends FileBase {
|
|
268
308
|
length: number;
|
|
269
309
|
duration: number;
|
|
@@ -501,6 +541,7 @@ export declare function sendPhoto(token: string, payload: SendBasicOptions & {
|
|
|
501
541
|
}, signal: AbortSignal): Promise<Message>;
|
|
502
542
|
export declare function sendAnimation(token: string, payload: SendAnimationOptions, signal: AbortSignal): Promise<Message>;
|
|
503
543
|
export declare function sendDocument(token: string, payload: SendDocumentOptions, signal: AbortSignal): Promise<Message>;
|
|
544
|
+
export declare function sendMediaGroup(token: string, payload: SendMediaGroupOptions, signal: AbortSignal): Promise<Message[]>;
|
|
504
545
|
export declare function setMessageReaction(token: string, payload: {
|
|
505
546
|
chat_id: string | number;
|
|
506
547
|
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.10",
|
|
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
|
},
|