@mtkruto/node 0.1.105 → 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 +70 -15
- package/esm/client/4_client.js +73 -27
- 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 -34
- 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 +70 -15
- package/script/client/4_client.js +85 -39
- 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 -34
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Client = exports.ConnectionError = exports.restartAuth = exports.
|
|
3
|
+
exports.Client = exports.ConnectionError = exports.restartAuth = exports.handleMigrationError = void 0;
|
|
4
4
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
5
5
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
6
6
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
@@ -21,10 +21,10 @@ const dGapC = (0, _0_deps_js_1.debug)("Client/recoverChannelUpdateGap");
|
|
|
21
21
|
const dAuth = (0, _0_deps_js_1.debug)("Client/authorize");
|
|
22
22
|
const dRecv = (0, _0_deps_js_1.debug)("Client/receiveLoop");
|
|
23
23
|
const dUpload = (0, _0_deps_js_1.debug)("Client/upload");
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const getEntity = Symbol();
|
|
25
|
+
const getStickerSetName = Symbol();
|
|
26
26
|
exports.handleMigrationError = Symbol();
|
|
27
|
-
|
|
27
|
+
const getMessageWithReply = Symbol();
|
|
28
28
|
exports.restartAuth = Symbol();
|
|
29
29
|
class ConnectionError extends Error {
|
|
30
30
|
}
|
|
@@ -1158,7 +1158,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1158
1158
|
throw new Error("ID format unknown or not implemented");
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
|
-
[
|
|
1161
|
+
[getEntity](peer) {
|
|
1162
1162
|
const type = peer instanceof _2_tl_js_1.types.PeerUser ? "user" : peer instanceof _2_tl_js_1.types.PeerChat ? "chat" : peer instanceof _2_tl_js_1.types.PeerChannel ? "channel" : (0, _1_utilities_js_1.UNREACHABLE)();
|
|
1163
1163
|
const id = peer instanceof _2_tl_js_1.types.PeerUser ? peer.userId : peer instanceof _2_tl_js_1.types.PeerChat ? peer.chatId : peer instanceof _2_tl_js_1.types.PeerChannel ? peer.channelId : (0, _1_utilities_js_1.UNREACHABLE)();
|
|
1164
1164
|
return this.storage.getEntity(type, id);
|
|
@@ -1218,10 +1218,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1218
1218
|
if (updates instanceof _2_tl_js_1.types.Updates) {
|
|
1219
1219
|
for (const update of updates.updates) {
|
|
1220
1220
|
if (update instanceof _2_tl_js_1.types.UpdateNewMessage || update instanceof _2_tl_js_1.types.UpdateEditMessage) {
|
|
1221
|
-
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[
|
|
1221
|
+
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
|
|
1222
1222
|
}
|
|
1223
1223
|
else if (update instanceof _2_tl_js_1.types.UpdateNewChannelMessage || update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
|
|
1224
|
-
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[
|
|
1224
|
+
messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
@@ -1243,8 +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.
|
|
1249
|
+
* @returns The sent text message.
|
|
1248
1250
|
*/
|
|
1249
1251
|
async sendMessage(chatId, text, params) {
|
|
1250
1252
|
const [message, entities] = this.parseText(text, params);
|
|
@@ -1295,9 +1297,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1295
1297
|
/**
|
|
1296
1298
|
* Edit a message's text.
|
|
1297
1299
|
*
|
|
1300
|
+
* @method
|
|
1298
1301
|
* @param chatId The chat where the message is.
|
|
1299
1302
|
* @param messageId The ID of the message.
|
|
1300
1303
|
* @param text The new text of the message.
|
|
1304
|
+
* @returns The edited text message.
|
|
1301
1305
|
*/
|
|
1302
1306
|
async editMessageText(chatId, messageId, text, params) {
|
|
1303
1307
|
const [message, entities] = this.parseText(text, params);
|
|
@@ -1343,7 +1347,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1343
1347
|
}
|
|
1344
1348
|
const messages = new Array();
|
|
1345
1349
|
for (const message_ of messages_) {
|
|
1346
|
-
const message = await (0, _3_types_js_1.constructMessage)(message_, this[
|
|
1350
|
+
const message = await (0, _3_types_js_1.constructMessage)(message_, this[getEntity].bind(this), null, this[getStickerSetName].bind(this));
|
|
1347
1351
|
const isReplyToMessage = message_ instanceof _2_tl_js_1.types.Message && message_.replyTo instanceof _2_tl_js_1.types.MessageReplyHeader;
|
|
1348
1352
|
messages.push({ message, isReplyToMessage });
|
|
1349
1353
|
}
|
|
@@ -1352,21 +1356,31 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1352
1356
|
/**
|
|
1353
1357
|
* Retrieve multiple messages.
|
|
1354
1358
|
*
|
|
1359
|
+
* @method
|
|
1355
1360
|
* @param chatId The identifier of the chat to retrieve the messages from.
|
|
1356
1361
|
* @param messageIds The identifiers of the messages to retrieve.
|
|
1362
|
+
* @example ```ts
|
|
1363
|
+
* const message = await client.getMessages("@MTKruto", [210, 212]);
|
|
1364
|
+
* ```
|
|
1365
|
+
* @returns The retrieved messages.
|
|
1357
1366
|
*/
|
|
1358
|
-
async getMessages(
|
|
1359
|
-
return await this.getMessagesInner(
|
|
1367
|
+
async getMessages(chatId, messageIds) {
|
|
1368
|
+
return await this.getMessagesInner(chatId, messageIds).then((v) => v.map((v) => v.message));
|
|
1360
1369
|
}
|
|
1361
|
-
async [
|
|
1370
|
+
async [getMessageWithReply](chatId, messageId) {
|
|
1362
1371
|
const messages = await this.getMessagesInner(chatId, [messageId]);
|
|
1363
1372
|
return messages[0]?.message ?? null;
|
|
1364
1373
|
}
|
|
1365
1374
|
/**
|
|
1366
1375
|
* Retrieve a single message.
|
|
1367
1376
|
*
|
|
1377
|
+
* @method
|
|
1368
1378
|
* @param chatId The identifier of the chat to retrieve the message from.
|
|
1369
1379
|
* @param messageId The identifier of the message to retrieve.
|
|
1380
|
+
* @example ```ts
|
|
1381
|
+
* const message = await client.getMessage("@MTKruto", 212);
|
|
1382
|
+
* ```
|
|
1383
|
+
* @returns The retrieved message.
|
|
1370
1384
|
*/
|
|
1371
1385
|
async getMessage(chatId, messageId) {
|
|
1372
1386
|
const messages = await this.getMessages(chatId, [messageId]);
|
|
@@ -1416,7 +1430,14 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1416
1430
|
/**
|
|
1417
1431
|
* Download a file.
|
|
1418
1432
|
*
|
|
1433
|
+
* @method
|
|
1419
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.
|
|
1420
1441
|
*/
|
|
1421
1442
|
async download(fileId, params) {
|
|
1422
1443
|
const fileId_ = _3_types_js_1.FileID.decode(fileId);
|
|
@@ -1443,7 +1464,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1443
1464
|
(0, _1_utilities_js_1.UNREACHABLE)();
|
|
1444
1465
|
}
|
|
1445
1466
|
}
|
|
1446
|
-
async [
|
|
1467
|
+
async [getStickerSetName](inputStickerSet, hash = 0) {
|
|
1447
1468
|
const maybeStickerSetName = await this.storage.getStickerSetName(inputStickerSet.id, inputStickerSet.accessHash);
|
|
1448
1469
|
if (maybeStickerSetName != null && Date.now() - maybeStickerSetName[1].getTime() < _4_constants_js_1.STICKER_SET_NAME_TTL) {
|
|
1449
1470
|
return maybeStickerSetName[0];
|
|
@@ -1458,9 +1479,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1458
1479
|
/**
|
|
1459
1480
|
* Forward multiple messages.
|
|
1460
1481
|
*
|
|
1482
|
+
* @method
|
|
1461
1483
|
* @param from The identifier of the chat to forward the messages from.
|
|
1462
1484
|
* @param to The identifier of the chat to forward the messages to.
|
|
1463
1485
|
* @param messageIds The identifiers of the messages to forward.
|
|
1486
|
+
* @returns The forwarded messages.
|
|
1464
1487
|
*/
|
|
1465
1488
|
async forwardMessages(from, to, messageIds, params) {
|
|
1466
1489
|
const result = await this.invoke(new _2_tl_js_1.functions.MessagesForwardMessages({
|
|
@@ -1480,15 +1503,19 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1480
1503
|
/**
|
|
1481
1504
|
* Forward a single message.
|
|
1482
1505
|
*
|
|
1506
|
+
* @method
|
|
1483
1507
|
* @param from The identifier of the chat to forward the message from.
|
|
1484
1508
|
* @param to The identifier of the chat to forward the message to.
|
|
1485
1509
|
* @param messageId The identifier of the message to forward.
|
|
1510
|
+
* @returns The forwarded message.
|
|
1486
1511
|
*/
|
|
1487
1512
|
async forwardMessage(from, to, messageId, params) {
|
|
1488
1513
|
return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
|
|
1489
1514
|
}
|
|
1490
1515
|
/**
|
|
1491
1516
|
* Get information on the currently authorized user.
|
|
1517
|
+
*
|
|
1518
|
+
* @method
|
|
1492
1519
|
*/
|
|
1493
1520
|
async getMe() {
|
|
1494
1521
|
const users = await this.invoke(new _2_tl_js_1.functions.UsersGetUsers({ id: [new _2_tl_js_1.types.InputUserSelf()] }));
|
|
@@ -1553,7 +1580,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1553
1580
|
update instanceof _2_tl_js_1.types.UpdateEditMessage ||
|
|
1554
1581
|
update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
|
|
1555
1582
|
const key = update instanceof _2_tl_js_1.types.UpdateNewMessage || update instanceof _2_tl_js_1.types.UpdateNewChannelMessage ? "message" : "editedMessage";
|
|
1556
|
-
const message = await (0, _3_types_js_1.constructMessage)(update.message, this[
|
|
1583
|
+
const message = await (0, _3_types_js_1.constructMessage)(update.message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this));
|
|
1557
1584
|
await this.handle({ [key]: message }, _0_utilities_js_1.resolve);
|
|
1558
1585
|
}
|
|
1559
1586
|
if (update instanceof _2_tl_js_1.types.UpdateDeleteMessages) {
|
|
@@ -1563,7 +1590,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1563
1590
|
if (chatId) {
|
|
1564
1591
|
const message = await this.storage.getMessage(chatId, messageId);
|
|
1565
1592
|
if (message != null) {
|
|
1566
|
-
deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[
|
|
1593
|
+
deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
|
|
1567
1594
|
}
|
|
1568
1595
|
await this.storage.setMessage(chatId, messageId, null);
|
|
1569
1596
|
}
|
|
@@ -1578,7 +1605,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1578
1605
|
for (const messageId of update.messages) {
|
|
1579
1606
|
const message = await this.storage.getMessage(chatId, messageId);
|
|
1580
1607
|
if (message) {
|
|
1581
|
-
deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[
|
|
1608
|
+
deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
|
|
1582
1609
|
}
|
|
1583
1610
|
await this.storage.setMessage(chatId, messageId, null);
|
|
1584
1611
|
}
|
|
@@ -1587,15 +1614,16 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1587
1614
|
}
|
|
1588
1615
|
}
|
|
1589
1616
|
if (update instanceof _2_tl_js_1.types.UpdateBotCallbackQuery || update instanceof _2_tl_js_1.types.UpdateInlineBotCallbackQuery) {
|
|
1590
|
-
await this.handle({ callbackQuery: await (0, _3_types_js_1.constructCallbackQuery)(update, this[
|
|
1617
|
+
await this.handle({ callbackQuery: await (0, _3_types_js_1.constructCallbackQuery)(update, this[getEntity].bind(this), this[getMessageWithReply].bind(this)) }, _0_utilities_js_1.resolve);
|
|
1591
1618
|
}
|
|
1592
1619
|
else if (update instanceof _2_tl_js_1.types.UpdateBotInlineQuery) {
|
|
1593
|
-
await this.handle({ inlineQuery: await (0, _3_types_js_1.constructInlineQuery)(update, this[
|
|
1620
|
+
await this.handle({ inlineQuery: await (0, _3_types_js_1.constructInlineQuery)(update, this[getEntity].bind(this)) }, _0_utilities_js_1.resolve);
|
|
1594
1621
|
}
|
|
1595
1622
|
}
|
|
1596
1623
|
/**
|
|
1597
1624
|
* Answer a callback query. Bot-only.
|
|
1598
1625
|
*
|
|
1626
|
+
* @method
|
|
1599
1627
|
* @param id ID of the callback query to answer.
|
|
1600
1628
|
*/
|
|
1601
1629
|
async answerCallbackQuery(id, params) {
|
|
@@ -1622,9 +1650,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1622
1650
|
/**
|
|
1623
1651
|
* Send a poll.
|
|
1624
1652
|
*
|
|
1653
|
+
* @method
|
|
1625
1654
|
* @param chatId The chat to send the poll to.
|
|
1626
1655
|
* @param question The poll's question.
|
|
1627
1656
|
* @param options The poll's options.
|
|
1657
|
+
* @returns The sent poll.
|
|
1628
1658
|
*/
|
|
1629
1659
|
async sendPoll(chatId, question, options, params) {
|
|
1630
1660
|
const peer = await this.getInputPeer(chatId);
|
|
@@ -1674,54 +1704,56 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1674
1704
|
/**
|
|
1675
1705
|
* Send a chat action.
|
|
1676
1706
|
*
|
|
1707
|
+
* @method
|
|
1677
1708
|
* @param chatId The chat to send the chat action to.
|
|
1678
1709
|
* @param action The chat action.
|
|
1679
1710
|
* @param messageThreadId The thread to send the chat action to.
|
|
1680
1711
|
*/
|
|
1681
|
-
async sendChatAction(chatId,
|
|
1682
|
-
let
|
|
1683
|
-
switch (
|
|
1712
|
+
async sendChatAction(chatId, action, params) {
|
|
1713
|
+
let action_;
|
|
1714
|
+
switch (action) {
|
|
1684
1715
|
case "type":
|
|
1685
|
-
|
|
1716
|
+
action_ = new _2_tl_js_1.types.SendMessageTypingAction();
|
|
1686
1717
|
break;
|
|
1687
1718
|
case "uploadPhoto":
|
|
1688
|
-
|
|
1719
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadPhotoAction({ progress: 0 });
|
|
1689
1720
|
break;
|
|
1690
1721
|
case "recordVideo":
|
|
1691
|
-
|
|
1722
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
|
|
1692
1723
|
break;
|
|
1693
1724
|
case "uploadVideo":
|
|
1694
|
-
|
|
1725
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordVideoAction();
|
|
1695
1726
|
break;
|
|
1696
1727
|
case "recordVoice":
|
|
1697
|
-
|
|
1728
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordAudioAction();
|
|
1698
1729
|
break;
|
|
1699
1730
|
case "uploadAudio":
|
|
1700
|
-
|
|
1731
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadAudioAction({ progress: 0 });
|
|
1701
1732
|
break;
|
|
1702
1733
|
case "uploadDocument":
|
|
1703
|
-
|
|
1734
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadDocumentAction({ progress: 0 });
|
|
1704
1735
|
break;
|
|
1705
1736
|
case "chooseSticker":
|
|
1706
|
-
|
|
1737
|
+
action_ = new _2_tl_js_1.types.SendMessageChooseStickerAction();
|
|
1707
1738
|
break;
|
|
1708
1739
|
case "findLocation":
|
|
1709
|
-
|
|
1740
|
+
action_ = new _2_tl_js_1.types.SendMessageGeoLocationAction();
|
|
1710
1741
|
break;
|
|
1711
1742
|
case "recordVideoNote":
|
|
1712
|
-
|
|
1743
|
+
action_ = new _2_tl_js_1.types.SendMessageRecordRoundAction();
|
|
1713
1744
|
break;
|
|
1714
1745
|
case "uploadVideoNote":
|
|
1715
|
-
|
|
1746
|
+
action_ = new _2_tl_js_1.types.SendMessageUploadRoundAction({ progress: 0 });
|
|
1716
1747
|
break;
|
|
1717
1748
|
default:
|
|
1718
|
-
throw new Error("Invalid chat action: " +
|
|
1749
|
+
throw new Error("Invalid chat action: " + action);
|
|
1719
1750
|
}
|
|
1720
|
-
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 }));
|
|
1721
1752
|
}
|
|
1722
1753
|
/**
|
|
1723
1754
|
* Upload a file.
|
|
1724
1755
|
*
|
|
1756
|
+
* @method
|
|
1725
1757
|
* @param contents The contents of the file.
|
|
1726
1758
|
*/
|
|
1727
1759
|
async upload(contents, params) {
|
|
@@ -1812,6 +1844,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1812
1844
|
/**
|
|
1813
1845
|
* Set the bot's commands in the given scope and/or language. Bot-only.
|
|
1814
1846
|
*
|
|
1847
|
+
* @method
|
|
1815
1848
|
* @param commands The commands to set.
|
|
1816
1849
|
*/
|
|
1817
1850
|
async setMyCommands(commands, params) {
|
|
@@ -1834,6 +1867,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1834
1867
|
/**
|
|
1835
1868
|
* Answer an inline query. Bot-only.
|
|
1836
1869
|
*
|
|
1870
|
+
* @method
|
|
1837
1871
|
* @param id The ID of the inline query to answer.
|
|
1838
1872
|
* @param results The results to answer with.
|
|
1839
1873
|
*/
|
|
@@ -1900,6 +1934,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1900
1934
|
}
|
|
1901
1935
|
/**
|
|
1902
1936
|
* Set the bot's description in the given language. Bot-only.
|
|
1937
|
+
*
|
|
1938
|
+
* @method
|
|
1903
1939
|
*/
|
|
1904
1940
|
async setMyDescription({ description, languageCode }) {
|
|
1905
1941
|
await this.assertBot("setMyDescription");
|
|
@@ -1907,6 +1943,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1907
1943
|
}
|
|
1908
1944
|
/**
|
|
1909
1945
|
* Set the bot's name in the given language. Bot-only.
|
|
1946
|
+
*
|
|
1947
|
+
* @method
|
|
1910
1948
|
*/
|
|
1911
1949
|
async setMyName({ name, languageCode }) {
|
|
1912
1950
|
await this.assertBot("setMyName");
|
|
@@ -1914,6 +1952,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1914
1952
|
}
|
|
1915
1953
|
/**
|
|
1916
1954
|
* Set the bot's short description in the given language. Bot-only.
|
|
1955
|
+
*
|
|
1956
|
+
* @method
|
|
1917
1957
|
*/
|
|
1918
1958
|
async setMyShortDescription({ shortDescription: about, languageCode }) {
|
|
1919
1959
|
await this.assertBot("setMyShortDescription");
|
|
@@ -1924,24 +1964,30 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1924
1964
|
}
|
|
1925
1965
|
/**
|
|
1926
1966
|
* Get the bot's description in the given language. Bot-only.
|
|
1967
|
+
*
|
|
1968
|
+
* @method
|
|
1927
1969
|
*/
|
|
1928
|
-
async getMyDescription(
|
|
1970
|
+
async getMyDescription(params) {
|
|
1929
1971
|
await this.assertBot("getMyDescription");
|
|
1930
|
-
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1972
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.description);
|
|
1931
1973
|
}
|
|
1932
1974
|
/**
|
|
1933
1975
|
* Set the bot's name in the given language. Bot-only.
|
|
1976
|
+
*
|
|
1977
|
+
* @method
|
|
1934
1978
|
*/
|
|
1935
|
-
async getMyName(
|
|
1979
|
+
async getMyName(params) {
|
|
1936
1980
|
await this.assertBot("getMyName");
|
|
1937
|
-
return await this.getMyInfo(languageCode).then((v) => v.description);
|
|
1981
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.description);
|
|
1938
1982
|
}
|
|
1939
1983
|
/**
|
|
1940
1984
|
* Get the bot's short description in the given language. Bot-only.
|
|
1985
|
+
*
|
|
1986
|
+
* @method
|
|
1941
1987
|
*/
|
|
1942
|
-
async getMyShortDescription(
|
|
1988
|
+
async getMyShortDescription(params) {
|
|
1943
1989
|
await this.assertBot("getMyShortDescription");
|
|
1944
|
-
return await this.getMyInfo(languageCode).then((v) => v.about);
|
|
1990
|
+
return await this.getMyInfo(params?.languageCode).then((v) => v.about);
|
|
1945
1991
|
}
|
|
1946
1992
|
}
|
|
1947
1993
|
exports.Client = Client;
|