teleproto 203.0.0
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/CryptoFile.d.ts +2 -0
- package/CryptoFile.js +23 -0
- package/Helpers.d.ts +151 -0
- package/Helpers.js +477 -0
- package/LICENSE +23 -0
- package/Password.d.ts +15 -0
- package/Password.js +271 -0
- package/README.md +111 -0
- package/Utils.d.ts +228 -0
- package/Utils.js +1248 -0
- package/Version.d.ts +1 -0
- package/Version.js +4 -0
- package/client/2fa.d.ts +48 -0
- package/client/2fa.js +109 -0
- package/client/TelegramClient.d.ts +1042 -0
- package/client/TelegramClient.js +1167 -0
- package/client/account.d.ts +0 -0
- package/client/account.js +1 -0
- package/client/auth.d.ts +93 -0
- package/client/auth.js +375 -0
- package/client/bots.d.ts +6 -0
- package/client/bots.js +24 -0
- package/client/buttons.d.ts +4 -0
- package/client/buttons.js +87 -0
- package/client/chats.d.ts +46 -0
- package/client/chats.js +350 -0
- package/client/dialogs.d.ts +52 -0
- package/client/dialogs.js +174 -0
- package/client/downloads.d.ts +157 -0
- package/client/downloads.js +598 -0
- package/client/fs.d.ts +1 -0
- package/client/fs.js +13 -0
- package/client/index.d.ts +15 -0
- package/client/index.js +50 -0
- package/client/messageParse.d.ts +17 -0
- package/client/messageParse.js +191 -0
- package/client/messages.d.ts +259 -0
- package/client/messages.js +804 -0
- package/client/os.d.ts +2 -0
- package/client/os.js +23 -0
- package/client/path.d.ts +2 -0
- package/client/path.js +7 -0
- package/client/telegramBaseClient.d.ts +238 -0
- package/client/telegramBaseClient.js +368 -0
- package/client/updates.d.ts +31 -0
- package/client/updates.js +254 -0
- package/client/uploads.d.ts +137 -0
- package/client/uploads.js +514 -0
- package/client/users.d.ts +29 -0
- package/client/users.js +491 -0
- package/crypto/AuthKey.d.ts +20 -0
- package/crypto/AuthKey.js +76 -0
- package/crypto/CTR.d.ts +6 -0
- package/crypto/CTR.js +35 -0
- package/crypto/Factorizator.d.ts +19 -0
- package/crypto/Factorizator.js +74 -0
- package/crypto/IGE.d.ts +18 -0
- package/crypto/IGE.js +34 -0
- package/crypto/RSA.d.ts +15 -0
- package/crypto/RSA.js +70 -0
- package/crypto/converters.d.ts +19 -0
- package/crypto/converters.js +52 -0
- package/crypto/crypto.d.ts +27 -0
- package/crypto/crypto.js +117 -0
- package/crypto/words.d.ts +6 -0
- package/crypto/words.js +48 -0
- package/define.d.ts +77 -0
- package/entityCache.d.ts +7 -0
- package/entityCache.js +79 -0
- package/errors/Common.d.ts +72 -0
- package/errors/Common.js +122 -0
- package/errors/RPCBaseErrors.d.ts +84 -0
- package/errors/RPCBaseErrors.js +134 -0
- package/errors/RPCErrorList.d.ts +37 -0
- package/errors/RPCErrorList.js +117 -0
- package/errors/index.d.ts +11 -0
- package/errors/index.js +29 -0
- package/events/Album.d.ts +36 -0
- package/events/Album.js +104 -0
- package/events/CallbackQuery.d.ts +74 -0
- package/events/CallbackQuery.js +193 -0
- package/events/DeletedMessage.d.ts +45 -0
- package/events/DeletedMessage.js +63 -0
- package/events/EditedMessage.d.ts +30 -0
- package/events/EditedMessage.js +41 -0
- package/events/NewMessage.d.ts +89 -0
- package/events/NewMessage.js +182 -0
- package/events/Raw.d.ts +29 -0
- package/events/Raw.js +43 -0
- package/events/common.d.ts +66 -0
- package/events/common.js +141 -0
- package/events/index.d.ts +2 -0
- package/events/index.js +8 -0
- package/extensions/AsyncQueue.d.ts +10 -0
- package/extensions/AsyncQueue.js +32 -0
- package/extensions/BinaryReader.d.ts +100 -0
- package/extensions/BinaryReader.js +242 -0
- package/extensions/BinaryWriter.d.ts +7 -0
- package/extensions/BinaryWriter.js +15 -0
- package/extensions/Deferred.d.ts +8 -0
- package/extensions/Deferred.js +16 -0
- package/extensions/Logger.d.ts +56 -0
- package/extensions/Logger.js +107 -0
- package/extensions/MessagePacker.d.ts +22 -0
- package/extensions/MessagePacker.js +154 -0
- package/extensions/PendingState.d.ts +12 -0
- package/extensions/PendingState.js +29 -0
- package/extensions/PromisedNetSockets.d.ts +25 -0
- package/extensions/PromisedNetSockets.js +178 -0
- package/extensions/PromisedWebSockets.d.ts +19 -0
- package/extensions/PromisedWebSockets.js +124 -0
- package/extensions/html.d.ts +5 -0
- package/extensions/html.js +213 -0
- package/extensions/index.d.ts +7 -0
- package/extensions/index.js +17 -0
- package/extensions/markdown.d.ts +5 -0
- package/extensions/markdown.js +76 -0
- package/extensions/markdownv2.d.ts +5 -0
- package/extensions/markdownv2.js +51 -0
- package/extensions/net.d.ts +1 -0
- package/extensions/net.js +13 -0
- package/extensions/socks.d.ts +1 -0
- package/extensions/socks.js +13 -0
- package/index.d.ts +14 -0
- package/index.js +48 -0
- package/inspect.d.ts +1 -0
- package/inspect.js +5 -0
- package/network/Authenticator.d.ts +12 -0
- package/network/Authenticator.js +193 -0
- package/network/MTProtoPlainSender.d.ts +19 -0
- package/network/MTProtoPlainSender.js +74 -0
- package/network/MTProtoSender.d.ts +291 -0
- package/network/MTProtoSender.js +854 -0
- package/network/MTProtoState.d.ts +103 -0
- package/network/MTProtoState.js +267 -0
- package/network/RequestState.d.ts +19 -0
- package/network/RequestState.js +35 -0
- package/network/connection/Connection.d.ts +71 -0
- package/network/connection/Connection.js +157 -0
- package/network/connection/TCPAbridged.d.ts +20 -0
- package/network/connection/TCPAbridged.js +58 -0
- package/network/connection/TCPFull.d.ts +17 -0
- package/network/connection/TCPFull.js +61 -0
- package/network/connection/TCPMTProxy.d.ts +50 -0
- package/network/connection/TCPMTProxy.js +121 -0
- package/network/connection/TCPObfuscated.d.ts +19 -0
- package/network/connection/TCPObfuscated.js +78 -0
- package/network/connection/index.d.ts +4 -0
- package/network/connection/index.js +11 -0
- package/network/index.d.ts +11 -0
- package/network/index.js +23 -0
- package/package.json +69 -0
- package/requestIter.d.ts +24 -0
- package/requestIter.js +107 -0
- package/sessions/Abstract.d.ts +103 -0
- package/sessions/Abstract.js +6 -0
- package/sessions/CacheApiSession.d.ts +18 -0
- package/sessions/CacheApiSession.js +99 -0
- package/sessions/Memory.d.ts +38 -0
- package/sessions/Memory.js +272 -0
- package/sessions/StoreSession.d.ts +14 -0
- package/sessions/StoreSession.js +77 -0
- package/sessions/StringSession.d.ts +33 -0
- package/sessions/StringSession.js +116 -0
- package/sessions/index.d.ts +4 -0
- package/sessions/index.js +13 -0
- package/sessions/localStorage.d.ts +1 -0
- package/sessions/localStorage.js +4 -0
- package/tl/AllTLObjects.d.ts +3 -0
- package/tl/AllTLObjects.js +17 -0
- package/tl/MTProtoRequest.d.ts +19 -0
- package/tl/MTProtoRequest.js +38 -0
- package/tl/api.d.ts +31425 -0
- package/tl/api.js +507 -0
- package/tl/apiTl.d.ts +2 -0
- package/tl/apiTl.js +2142 -0
- package/tl/core/GZIPPacked.d.ts +16 -0
- package/tl/core/GZIPPacked.js +51 -0
- package/tl/core/MessageContainer.d.ts +12 -0
- package/tl/core/MessageContainer.js +42 -0
- package/tl/core/RPCResult.d.ts +15 -0
- package/tl/core/RPCResult.js +32 -0
- package/tl/core/TLMessage.d.ts +10 -0
- package/tl/core/TLMessage.js +14 -0
- package/tl/core/index.d.ts +6 -0
- package/tl/core/index.js +16 -0
- package/tl/custom/button.d.ts +25 -0
- package/tl/custom/button.js +78 -0
- package/tl/custom/chatGetter.d.ts +30 -0
- package/tl/custom/chatGetter.js +114 -0
- package/tl/custom/dialog.d.ts +31 -0
- package/tl/custom/dialog.js +40 -0
- package/tl/custom/draft.d.ts +22 -0
- package/tl/custom/draft.js +48 -0
- package/tl/custom/file.d.ts +22 -0
- package/tl/custom/file.js +68 -0
- package/tl/custom/forward.d.ts +16 -0
- package/tl/custom/forward.js +47 -0
- package/tl/custom/index.d.ts +1 -0
- package/tl/custom/index.js +5 -0
- package/tl/custom/inlineResult.d.ts +33 -0
- package/tl/custom/inlineResult.js +87 -0
- package/tl/custom/inlineResults.d.ts +21 -0
- package/tl/custom/inlineResults.js +26 -0
- package/tl/custom/message.d.ts +428 -0
- package/tl/custom/message.js +702 -0
- package/tl/custom/messageButton.d.ts +55 -0
- package/tl/custom/messageButton.js +152 -0
- package/tl/custom/senderGetter.d.ts +29 -0
- package/tl/custom/senderGetter.js +55 -0
- package/tl/generateModule.d.ts +1 -0
- package/tl/generateModule.js +17 -0
- package/tl/generationHelpers.d.ts +12 -0
- package/tl/generationHelpers.js +289 -0
- package/tl/index.d.ts +3 -0
- package/tl/index.js +10 -0
- package/tl/patched/index.d.ts +2 -0
- package/tl/patched/index.js +77 -0
- package/tl/schemaTl.d.ts +2 -0
- package/tl/schemaTl.js +64 -0
- package/tl/types-generator/generate.d.ts +1 -0
- package/tl/types-generator/generate.js +84 -0
- package/tl/types-generator/template.d.ts +6 -0
- package/tl/types-generator/template.js +257 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.File = void 0;
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const Utils_1 = require("../../Utils");
|
|
6
|
+
const Helpers_1 = require("../../Helpers");
|
|
7
|
+
const inspect_1 = require("../../inspect");
|
|
8
|
+
class File {
|
|
9
|
+
constructor(media) {
|
|
10
|
+
this.media = media;
|
|
11
|
+
}
|
|
12
|
+
[inspect_1.inspect.custom]() {
|
|
13
|
+
return (0, Helpers_1.betterConsoleLog)(this);
|
|
14
|
+
}
|
|
15
|
+
get id() {
|
|
16
|
+
throw new Error("Unsupported");
|
|
17
|
+
}
|
|
18
|
+
get name() {
|
|
19
|
+
return this._fromAttr(api_1.Api.DocumentAttributeFilename, "fileName");
|
|
20
|
+
}
|
|
21
|
+
get mimeType() {
|
|
22
|
+
if (this.media instanceof api_1.Api.Photo) {
|
|
23
|
+
return "image/jpeg";
|
|
24
|
+
}
|
|
25
|
+
else if (this.media instanceof api_1.Api.Document) {
|
|
26
|
+
return this.media.mimeType;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
get width() {
|
|
30
|
+
return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "w");
|
|
31
|
+
}
|
|
32
|
+
get height() {
|
|
33
|
+
return this._fromAttr([api_1.Api.DocumentAttributeImageSize, api_1.Api.DocumentAttributeVideo], "h");
|
|
34
|
+
}
|
|
35
|
+
get duration() {
|
|
36
|
+
return this._fromAttr([api_1.Api.DocumentAttributeAudio, api_1.Api.DocumentAttributeVideo], "duration");
|
|
37
|
+
}
|
|
38
|
+
get title() {
|
|
39
|
+
return this._fromAttr(api_1.Api.DocumentAttributeAudio, "title");
|
|
40
|
+
}
|
|
41
|
+
get performer() {
|
|
42
|
+
return this._fromAttr(api_1.Api.DocumentAttributeAudio, "performer");
|
|
43
|
+
}
|
|
44
|
+
get emoji() {
|
|
45
|
+
return this._fromAttr(api_1.Api.DocumentAttributeSticker, "alt");
|
|
46
|
+
}
|
|
47
|
+
get stickerSet() {
|
|
48
|
+
return this._fromAttr(api_1.Api.DocumentAttributeSticker, "stickerset");
|
|
49
|
+
}
|
|
50
|
+
get size() {
|
|
51
|
+
if (this.media instanceof api_1.Api.Photo) {
|
|
52
|
+
return (0, Utils_1._photoSizeByteCount)(this.media.sizes[this.media.sizes.length - 1]);
|
|
53
|
+
}
|
|
54
|
+
else if (this.media instanceof api_1.Api.Document) {
|
|
55
|
+
return this.media.size;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_fromAttr(cls, field) {
|
|
59
|
+
if (this.media instanceof api_1.Api.Document) {
|
|
60
|
+
for (const attr of this.media.attributes) {
|
|
61
|
+
if (attr instanceof cls) {
|
|
62
|
+
return attr[field];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.File = File;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ChatGetter } from "./chatGetter";
|
|
3
|
+
import { SenderGetter } from "./senderGetter";
|
|
4
|
+
import { Api } from "../api";
|
|
5
|
+
import type { TelegramClient } from "../../client/TelegramClient";
|
|
6
|
+
import type { Entity } from "../../define";
|
|
7
|
+
import { inspect } from "../../inspect";
|
|
8
|
+
export declare class Forward extends SenderGetter {
|
|
9
|
+
private originalFwd;
|
|
10
|
+
[inspect.custom](): {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
constructor(client: TelegramClient, original: Api.MessageFwdHeader, entities: Map<string, Entity>);
|
|
14
|
+
}
|
|
15
|
+
export interface Forward extends ChatGetter, SenderGetter {
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Forward = void 0;
|
|
4
|
+
const chatGetter_1 = require("./chatGetter");
|
|
5
|
+
const senderGetter_1 = require("./senderGetter");
|
|
6
|
+
const Helpers_1 = require("../../Helpers");
|
|
7
|
+
const Utils_1 = require("../../Utils");
|
|
8
|
+
const inspect_1 = require("../../inspect");
|
|
9
|
+
class Forward extends senderGetter_1.SenderGetter {
|
|
10
|
+
constructor(client, original, entities) {
|
|
11
|
+
super();
|
|
12
|
+
// contains info for the original header sent by telegram.
|
|
13
|
+
this.originalFwd = original;
|
|
14
|
+
let senderId = undefined;
|
|
15
|
+
let sender = undefined;
|
|
16
|
+
let inputSender = undefined;
|
|
17
|
+
let peer = undefined;
|
|
18
|
+
let chat = undefined;
|
|
19
|
+
let inputChat = undefined;
|
|
20
|
+
if (original.fromId) {
|
|
21
|
+
const ty = (0, Helpers_1._entityType)(original.fromId);
|
|
22
|
+
if (ty === Helpers_1._EntityType.USER) {
|
|
23
|
+
senderId = (0, Utils_1.getPeerId)(original.fromId);
|
|
24
|
+
[sender, inputSender] = (0, Utils_1._getEntityPair)(senderId, entities, client._entityCache);
|
|
25
|
+
}
|
|
26
|
+
else if (ty === Helpers_1._EntityType.CHANNEL || ty === Helpers_1._EntityType.CHAT) {
|
|
27
|
+
peer = original.fromId;
|
|
28
|
+
[chat, inputChat] = (0, Utils_1._getEntityPair)((0, Utils_1.getPeerId)(peer), entities, client._entityCache);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
chatGetter_1.ChatGetter.initChatClass(this, {
|
|
32
|
+
chatPeer: peer,
|
|
33
|
+
chat: chat,
|
|
34
|
+
inputChat: inputChat,
|
|
35
|
+
});
|
|
36
|
+
senderGetter_1.SenderGetter.initSenderClass(this, {
|
|
37
|
+
senderId: senderId ? (0, Helpers_1.returnBigInt)(senderId) : undefined,
|
|
38
|
+
sender: sender,
|
|
39
|
+
inputSender: inputSender,
|
|
40
|
+
});
|
|
41
|
+
this._client = client;
|
|
42
|
+
}
|
|
43
|
+
[inspect_1.inspect.custom]() {
|
|
44
|
+
return (0, Helpers_1.betterConsoleLog)(this);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Forward = Forward;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatGetter } from "./chatGetter";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatGetter = void 0;
|
|
4
|
+
var chatGetter_1 = require("./chatGetter");
|
|
5
|
+
Object.defineProperty(exports, "ChatGetter", { enumerable: true, get: function () { return chatGetter_1.ChatGetter; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { TelegramClient } from "../..";
|
|
3
|
+
import type { EntityLike, MessageIDLike } from "../../define";
|
|
4
|
+
import { Api } from "../api";
|
|
5
|
+
import { inspect } from "../../inspect";
|
|
6
|
+
export declare class InlineResult {
|
|
7
|
+
private _ARTICLE;
|
|
8
|
+
private _PHOTO;
|
|
9
|
+
private _GIF;
|
|
10
|
+
private _VIDEO;
|
|
11
|
+
private _VIDEO_GIF;
|
|
12
|
+
private _AUDIO;
|
|
13
|
+
private _DOCUMENT;
|
|
14
|
+
private _LOCATION;
|
|
15
|
+
private _VENUE;
|
|
16
|
+
private _CONTACT;
|
|
17
|
+
private _GAME;
|
|
18
|
+
private readonly _entity;
|
|
19
|
+
private readonly _queryId;
|
|
20
|
+
private readonly result;
|
|
21
|
+
private _client;
|
|
22
|
+
[inspect.custom](): {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
constructor(client: TelegramClient, original: Api.TypeBotInlineResult, queryId?: Api.long, entity?: EntityLike);
|
|
26
|
+
get type(): string;
|
|
27
|
+
get message(): Api.TypeBotInlineMessage;
|
|
28
|
+
get description(): string | undefined;
|
|
29
|
+
get url(): string | undefined;
|
|
30
|
+
get photo(): Api.TypePhoto | Api.TypeWebDocument | undefined;
|
|
31
|
+
get document(): Api.TypeDocument | Api.TypeWebDocument | undefined;
|
|
32
|
+
click(entity?: EntityLike, replyTo?: MessageIDLike, silent?: boolean, clearDraft?: boolean, hideVia?: boolean): Promise<Api.TypeUpdates>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InlineResult = void 0;
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const Helpers_1 = require("../../Helpers");
|
|
6
|
+
const inspect_1 = require("../../inspect");
|
|
7
|
+
const Utils_1 = require("../../Utils");
|
|
8
|
+
class InlineResult {
|
|
9
|
+
constructor(client, original, queryId, entity) {
|
|
10
|
+
this._ARTICLE = "article";
|
|
11
|
+
this._PHOTO = "photo";
|
|
12
|
+
this._GIF = "gif";
|
|
13
|
+
this._VIDEO = "video";
|
|
14
|
+
this._VIDEO_GIF = "mpeg4_gif";
|
|
15
|
+
this._AUDIO = "audio";
|
|
16
|
+
this._DOCUMENT = "document";
|
|
17
|
+
this._LOCATION = "location";
|
|
18
|
+
this._VENUE = "venue";
|
|
19
|
+
this._CONTACT = "contact";
|
|
20
|
+
this._GAME = "game";
|
|
21
|
+
this._client = client;
|
|
22
|
+
this.result = original;
|
|
23
|
+
this._queryId = queryId;
|
|
24
|
+
this._entity = entity;
|
|
25
|
+
}
|
|
26
|
+
[inspect_1.inspect.custom]() {
|
|
27
|
+
return (0, Helpers_1.betterConsoleLog)(this);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return this.result.type;
|
|
31
|
+
}
|
|
32
|
+
get message() {
|
|
33
|
+
return this.result.sendMessage;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return this.result.description;
|
|
37
|
+
}
|
|
38
|
+
get url() {
|
|
39
|
+
if (this.result instanceof api_1.Api.BotInlineResult) {
|
|
40
|
+
return this.result.url;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
get photo() {
|
|
44
|
+
if (this.result instanceof api_1.Api.BotInlineResult) {
|
|
45
|
+
return this.result.thumb;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return this.result.photo;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
get document() {
|
|
52
|
+
if (this.result instanceof api_1.Api.BotInlineResult) {
|
|
53
|
+
return this.result.content;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return this.result.document;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async click(entity, replyTo, silent = false, clearDraft = false, hideVia = false) {
|
|
60
|
+
if (entity) {
|
|
61
|
+
entity = await this._client.getInputEntity(entity);
|
|
62
|
+
}
|
|
63
|
+
else if (this._entity) {
|
|
64
|
+
entity = this._entity;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error("You must provide the entity where the result should be sent to");
|
|
68
|
+
}
|
|
69
|
+
let replyObject = undefined;
|
|
70
|
+
if (replyTo != undefined) {
|
|
71
|
+
replyObject = new api_1.Api.InputReplyToMessage({
|
|
72
|
+
replyToMsgId: (0, Utils_1.getMessageId)(replyTo),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const request = new api_1.Api.messages.SendInlineBotResult({
|
|
76
|
+
peer: entity,
|
|
77
|
+
queryId: this._queryId,
|
|
78
|
+
id: this.result.id,
|
|
79
|
+
silent: silent,
|
|
80
|
+
clearDraft: clearDraft,
|
|
81
|
+
hideVia: hideVia,
|
|
82
|
+
replyTo: replyObject,
|
|
83
|
+
});
|
|
84
|
+
return await this._client.invoke(request);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.InlineResult = InlineResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { TelegramClient } from "../..";
|
|
3
|
+
import type { EntityLike } from "../../define";
|
|
4
|
+
import { Api } from "../api";
|
|
5
|
+
import { InlineResult } from "./inlineResult";
|
|
6
|
+
import { inspect } from "../../inspect";
|
|
7
|
+
export declare class InlineResults extends Array<InlineResult> {
|
|
8
|
+
private result;
|
|
9
|
+
private queryId;
|
|
10
|
+
private readonly cacheTime;
|
|
11
|
+
private readonly _validUntil;
|
|
12
|
+
private users;
|
|
13
|
+
private gallery;
|
|
14
|
+
private nextOffset;
|
|
15
|
+
private switchPm;
|
|
16
|
+
[inspect.custom](): {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
constructor(client: TelegramClient, original: Api.messages.TypeBotResults, entity?: EntityLike);
|
|
20
|
+
resultsValid(): boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InlineResults = void 0;
|
|
4
|
+
const inlineResult_1 = require("./inlineResult");
|
|
5
|
+
const Helpers_1 = require("../../Helpers");
|
|
6
|
+
const inspect_1 = require("../../inspect");
|
|
7
|
+
class InlineResults extends Array {
|
|
8
|
+
constructor(client, original, entity) {
|
|
9
|
+
super(...original.results.map((res) => new inlineResult_1.InlineResult(client, res, original.queryId, entity)));
|
|
10
|
+
this.result = original;
|
|
11
|
+
this.queryId = original.queryId;
|
|
12
|
+
this.cacheTime = original.cacheTime;
|
|
13
|
+
this._validUntil = new Date().getTime() / 1000 + this.cacheTime;
|
|
14
|
+
this.users = original.users;
|
|
15
|
+
this.gallery = Boolean(original.gallery);
|
|
16
|
+
this.nextOffset = original.nextOffset;
|
|
17
|
+
this.switchPm = original.switchPm;
|
|
18
|
+
}
|
|
19
|
+
[inspect_1.inspect.custom]() {
|
|
20
|
+
return (0, Helpers_1.betterConsoleLog)(this);
|
|
21
|
+
}
|
|
22
|
+
resultsValid() {
|
|
23
|
+
return new Date().getTime() / 1000 < this._validUntil;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.InlineResults = InlineResults;
|