@mtkruto/node 0.1.129 → 0.1.130

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.
Files changed (39) hide show
  1. package/esm/0_deps.d.ts +1 -0
  2. package/esm/0_deps.js +9 -0
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/client/5_client.d.ts +17 -3
  6. package/esm/client/5_client.js +229 -73
  7. package/esm/deps/deno.land/std@0.209.0/media_types/extension.d.ts +17 -0
  8. package/esm/deps/deno.land/std@0.209.0/media_types/extension.js +26 -0
  9. package/esm/deps/deno.land/std@0.209.0/media_types/extensions_by_type.d.ts +20 -0
  10. package/esm/deps/deno.land/std@0.209.0/media_types/extensions_by_type.js +31 -0
  11. package/esm/storage/0_storage.d.ts +3 -1
  12. package/esm/storage/0_storage.js +18 -5
  13. package/esm/tl/0_tl_raw_reader.js +1 -1
  14. package/esm/tl/3_utilities.d.ts +1 -0
  15. package/esm/tl/3_utilities.js +11 -0
  16. package/esm/types/1__getters.d.ts +1 -0
  17. package/esm/types/1_sticker.js +5 -4
  18. package/esm/types/4_chat.d.ts +3 -2
  19. package/esm/types/4_chat.js +16 -27
  20. package/package.json +1 -1
  21. package/script/0_deps.d.ts +1 -0
  22. package/script/0_deps.js +11 -1
  23. package/script/4_constants.d.ts +1 -1
  24. package/script/4_constants.js +1 -1
  25. package/script/client/5_client.d.ts +17 -3
  26. package/script/client/5_client.js +226 -70
  27. package/script/deps/deno.land/std@0.209.0/media_types/extension.d.ts +17 -0
  28. package/script/deps/deno.land/std@0.209.0/media_types/extension.js +30 -0
  29. package/script/deps/deno.land/std@0.209.0/media_types/extensions_by_type.d.ts +20 -0
  30. package/script/deps/deno.land/std@0.209.0/media_types/extensions_by_type.js +35 -0
  31. package/script/storage/0_storage.d.ts +3 -1
  32. package/script/storage/0_storage.js +18 -5
  33. package/script/tl/0_tl_raw_reader.js +1 -1
  34. package/script/tl/3_utilities.d.ts +1 -0
  35. package/script/tl/3_utilities.js +13 -1
  36. package/script/types/1__getters.d.ts +1 -0
  37. package/script/types/1_sticker.js +4 -3
  38. package/script/types/4_chat.d.ts +3 -2
  39. package/script/types/4_chat.js +17 -27
