@mtkruto/node 0.1.106 → 0.1.107
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/esm/4_constants.d.ts +2 -2
- package/esm/4_constants.js +2 -2
- package/esm/client/3_types.d.ts +17 -12
- package/esm/client/4_client.d.ts +47 -20
- package/esm/client/4_client.js +56 -37
- package/esm/tl/2_types.d.ts +231 -55
- package/esm/tl/2_types.js +782 -150
- package/esm/tl/3_functions.d.ts +159 -53
- package/esm/tl/3_functions.js +488 -147
- package/esm/types/0_audio.d.ts +9 -9
- package/esm/types/0_bot_command.d.ts +2 -0
- package/esm/types/0_chat_action.d.ts +1 -0
- package/esm/types/0_chat_administrator_rights.d.ts +13 -13
- package/esm/types/0_chat_photo.d.ts +7 -6
- package/esm/types/0_chat_photo.js +1 -1
- package/esm/types/0_contact.d.ts +6 -6
- package/esm/types/0_dice.d.ts +3 -3
- package/esm/types/0_force_reply.d.ts +4 -4
- package/esm/types/0_input_contact_message_content.d.ts +5 -0
- package/esm/types/0_input_location_message_content.d.ts +7 -0
- package/esm/types/0_input_venue_message_content.d.ts +10 -1
- package/esm/types/0_keyboard_button_poll_type.d.ts +3 -3
- package/esm/types/0_location.d.ts +7 -7
- package/esm/types/0_login_url.d.ts +4 -5
- package/esm/types/0_mask_position.d.ts +0 -1
- package/esm/types/0_message_entity.d.ts +5 -5
- package/esm/types/0_parse_mode.d.ts +1 -0
- package/esm/types/0_poll_option.d.ts +2 -2
- package/esm/types/0_reply_keyboard_remove.d.ts +3 -3
- package/esm/types/0_thumbnail.d.ts +6 -6
- package/esm/types/0_venue.d.ts +6 -6
- package/esm/types/0_voice.d.ts +6 -6
- package/esm/types/0_web_app_info.d.ts +1 -2
- package/esm/types/1_animation.d.ts +9 -9
- package/esm/types/1_chat.d.ts +29 -28
- package/esm/types/1_document.d.ts +6 -7
- package/esm/types/1_keyboard_button.d.ts +1 -1
- package/esm/types/1_photo.d.ts +3 -3
- package/esm/types/1_sticker.d.ts +2 -2
- package/esm/types/1_user.d.ts +2 -1
- package/esm/types/1_video.d.ts +4 -4
- package/esm/types/1_video_note.d.ts +3 -3
- package/package.json +1 -1
- package/script/4_constants.d.ts +2 -2
- package/script/4_constants.js +2 -2
- package/script/client/3_types.d.ts +17 -12
- package/script/client/4_client.d.ts +47 -20
- package/script/client/4_client.js +56 -37
- package/script/tl/2_types.d.ts +231 -55
- package/script/tl/2_types.js +824 -179
- package/script/tl/3_functions.d.ts +159 -53
- package/script/tl/3_functions.js +510 -159
- package/script/types/0_audio.d.ts +9 -9
- package/script/types/0_bot_command.d.ts +2 -0
- package/script/types/0_chat_action.d.ts +1 -0
- package/script/types/0_chat_administrator_rights.d.ts +13 -13
- package/script/types/0_chat_photo.d.ts +7 -6
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_contact.d.ts +6 -6
- package/script/types/0_dice.d.ts +3 -3
- package/script/types/0_force_reply.d.ts +4 -4
- package/script/types/0_input_contact_message_content.d.ts +5 -0
- package/script/types/0_input_location_message_content.d.ts +7 -0
- package/script/types/0_input_venue_message_content.d.ts +10 -1
- package/script/types/0_keyboard_button_poll_type.d.ts +3 -3
- package/script/types/0_location.d.ts +7 -7
- package/script/types/0_login_url.d.ts +4 -5
- package/script/types/0_mask_position.d.ts +0 -1
- package/script/types/0_message_entity.d.ts +5 -5
- package/script/types/0_parse_mode.d.ts +1 -0
- package/script/types/0_poll_option.d.ts +2 -2
- package/script/types/0_reply_keyboard_remove.d.ts +3 -3
- package/script/types/0_thumbnail.d.ts +6 -6
- package/script/types/0_venue.d.ts +6 -6
- package/script/types/0_voice.d.ts +6 -6
- package/script/types/0_web_app_info.d.ts +1 -2
- package/script/types/1_animation.d.ts +9 -9
- package/script/types/1_chat.d.ts +29 -28
- package/script/types/1_document.d.ts +6 -7
- package/script/types/1_keyboard_button.d.ts +1 -1
- package/script/types/1_photo.d.ts +3 -3
- package/script/types/1_sticker.d.ts +2 -2
- package/script/types/1_user.d.ts +2 -1
- package/script/types/1_video.d.ts +4 -4
- package/script/types/1_video_note.d.ts +3 -3
|
@@ -1243,9 +1243,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1243
1243
|
/**
|
|
1244
1244
|
* Send a text message.
|
|
1245
1245
|
*
|
|
1246
|
+
* @method
|
|
1246
1247
|
* @param chatId The chat to send the message to.
|
|
1247
1248
|
* @param text The message's text.
|
|
1248
|
-
* @
|
|
1249
|
+
* @returns The sent text message.
|
|
1249
1250
|
*/
|
|
1250
1251
|
async sendMessage(chatId, text, params) {
|
|
1251
1252
|
const [message, entities] = this.parseText(text, params);
|
|
@@ -1296,10 +1297,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1296
1297
|
/**
|
|
1297
1298
|
* Edit a message's text.
|
|
1298
1299
|
*
|
|
1300
|
+
* @method
|
|
1299
1301
|
* @param chatId The chat where the message is.
|
|
1300
1302
|
* @param messageId The ID of the message.
|
|
1301
1303
|
* @param text The new text of the message.
|
|
1302
|
-
* @
|
|
1304
|
+
* @returns The edited text message.
|
|
1303
1305
|
*/
|
|
1304
1306
|
async editMessageText(chatId, messageId, text, params) {
|
|
1305
1307
|
const [message, entities] = this.parseText(text, params);
|
|
@@ -1354,12 +1356,16 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1354
1356
|
/**
|
|
1355
1357
|
* Retrieve multiple messages.
|
|
1356
1358
|
*
|
|
1359
|
+
* @method
|
|
1357
1360
|
* @param chatId The identifier of the chat to retrieve the messages from.
|
|
1358
1361
|
* @param messageIds The identifiers of the messages to retrieve.
|
|
1359
|
-
* @
|
|
1362
|
+
* @example ```ts
|
|
1363
|
+
* const message = await client.getMessages("@MTKruto", [210, 212]);
|
|
1364
|
+
* ```
|
|
1365
|
+
* @returns The retrieved messages.
|
|
1360
1366
|
*/
|
|
1361
|
-
async getMessages(
|
|
1362
|
-
return await this.getMessagesInner(
|
|
1367
|
+
async getMessages(chatId, messageIds) {
|
|
1368
|
+
return await this.getMessagesInner(chatId, messageIds).then((v) => v.map((v) => v.message));
|
|
1363
1369
|
}
|
|
1364
1370
|
async [getMessageWithReply](chatId, messageId) {
|
|
1365
1371
|
const messages = await this.getMessagesInner(chatId, [messageId]);
|
|
@@ -1368,9 +1374,13 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1368
1374
|
/**
|
|
1369
1375
|
* Retrieve a single message.
|
|
1370
1376
|
*
|
|
1377
|
+
* @method
|
|
1371
1378
|
* @param chatId The identifier of the chat to retrieve the message from.
|
|
1372
1379
|
* @param messageId The identifier of the message to retrieve.
|
|
1373
|
-
* @
|
|
1380
|
+
* @example ```ts
|
|
1381
|
+
* const message = await client.getMessage("@MTKruto", 212);
|
|
1382
|
+
* ```
|
|
1383
|
+
* @returns The retrieved message.
|
|
1374
1384
|
*/
|
|
1375
1385
|
async getMessage(chatId, messageId) {
|
|
1376
1386
|
const messages = await this.getMessages(chatId, [messageId]);
|
|
@@ -1420,8 +1430,14 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1420
1430
|
/**
|
|
1421
1431
|
* Download a file.
|
|
1422
1432
|
*
|
|
1423
|
-
* @param fileId The identifier of the file to download.
|
|
1424
1433
|
* @method
|
|
1434
|
+
* @param fileId The identifier of the file to download.
|
|
1435
|
+
* @example ```ts
|
|
1436
|
+
* for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
|
|
1437
|
+
* await outFile.write(chunk);
|
|
1438
|
+
* }
|
|
1439
|
+
* ```
|
|
1440
|
+
* @returns A generator yielding the contents of the file.
|
|
1425
1441
|
*/
|
|
1426
1442
|
async download(fileId, params) {
|
|
1427
1443
|
const fileId_ = _3_types_js_1.FileID.decode(fileId);
|
|
@@ -1463,10 +1479,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1463
1479
|
/**
|
|
1464
1480
|
* Forward multiple messages.
|
|
1465
1481
|
*
|
|
1482
|
+
* @method
|
|
1466
1483
|
* @param from The identifier of the chat to forward the messages from.
|
|
1467
1484
|
* @param to The identifier of the chat to forward the messages to.
|
|
1468
1485
|
* @param messageIds The identifiers of the messages to forward.
|
|
1469
|
-
* @
|
|
1486
|
+
* @returns The forwarded messages.
|
|
1470
1487
|
*/
|
|
1471
1488
|
async forwardMessages(from, to, messageIds, params) {
|
|
1472
1489
|
const result = await this.invoke(new _2_tl_js_1.functions.MessagesForwardMessages({
|
|
@@ -1486,10 +1503,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1486
1503
|
/**
|
|
1487
1504
|
* Forward a single message.
|
|
1488
1505
|
*
|
|
1506
|
+
* @method
|
|
1489
1507
|
* @param from The identifier of the chat to forward the message from.
|
|
1490
1508
|
* @param to The identifier of the chat to forward the message to.
|
|
1491
1509
|
* @param messageId The identifier of the message to forward.
|
|
1492
|
-
* @
|
|
1510
|
+
* @returns The forwarded message.
|
|
1493
1511
|
*/
|
|
1494
1512
|
async forwardMessage(from, to, messageId, params) {
|
|
1495
1513
|
return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
|
|
@@ -1605,8 +1623,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1605
1623
|
/**
|
|
1606
1624
|
* Answer a callback query. Bot-only.
|
|
1607
1625
|
*
|
|
1608
|
-
* @param id ID of the callback query to answer.
|
|
1609
1626
|
* @method
|
|
1627
|
+
* @param id ID of the callback query to answer.
|
|
1610
1628
|
*/
|
|
1611
1629
|
async answerCallbackQuery(id, params) {
|
|
1612
1630
|
await this.assertBot("answerCallbackQuery");
|
|
@@ -1632,10 +1650,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1632
1650
|
/**
|
|
1633
1651
|
* Send a poll.
|
|
1634
1652
|
*
|
|
1653
|
+
* @method
|
|
1635
1654
|
* @param chatId The chat to send the poll to.
|
|
1636
1655
|
* @param question The poll's question.
|
|
1637
1656
|
* @param options The poll's options.
|
|
1638
|
-
* @
|
|
1657
|
+
* @returns The sent poll.
|
|
1639
1658
|
*/
|
|
1640
1659
|
async sendPoll(chatId, question, options, params) {
|
|
1641
1660
|
const peer = await this.getInputPeer(chatId);
|
|
@@ -1685,57 +1704,57 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1685
1704
|
/**
|
|
1686
1705
|
* Send a chat action.
|
|
1687
1706
|
*
|
|
1707
|
+
* @method
|
|
1688
1708
|
* @param chatId The chat to send the chat action to.
|
|
1689
1709
|
* @param action The chat action.
|
|
1690
1710
|
* @param messageThreadId The thread to send the chat action to.
|
|
1691
|
-
* @method
|
|
1692
1711
|
*/
|
|
1693
|
-
async sendChatAction(chatId,
|
|
1694
|
-
let
|
|
1695
|
-
switch (
|
|
1712
|
+
async sendChatAction(chatId, action, params) {
|
|
1713
|
+
let action_;
|
|
1714
|
+
switch (action) {
|
|
1696
1715
|
case "type":
|
|
1697
|
-
|
|
1716
|
+
action_ = new _2_tl_js_1.types.SendMessageTypingAction();
|
|
1698
1717
|
break;
|
|
1699
1718
|
case "uploadPhoto":
|
|
1700
|
-
|
|
1719
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadPhotoAction({ progress: 0 });
|
|
1701
1720
|
break;
|
|
1702
1721
|
case "recordVideo":
|
|
1703
|
-
|
|
1722
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
|
|
1704
1723
|
break;
|
|
1705
1724
|
case "uploadVideo":
|
|
1706
|
-
|
|
1725
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
|
|
1707
1726
|
break;
|
|
1708
1727
|
case "recordVoice":
|
|
1709
|
-
|
|
1728
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordAudioAction();
|
|
1710
1729
|
break;
|
|
1711
1730
|
case "uploadAudio":
|
|
1712
|
-
|
|
1731
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadAudioAction({ progress: 0 });
|
|
1713
1732
|
break;
|
|
1714
1733
|
case "uploadDocument":
|
|
1715
|
-
|
|
1734
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadDocumentAction({ progress: 0 });
|
|
1716
1735
|
break;
|
|
1717
1736
|
case "chooseSticker":
|
|
1718
|
-
|
|
1737
|
+
action_ = new _2_tl_js_1.types.SendMessageChooseStickerAction();
|
|
1719
1738
|
break;
|
|
1720
1739
|
case "findLocation":
|
|
1721
|
-
|
|
1740
|
+
action_ = new _2_tl_js_1.types.SendMessageGeoLocationAction();
|
|
1722
1741
|
break;
|
|
1723
1742
|
case "recordVideoNote":
|
|
1724
|
-
|
|
1743
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordRoundAction();
|
|
1725
1744
|
break;
|
|
1726
1745
|
case "uploadVideoNote":
|
|
1727
|
-
|
|
1746
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadRoundAction({ progress: 0 });
|
|
1728
1747
|
break;
|
|
1729
1748
|
default:
|
|
1730
|
-
throw new Error("Invalid chat action: " +
|
|
1749
|
+
throw new Error("Invalid chat action: " + action);
|
|
1731
1750
|
}
|
|
1732
|
-
await this.invoke(new _2_tl_js_1.functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action, topMsgId: messageThreadId }));
|
|
1751
|
+
await this.invoke(new _2_tl_js_1.functions.MessagesSetTyping({ peer: await this.getInputPeer(chatId), action: action_, topMsgId: params?.messageThreadId }));
|
|
1733
1752
|
}
|
|
1734
1753
|
/**
|
|
1735
1754
|
* Upload a file.
|
|
1736
1755
|
*
|
|
1737
|
-
* @param contents The contents of the file.
|
|
1738
1756
|
* @method
|
|
1757
|
+
* @param contents The contents of the file.
|
|
1739
1758
|
*/
|
|
1740
1759
|
async upload(contents, params) {
|
|
1741
1760
|
const isBig = contents.length > 1048576; // 10 MB
|
|
@@ -1825,8 +1844,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1825
1844
|
/**
|
|
1826
1845
|
* Set the bot's commands in the given scope and/or language. Bot-only.
|
|
1827
1846
|
*
|
|
1828
|
-
* @param commands The commands to set.
|
|
1829
1847
|
* @method
|
|
1848
|
+
* @param commands The commands to set.
|
|
1830
1849
|
*/
|
|
1831
1850
|
async setMyCommands(commands, params) {
|
|
1832
1851
|
await this.invoke(new _2_tl_js_1.functions.BotsSetBotCommands({
|
|
@@ -1848,9 +1867,9 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1848
1867
|
/**
|
|
1849
1868
|
* Answer an inline query. Bot-only.
|
|
1850
1869
|
*
|
|
1870
|
+
* @method
|
|
1851
1871
|
* @param id The ID of the inline query to answer.
|
|
1852
1872
|
* @param results The results to answer with.
|
|
1853
|
-
* @method
|
|
1854
1873
|
*/
|
|
1855
1874
|
async answerInlineQuery(id, results, params) {
|
|
1856
1875
|
await this.invoke(new _2_tl_js_1.functions.MessagesSetInlineBotResults({
|
|
@@ -1948,27 +1967,27 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1948
1967
|
*
|
|
1949
1968
|
* @method
|
|
1950
1969
|
*/
|
|
1951
|
-
async getMyDescription(
|
|
1970
|
+
async getMyDescription(params) {
|
|
1952
1971
|
await this.assertBot("getMyDescription");
|
|
1953
|
-
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1972
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.description);
|
|
1954
1973
|
}
|
|
1955
1974
|
/**
|
|
1956
1975
|
* Set the bot's name in the given language. Bot-only.
|
|
1957
1976
|
*
|
|
1958
1977
|
* @method
|
|
1959
1978
|
*/
|
|
1960
|
-
async getMyName(
|
|
1979
|
+
async getMyName(params) {
|
|
1961
1980
|
await this.assertBot("getMyName");
|
|
1962
|
-
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1981
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.description);
|
|
1963
1982
|
}
|
|
1964
1983
|
/**
|
|
1965
1984
|
* Get the bot's short description in the given language. Bot-only.
|
|
1966
1985
|
*
|
|
1967
1986
|
* @method
|
|
1968
1987
|
*/
|
|
1969
|
-
async getMyShortDescription(
|
|
1988
|
+
async getMyShortDescription(params) {
|
|
1970
1989
|
await this.assertBot("getMyShortDescription");
|
|
1971
|
-
return await this.getMyInfo(languageCode).then((v) => v.about);
|
|
1990
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.about);
|
|
1972
1991
|
}
|
|
1973
1992
|
}
|
|
1974
1993
|
exports.Client = Client;
|