telegram-bot-api-nodejs 1.0.2 → 1.0.3
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 +6 -10
- package/index.js +11 -14
- package/package.json +11 -4
- package/index.ts +0 -1617
- package/tsconfig.json +0 -8
package/index.d.ts
CHANGED
|
@@ -23,12 +23,7 @@ export interface SendMessageOptions extends SendBasicOptions {
|
|
|
23
23
|
disable_web_page_preview?: boolean;
|
|
24
24
|
entities?: MessageEntity[];
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
photo: string;
|
|
28
|
-
parse_mode?: ParseMode;
|
|
29
|
-
caption?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface SendAnimationOptions extends SendBasicOptions {
|
|
26
|
+
interface SendAnimationOptions extends SendBasicOptions {
|
|
32
27
|
animation: string;
|
|
33
28
|
parse_mode?: ParseMode;
|
|
34
29
|
caption?: string;
|
|
@@ -490,9 +485,6 @@ interface BotCommand {
|
|
|
490
485
|
command: string;
|
|
491
486
|
description: string;
|
|
492
487
|
}
|
|
493
|
-
/**
|
|
494
|
-
* Methods
|
|
495
|
-
*/
|
|
496
488
|
export declare function setWebhook(token: string, body: SetWebHookOptions, signal: AbortSignal): Promise<Boolean>;
|
|
497
489
|
export declare function deleteWebhook(token: string, signal: AbortSignal): Promise<Boolean>;
|
|
498
490
|
/** @todo cehck if response is the same as in typings */
|
|
@@ -500,7 +492,11 @@ export declare function getWebhookInfo(token: string, signal: AbortSignal): Prom
|
|
|
500
492
|
export declare function getMe(token: string, signal: AbortSignal): Promise<User>;
|
|
501
493
|
export declare function sendMessage(token: string, payload: SendMessageOptions, signal: AbortSignal): Promise<Message>;
|
|
502
494
|
export declare function editMessageText(token: string, payload: EditMessageTextOptions, signal: AbortSignal): Promise<Message>;
|
|
503
|
-
export declare function sendPhoto(token: string, payload:
|
|
495
|
+
export declare function sendPhoto(token: string, payload: SendBasicOptions & {
|
|
496
|
+
photo: string;
|
|
497
|
+
caption?: string;
|
|
498
|
+
parse_mode?: ParseMode;
|
|
499
|
+
}, signal: AbortSignal): Promise<Message>;
|
|
504
500
|
export declare function sendAnimation(token: string, payload: SendAnimationOptions, signal: AbortSignal): Promise<Message>;
|
|
505
501
|
export declare function sendDocument(token: string, payload: SendDocumentOptions, signal: AbortSignal): Promise<Message>;
|
|
506
502
|
export declare function setMessageReaction(token: string, payload: {
|
package/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Methods
|
|
3
3
|
*/
|
|
4
4
|
const headers = {
|
|
5
5
|
"Accept": "application/json",
|
|
6
6
|
"Content-Type": "application/json",
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
9
|
-
* Methods
|
|
10
|
-
*/
|
|
11
8
|
export function setWebhook(token, body, signal) {
|
|
12
9
|
return fetch(`https://api.telegram.org/bot${token}/setWebhook`, {
|
|
13
10
|
method: "POST",
|
|
@@ -176,17 +173,17 @@ export function parseMessage(m) {
|
|
|
176
173
|
date: Number(m.date),
|
|
177
174
|
chat: parseChat(m.chat),
|
|
178
175
|
text: String(m.text ?? ""),
|
|
179
|
-
forward_from: m.forward_from ? parseUser(m.forward_from) : void 0,
|
|
180
|
-
forward_from_chat: m.forward_from_chat ? parseChat(m.forward_from_chat) : void 0,
|
|
181
|
-
forward_from_message_id: m.forward_from_message_id ? Number(m.forward_from_message_id) : void 0,
|
|
182
|
-
forward_signature: m.forward_signature ? String(m.forward_signature) : void 0,
|
|
183
|
-
forward_sender_name: m.forward_sender_name ? String(m.forward_sender_name) : void 0,
|
|
184
|
-
forward_date: m.forward_date ? Number(m.forward_date) : void 0,
|
|
176
|
+
forward_from: m.forward_from ? parseUser(m.forward_from) : void 0, // User;
|
|
177
|
+
forward_from_chat: m.forward_from_chat ? parseChat(m.forward_from_chat) : void 0, // Chat;
|
|
178
|
+
forward_from_message_id: m.forward_from_message_id ? Number(m.forward_from_message_id) : void 0, // number;
|
|
179
|
+
forward_signature: m.forward_signature ? String(m.forward_signature) : void 0, // string;
|
|
180
|
+
forward_sender_name: m.forward_sender_name ? String(m.forward_sender_name) : void 0, // string;
|
|
181
|
+
forward_date: m.forward_date ? Number(m.forward_date) : void 0, // number;
|
|
185
182
|
// reply_to_message: m.reply_to_message ? parseMessage(m.reply_to_message) : void 0, // Message;
|
|
186
|
-
edit_date: m.edit_date ? Number(m.edit_date) : void 0,
|
|
187
|
-
media_group_id: m.media_group_id ? String(m.media_group_id) : void 0,
|
|
188
|
-
author_signature: m.author_signature ? String(m.author_signature) : void 0,
|
|
189
|
-
entities: m.entities ? parseEntities(m.entities) : void 0,
|
|
183
|
+
edit_date: m.edit_date ? Number(m.edit_date) : void 0, // number;
|
|
184
|
+
media_group_id: m.media_group_id ? String(m.media_group_id) : void 0, // string;
|
|
185
|
+
author_signature: m.author_signature ? String(m.author_signature) : void 0, // string;
|
|
186
|
+
entities: m.entities ? parseEntities(m.entities) : void 0, // MessageEntity[];
|
|
190
187
|
// caption_entities: m.caption_entities ? parseSometh(m.caption_entities) : void 0, // MessageEntity[];
|
|
191
188
|
audio: m.audio ? parseAudio(m.audio) : void 0,
|
|
192
189
|
document: m.document ? parseDocument(m.document) : void 0,
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "telegram-bot-api-nodejs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Telegram Bot API client for nodejs",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=18.x"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js",
|
|
13
|
+
"index.d.ts"
|
|
14
|
+
],
|
|
8
15
|
"scripts": {
|
|
9
16
|
"prepublishOnly": "npm run build",
|
|
10
17
|
"build": "tsc",
|
|
@@ -14,7 +21,7 @@
|
|
|
14
21
|
"author": "",
|
|
15
22
|
"license": "ISC",
|
|
16
23
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^20.
|
|
18
|
-
"typescript": "^5.
|
|
24
|
+
"@types/node": "^20.11.17",
|
|
25
|
+
"typescript": "^5.3.3"
|
|
19
26
|
}
|
|
20
27
|
}
|