@@ -0,0 +1,17 @@
1
+ /**
2
+ * For a given media type, return the most relevant extension, or `undefined`
3
+ * if no extension can be found.
4
+ *
5
+ * Extensions are returned without a leading `.`.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { extension } from "https://deno.land/std@$STD_VERSION/media_types/extension.ts";
10
+ *
11
+ * extension("text/plain"); // `txt`
12
+ * extension("application/json"); // `json`
13
+ * extension("text/html; charset=UTF-8"); // `html`
14
+ * extension("application/foo"); // undefined
15
+ * ```
16
+ */
17
+ export declare function extension(type: string): string | undefined;
@@ -0,0 +1,26 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { extensionsByType } from "./extensions_by_type.js";
4
+ /**
5
+ * For a given media type, return the most relevant extension, or `undefined`
6
+ * if no extension can be found.
7
+ *
8
+ * Extensions are returned without a leading `.`.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { extension } from "https://deno.land/std@$STD_VERSION/media_types/extension.ts";
13
+ *
14
+ * extension("text/plain"); // `txt`
15
+ * extension("application/json"); // `json`
16
+ * extension("text/html; charset=UTF-8"); // `html`
17
+ * extension("application/foo"); // undefined
18
+ * ```
19
+ */
20
+ export function extension(type) {
21
+ const exts = extensionsByType(type);
22
+ if (exts) {
23
+ return exts[0];
24
+ }
25
+ return undefined;
26
+ }
@@ -0,0 +1,20 @@
1
+ import { extensions } from "./_util.js";
2
+ export { extensions };
3
+ /**
4
+ * Returns the extensions known to be associated with the media type `type`.
5
+ * The returned extensions will each begin with a leading dot, as in `.html`.
6
+ *
7
+ * When `type` has no associated extensions, the function returns `undefined`.
8
+ *
9
+ * Extensions are returned without a leading `.`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { extensionsByType } from "https://deno.land/std@$STD_VERSION/media_types/extensions_by_type.ts";
14
+ *
15
+ * extensionsByType("application/json"); // ["json", "map"]
16
+ * extensionsByType("text/html; charset=UTF-8"); // ["html", "htm", "shtml"]
17
+ * extensionsByType("application/foo"); // undefined
18
+ * ```
19
+ */
20
+ export declare function extensionsByType(type: string): string[] | undefined;
@@ -0,0 +1,31 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { parseMediaType } from "./parse_media_type.js";
4
+ import { extensions } from "./_util.js";
5
+ export { extensions };
6
+ /**
7
+ * Returns the extensions known to be associated with the media type `type`.
8
+ * The returned extensions will each begin with a leading dot, as in `.html`.
9
+ *
10
+ * When `type` has no associated extensions, the function returns `undefined`.
11
+ *
12
+ * Extensions are returned without a leading `.`.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { extensionsByType } from "https://deno.land/std@$STD_VERSION/media_types/extensions_by_type.ts";
17
+ *
18
+ * extensionsByType("application/json"); // ["json", "map"]
19
+ * extensionsByType("text/html; charset=UTF-8"); // ["html", "htm", "shtml"]
20
+ * extensionsByType("application/foo"); // undefined
21
+ * ```
22
+ */
23
+ export function extensionsByType(type) {
24
+ try {
25
+ const [mediaType] = parseMediaType(type);
26
+ return extensions.get(mediaType);
27
+ }
28
+ catch {
29
+ // just swallow errors, returning undefined
30
+ }
31
+ }
@@ -32,7 +32,7 @@ export declare abstract class Storage {
32
32
  updateUsernames(type: "user" | "channel", id: bigint, usernames: string[]): Promise<void>;
33
33
  getUsername(username: string): Promise<["channel" | "user", bigint, Date] | null>;
34
34
  setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
35
- getTLObject(keyOrBuffer: Uint8Array | readonly StorageKeyPart[]): Promise<import("../2_tl.js").ReadObject | null>;
35
+ getTlObject(keyOrBuffer: Uint8Array | readonly StorageKeyPart[]): Promise<import("../2_tl.js").ReadObject | null>;
36
36
  setState(state: enums.updates.State): Promise<void>;
37
37
  getState(): Promise<import("../tl/2_types.js").updates_State_ | null>;
38
38
  setMessage(chatId: number, messageId: number, message: enums.Message | null): Promise<void>;
@@ -71,4 +71,6 @@ export declare abstract class Storage {
71
71
  iterFileParts(id: bigint, partCount: number): AsyncGenerator<Uint8Array, void, unknown>;
72
72
  saveFilePart(id: bigint, index: number, bytes: Uint8Array): Promise<void>;
73
73
  setFilePartCount(id: bigint, partCount: number): Promise<void>;
74
+ setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
75
+ getCustomEmojiDocument(id: bigint): Promise<[import("../tl/2_types.js").Document_, Date] | null>;
74
76
  }
@@ -32,6 +32,7 @@ const KPARTS_PINNED_CHATS = (listId) => ["pinnedChats", listId];
32
32
  const KPARTS_SERVER_SALT = ["serverSalt"];
33
33
  const KPARTS_FILE = (fileId) => ["files", fileId];
34
34
  const KPARTS_FILE_PART = (fileId, n) => ["fileParts", fileId, n];
35
+ const KPARTS_CEMOJI = (id) => ["customEmojiDocuments", id];
35
36
  export class Storage {
36
37
  constructor() {
37
38
  _Storage_instances.add(this);
@@ -85,7 +86,7 @@ export class Storage {
85
86
  await this.set(key, rleEncode(value[serialize]()));
86
87
  }
87
88
  }
88
- async getTLObject(keyOrBuffer) {
89
+ async getTlObject(keyOrBuffer) {
89
90
  const buffer = keyOrBuffer instanceof Uint8Array ? keyOrBuffer : await this.get(keyOrBuffer);
90
91
  if (buffer != null) {
91
92
  return new TLReader(rleDecode(buffer)).readObject();
@@ -98,7 +99,7 @@ export class Storage {
98
99
  await this.setTlObject(KPARTS__STATE, state);
99
100
  }
100
101
  async getState() {
101
- return await this.getTLObject(KPARTS__STATE);
102
+ return await this.getTlObject(KPARTS__STATE);
102
103
  }
103
104
  async setMessage(chatId, messageId, message) {
104
105
  if (chatId > ZERO_CHANNEL_ID) {
@@ -117,11 +118,11 @@ export class Storage {
117
118
  return this.get(KPARTS_MESSAGE_REF(messageId));
118
119
  }
119
120
  async getMessage(chatId, messageId) {
120
- return await this.getTLObject(KPARTS_MESSAGE(chatId, messageId));
121
+ return await this.getTlObject(KPARTS_MESSAGE(chatId, messageId));
121
122
  }
122
123
  async getLastMessage(chatId) {
123
124
  for await (const [_, buffer] of await this.getMany({ prefix: KPARTS_MESSAGES(chatId) }, { limit: 1, reverse: true })) {
124
- return await this.getTLObject(buffer);
125
+ return await this.getTlObject(buffer);
125
126
  }
126
127
  return null;
127
128
  }
@@ -217,7 +218,7 @@ export class Storage {
217
218
  ++limit;
218
219
  const messages = new Array();
219
220
  for await (const [_, buffer] of await this.getMany({ start: KPARTS_MESSAGE(chatId, 0), end: KPARTS_MESSAGE(chatId, offsetId) }, { limit, reverse: true })) {
220
- const message = await this.getTLObject(buffer);
221
+ const message = await this.getTlObject(buffer);
221
222
  if ("id" in message && message.id == offsetId) {
222
223
  continue;
223
224
  }
@@ -255,6 +256,18 @@ export class Storage {
255
256
  }
256
257
  await this.set(KPARTS_FILE(id), partCount);
257
258
  }
259
+ async setCustomEmojiDocument(id, document) {
260
+ await this.set(KPARTS_CEMOJI(id), [rleEncode(document[serialize]()), new Date()]);
261
+ }
262
+ async getCustomEmojiDocument(id) {
263
+ const v = await this.get(KPARTS_CEMOJI(id));
264
+ if (v != null) {
265
+ return [await this.getTlObject([0]), v[1]];
266
+ }
267
+ else {
268
+ return null;
269
+ }
270
+ }
258
271
  }
259
272
  _Storage__authKeyId = new WeakMap(), _Storage_instances = new WeakSet(), _Storage_resetAuthKeyId = async function _Storage_resetAuthKeyId(authKey) {
260
273
  if (authKey != null) {
@@ -34,7 +34,7 @@ export class TLRawReader {
34
34
  return bigIntFromBuffer(buffer, true, signed);
35
35
  }
36
36
  readDouble() {
37
- return new DataView(this.read(8).buffer).getFloat64(0, true); // TODO: cover in tests
37
+ return new DataView(this.read(8).buffer).getFloat64(0, true);
38
38
  }
39
39
  readInt128(signed = true) {
40
40
  const buffer = this.read(128 / 8);
@@ -1,3 +1,4 @@
1
1
  import { enums } from "./2_types.js";
2
2
  export declare function getChannelChatId(channelId: bigint): number;
3
3
  export declare function peerToChatId(peer: enums.Peer | enums.InputPeer): number;
4
+ export declare function chatIdToPeer(chatId: number): import("./2_types.js").PeerUser_ | import("./2_types.js").PeerChat_ | import("./2_types.js").PeerChannel_;
@@ -17,3 +17,14 @@ export function peerToChatId(peer) {
17
17
  UNREACHABLE();
18
18
  }
19
19
  }
20
+ export function chatIdToPeer(chatId) {
21
+ if (chatId > 0) {
22
+ return new types.PeerUser({ user_id: BigInt(chatId) });
23
+ }
24
+ else if (chatId > ZERO_CHANNEL_ID) {
25
+ return new types.PeerChat({ chat_id: BigInt(Math.abs(chatId)) });
26
+ }
27
+ else {
28
+ return new types.PeerChannel({ channel_id: BigInt(ZERO_CHANNEL_ID - chatId) });
29
+ }
30
+ }
@@ -5,6 +5,7 @@ export interface EntityGetter {
5
5
  (peer: types.PeerUser): MaybePromise<types.User | null>;
6
6
  (peer: types.PeerChat): MaybePromise<types.Chat | types.ChatForbidden | null>;
7
7
  (peer: types.PeerChannel): MaybePromise<types.Channel | types.ChannelForbidden | null>;
8
+ (peer: types.PeerUser | types.PeerChat | types.PeerChannel): MaybePromise<types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden | null>;
8
9
  }
9
10
  export interface InputPeerGetter {
10
11
  (id: ChatID): Promise<types.InputPeerUser | types.InputPeerChannel | types.InputPeerChat>;
@@ -1,12 +1,13 @@
1
- import { as, types } from "../2_tl.js";
1
+ import { cleanObject } from "../1_utilities.js";
2
+ import { types } from "../2_tl.js";
2
3
  import { constructMaskPosition } from "./0_mask_position.js";
3
4
  import { constructThumbnail } from "./0_thumbnail.js";
4
5
  export async function constructSticker(document, fileId, fileUniqueId, getStickerSetName) {
5
6
  const stickerAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeSticker);
6
7
  const imageSizeAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeImageSize);
7
8
  const videoAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeVideo);
8
- const setName = await getStickerSetName(stickerAttribute.stickerset[as](types.InputStickerSetID));
9
- return {
9
+ const setName = stickerAttribute.stickerset instanceof types.InputStickerSetID ? await getStickerSetName(stickerAttribute.stickerset) : undefined;
10
+ return cleanObject({
10
11
  fileId,
11
12
  fileUniqueId,
12
13
  // TODO: custom emoji type?
@@ -23,5 +24,5 @@ export async function constructSticker(document, fileId, fileUniqueId, getSticke
23
24
  customEmojiId: undefined,
24
25
  needsRepainting: undefined,
25
26
  fileSize: Number(document.size),
26
- };
27
+ });
27
28
  }
@@ -29,5 +29,6 @@ export declare namespace Chat {
29
29
  export type Chat = Chat.Channel | Chat.Supergroup | Chat.Group | Chat.Private;
30
30
  export declare function getChatOrder(lastMessage: Message | undefined, pinned: number): string;
31
31
  export declare function constructChat(dialog: enums.Dialog, dialogs: types.messages.Dialogs | types.messages.DialogsSlice, pinnedChats: number[], getEntity: EntityGetter, getMessage: MessageGetter<"replyToMessage">, getStickerSetName: StickerSetNameGetter): Promise<Chat>;
32
- export declare function constructChat2(chatId: number, pinned: number, lastMessage: Message | undefined, getEntity: EntityGetter): Promise<Chat | null>;
33
- export declare function constructChat3(chatId: number, pinned: number, lastMessageId: number, getEntity: EntityGetter, getMessage: MessageGetter<"replyToMessage">): Promise<Chat | null>;
32
+ export declare function constructChat2(entity: types.User | types.Chat | types.ChatForbidden | types.Channel | types.ChannelForbidden, pinned: number, lastMessage: Message | undefined): Chat;
33
+ export declare function constructChat3(chatId: number, pinned: number, lastMessage: Message | undefined, getEntity: EntityGetter): Promise<Chat | null>;
34
+ export declare function constructChat4(chatId: number, pinned: number, lastMessageId: number, getEntity: EntityGetter, getMessage: MessageGetter<"replyToMessage">): Promise<Chat | null>;
@@ -1,5 +1,5 @@
1
- import { cleanObject, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
2
- import { peerToChatId, types } from "../2_tl.js";
1
+ import { cleanObject, UNREACHABLE } from "../1_utilities.js";
2
+ import { chatIdToPeer, peerToChatId, types } from "../2_tl.js";
3
3
  import { constructChatP } from "./1_chat_p.js";
4
4
  import { constructChatPhoto } from "./0_chat_photo.js";
5
5
  import { constructMessage } from "./3_message.js";
@@ -69,29 +69,8 @@ export async function constructChat(dialog, dialogs, pinnedChats, getEntity, get
69
69
  UNREACHABLE();
70
70
  }
71
71
  }
72
- export async function constructChat2(chatId, pinned, lastMessage, getEntity) {
73
- let chatPAlsoPhoto = null;
74
- if (chatId < ZERO_CHANNEL_ID) {
75
- const entity = await getEntity(new types.PeerChannel({ channel_id: BigInt(Math.abs(chatId - ZERO_CHANNEL_ID)) }));
76
- if (entity != null) {
77
- chatPAlsoPhoto = getChatPAlsoPhoto(entity);
78
- }
79
- }
80
- else if (chatId < 0) {
81
- const entity = await getEntity(new types.PeerChat({ chat_id: BigInt(Math.abs(chatId)) }));
82
- if (entity != null) {
83
- chatPAlsoPhoto = getChatPAlsoPhoto(entity);
84
- }
85
- }
86
- else {
87
- const entity = await getEntity(new types.PeerUser({ user_id: BigInt(chatId) }));
88
- if (entity != null) {
89
- chatPAlsoPhoto = getChatPAlsoPhoto(entity);
90
- }
91
- }
92
- if (chatPAlsoPhoto == null) {
93
- return null;
94
- }
72
+ export function constructChat2(entity, pinned, lastMessage) {
73
+ const chatPAlsoPhoto = getChatPAlsoPhoto(entity);
95
74
  const order = getChatOrder(lastMessage, pinned);
96
75
  const { also, photo, chatP } = chatPAlsoPhoto;
97
76
  if (chatP.type == "group") {
@@ -110,8 +89,18 @@ export async function constructChat2(chatId, pinned, lastMessage, getEntity) {
110
89
  UNREACHABLE();
111
90
  }
112
91
  }
113
- export async function constructChat3(chatId, pinned, lastMessageId, getEntity, getMessage) {
92
+ export async function constructChat3(chatId, pinned, lastMessage, getEntity) {
93
+ const peer = chatIdToPeer(chatId);
94
+ const entity = await getEntity(peer);
95
+ if (entity == null) {
96
+ return null;
97
+ }
98
+ else {
99
+ return constructChat2(entity, pinned, lastMessage);
100
+ }
101
+ }
102
+ export async function constructChat4(chatId, pinned, lastMessageId, getEntity, getMessage) {
114
103
  const lastMessage_ = lastMessageId > 0 ? await getMessage(chatId, lastMessageId) : null;
115
104
  const lastMessage = lastMessage_ == null ? undefined : lastMessage_;
116
- return await constructChat2(chatId, pinned, lastMessage, getEntity);
105
+ return await constructChat3(chatId, pinned, lastMessage, getEntity);
117
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.1.129",
3
+ "version": "0.1.130",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -2,6 +2,7 @@ export * from "./deps/deno.land/std@0.209.0/assert/mod.js";
2
2
  export * as path from "./deps/deno.land/std@0.209.0/path/mod.js";
3
3
  export { decodeBase64, encodeBase64 } from "./deps/deno.land/std@0.209.0/encoding/base64.js";
4
4
  export { contentType } from "./deps/deno.land/std@0.209.0/media_types/content_type.js";
5
+ export declare function extension(mimeType: string): string;
5
6
  export { ctr256, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.3.3/mod.js";
6
7
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
7
8
  export { Mutex, type MutexInterface } from "async-mutex";
package/script/0_deps.js CHANGED
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256 = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.path = void 0;
29
+ exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256 = exports.extension = exports.contentType = exports.encodeBase64 = exports.decodeBase64 = exports.path = void 0;
30
30
  __exportStar(require("./deps/deno.land/std@0.209.0/assert/mod.js"), exports);
31
31
  exports.path = __importStar(require("./deps/deno.land/std@0.209.0/path/mod.js"));
32
32
  var base64_js_1 = require("./deps/deno.land/std@0.209.0/encoding/base64.js");
@@ -34,6 +34,16 @@ Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function
34
34
  Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return base64_js_1.encodeBase64; } });
35
35
  var content_type_js_1 = require("./deps/deno.land/std@0.209.0/media_types/content_type.js");
36
36
  Object.defineProperty(exports, "contentType", { enumerable: true, get: function () { return content_type_js_1.contentType; } });
37
+ const extension_js_1 = require("./deps/deno.land/std@0.209.0/media_types/extension.js");
38
+ function extension(mimeType) {
39
+ if (mimeType == "application/x-tgsticker") {
40
+ return "tgs";
41
+ }
42
+ else {
43
+ return (0, extension_js_1.extension)(mimeType) || "unknown";
44
+ }
45
+ }
46
+ exports.extension = extension;
37
47
  var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.3.3/mod.js");
38
48
  Object.defineProperty(exports, "ctr256", { enumerable: true, get: function () { return mod_js_1.ctr256; } });
39
49
  Object.defineProperty(exports, "factorize", { enumerable: true, get: function () { return mod_js_1.factorize; } });
@@ -4,7 +4,7 @@ export type PublicKeys = readonly [bigint, [bigint, bigint]][];
4
4
  export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const INITIAL_DC: DC;
6
6
  export declare const LAYER = 167;
7
- export declare const APP_VERSION = "MTKruto 0.1.129";
7
+ export declare const APP_VERSION = "MTKruto 0.1.130";
8
8
  export declare const DEVICE_MODEL: string;
9
9
  export declare const LANG_CODE: string;
10
10
  export declare const LANG_PACK = "";
@@ -79,7 +79,7 @@ exports.PUBLIC_KEYS = Object.freeze([
79
79
  ]);
80
80
  exports.INITIAL_DC = "2";
81
81
  exports.LAYER = 167;
82
- exports.APP_VERSION = "MTKruto 0.1.129";
82
+ exports.APP_VERSION = "MTKruto 0.1.130";
83
83
  // @ts-ignore: lib
84
84
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
85
85
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -2,7 +2,7 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { BotCommand, CallbackQuery, Chat, ChatAction, ChatID, InlineQuery, InlineQueryResult, Message, ParseMode, User } from "../3_types.js";
5
+ import { BotCommand, CallbackQuery, Chat, ChatAction, ChatID, Document, InlineQuery, InlineQueryResult, Message, ParseMode, User } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
7
  import { FileSource, With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
@@ -157,6 +157,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
157
157
  private [getEntity];
158
158
  private [getEntity];
159
159
  private [getEntity];
160
+ private [getEntity];
160
161
  processResult(result: ReadObject): Promise<void>;
161
162
  /**
162
163
  * Send a text message.
@@ -214,7 +215,7 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
214
215
  * ```
215
216
  * @returns A generator yielding the contents of the file.
216
217
  */
217
- download(fileId: string, params?: DownloadParams): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
218
+ download(fileId: string, params?: DownloadParams): AsyncGenerator<Uint8Array, void, unknown>;
218
219
  private [getStickerSetName];
219
220
  /**
220
221
  * Forward multiple messages.
@@ -395,11 +396,17 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
395
396
  */
396
397
  getNetworkStatistics(): Promise<NetworkStatistics>;
397
398
  /**
398
- * Get chats.
399
+ * Get chats from a chat list.
399
400
  *
400
401
  * @method
401
402
  */
402
403
  getChats(params?: GetChatsParams): Promise<Chat[]>;
404
+ /**
405
+ * Get a chat.
406
+ *
407
+ * @method
408
+ */
409
+ getChat(chatId: ChatID): Promise<Chat>;
403
410
  /**
404
411
  * Get chat history.
405
412
  *
@@ -407,5 +414,12 @@ export declare class Client<C extends Context = Context> extends ClientAbstract
407
414
  * @method
408
415
  */
409
416
  getHistory(chatId: ChatID, params?: GetHistoryParams): Promise<Message[]>;
417
+ /**
418
+ * Get custom emoji documents for download.
419
+ *
420
+ * @param id Identifier of one or more of custom emojis.
421
+ * @method
422
+ */
423
+ getCustomEmojiDocuments(id: string | string[]): Promise<Document[]>;
410
424
  }
411
425
  export {};