@mtkruto/node 0.1.105 → 0.1.106

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.
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.1.105";
8
+ export declare const APP_VERSION = "MTKruto 0.1.106";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -54,7 +54,7 @@ export const PUBLIC_KEYS = Object.freeze([
54
54
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
55
55
  export const INITIAL_DC = "2-test";
56
56
  export const LAYER = 161;
57
- export const APP_VERSION = "MTKruto 0.1.105";
57
+ export const APP_VERSION = "MTKruto 0.1.106";
58
58
  // @ts-ignore: lib
59
59
  export const 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;
60
60
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -7,10 +7,10 @@ import { Migrate } from "../4_errors.js";
7
7
  import { With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
9
9
  import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetMyCommandsParams, Handler, ParseMode, SendMessagesParams, SendPollParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
- export declare const getEntity: unique symbol;
11
- export declare const getStickerSetName: unique symbol;
10
+ declare const getEntity: unique symbol;
11
+ declare const getStickerSetName: unique symbol;
12
12
  export declare const handleMigrationError: unique symbol;
13
- export declare const getMessageWithReply: unique symbol;
13
+ declare const getMessageWithReply: unique symbol;
14
14
  export declare const restartAuth: unique symbol;
15
15
  export declare class ConnectionError extends Error {
16
16
  }
@@ -126,9 +126,9 @@ export declare class Client extends ClientAbstract {
126
126
  private getChannelAccessHash;
127
127
  getInputPeer(id: ChatID): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
128
128
  private getInputPeerInner;
129
- [getEntity](peer: types.PeerUser): Promise<types.User | null>;
130
- [getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
131
- [getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
129
+ private [getEntity];
130
+ private [getEntity];
131
+ private [getEntity];
132
132
  processResult(result: ReadObject): Promise<void>;
133
133
  private updatesToMessages;
134
134
  private resolveSendAs;
@@ -137,6 +137,7 @@ export declare class Client extends ClientAbstract {
137
137
  *
138
138
  * @param chatId The chat to send the message to.
139
139
  * @param text The message's text.
140
+ * @method
140
141
  */
141
142
  sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<With<Message, "text">>;
142
143
  private parseText;
@@ -146,6 +147,7 @@ export declare class Client extends ClientAbstract {
146
147
  * @param chatId The chat where the message is.
147
148
  * @param messageId The ID of the message.
148
149
  * @param text The new text of the message.
150
+ * @method
149
151
  */
150
152
  editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
151
153
  private getMessagesInner;
@@ -154,14 +156,16 @@ export declare class Client extends ClientAbstract {
154
156
  *
155
157
  * @param chatId The identifier of the chat to retrieve the messages from.
156
158
  * @param messageIds The identifiers of the messages to retrieve.
159
+ * @method
157
160
  */
158
161
  getMessages(chatId_: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
159
- [getMessageWithReply](chatId: ChatID, messageId: number): Promise<Message | null>;
162
+ private [getMessageWithReply];
160
163
  /**
161
164
  * Retrieve a single message.
162
165
  *
163
166
  * @param chatId The identifier of the chat to retrieve the message from.
164
167
  * @param messageId The identifier of the message to retrieve.
168
+ * @method
165
169
  */
166
170
  getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
167
171
  private downloadInner;
@@ -169,15 +173,17 @@ export declare class Client extends ClientAbstract {
169
173
  * Download a file.
170
174
  *
171
175
  * @param fileId The identifier of the file to download.
176
+ * @method
172
177
  */
173
178
  download(fileId: string, params?: DownloadParams): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
174
- [getStickerSetName](inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
179
+ private [getStickerSetName];
175
180
  /**
176
181
  * Forward multiple messages.
177
182
  *
178
183
  * @param from The identifier of the chat to forward the messages from.
179
184
  * @param to The identifier of the chat to forward the messages to.
180
185
  * @param messageIds The identifiers of the messages to forward.
186
+ * @method
181
187
  */
182
188
  forwardMessages(from: ChatID, to: ChatID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
183
189
  /**
@@ -186,10 +192,13 @@ export declare class Client extends ClientAbstract {
186
192
  * @param from The identifier of the chat to forward the message from.
187
193
  * @param to The identifier of the chat to forward the message to.
188
194
  * @param messageId The identifier of the message to forward.
195
+ * @method
189
196
  */
190
197
  forwardMessage(from: ChatID, to: ChatID, messageId: number, params?: ForwardMessagesParams): Promise<Message>;
191
198
  /**
192
199
  * Get information on the currently authorized user.
200
+ *
201
+ * @method
193
202
  */
194
203
  getMe(): Promise<import("../3_types.js").User>;
195
204
  private handleUpdate;
@@ -197,6 +206,7 @@ export declare class Client extends ClientAbstract {
197
206
  * Answer a callback query. Bot-only.
198
207
  *
199
208
  * @param id ID of the callback query to answer.
209
+ * @method
200
210
  */
201
211
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
202
212
  private usernameResolver;
@@ -208,6 +218,7 @@ export declare class Client extends ClientAbstract {
208
218
  * @param chatId The chat to send the poll to.
209
219
  * @param question The poll's question.
210
220
  * @param options The poll's options.
221
+ * @method
211
222
  */
212
223
  sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
213
224
  /**
@@ -216,18 +227,21 @@ export declare class Client extends ClientAbstract {
216
227
  * @param chatId The chat to send the chat action to.
217
228
  * @param action The chat action.
218
229
  * @param messageThreadId The thread to send the chat action to.
230
+ * @method
219
231
  */
220
232
  sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
221
233
  /**
222
234
  * Upload a file.
223
235
  *
224
236
  * @param contents The contents of the file.
237
+ * @method
225
238
  */
226
239
  upload(contents: Uint8Array, params?: UploadParams): Promise<types.InputFile | types.InputFileBig>;
227
240
  /**
228
241
  * Set the bot's commands in the given scope and/or language. Bot-only.
229
242
  *
230
243
  * @param commands The commands to set.
244
+ * @method
231
245
  */
232
246
  setMyCommands(commands: BotCommand[], params?: SetMyCommandsParams): Promise<void>;
233
247
  /**
@@ -239,6 +253,7 @@ export declare class Client extends ClientAbstract {
239
253
  *
240
254
  * @param id The ID of the inline query to answer.
241
255
  * @param results The results to answer with.
256
+ * @method
242
257
  */
243
258
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
244
259
  private handle;
@@ -250,6 +265,8 @@ export declare class Client extends ClientAbstract {
250
265
  private setMyInfo;
251
266
  /**
252
267
  * Set the bot's description in the given language. Bot-only.
268
+ *
269
+ * @method
253
270
  */
254
271
  setMyDescription({ description, languageCode }: {
255
272
  description?: string;
@@ -257,6 +274,8 @@ export declare class Client extends ClientAbstract {
257
274
  }): Promise<void>;
258
275
  /**
259
276
  * Set the bot's name in the given language. Bot-only.
277
+ *
278
+ * @method
260
279
  */
261
280
  setMyName({ name, languageCode }: {
262
281
  name?: string;
@@ -264,6 +283,8 @@ export declare class Client extends ClientAbstract {
264
283
  }): Promise<void>;
265
284
  /**
266
285
  * Set the bot's short description in the given language. Bot-only.
286
+ *
287
+ * @method
267
288
  */
268
289
  setMyShortDescription({ shortDescription: about, languageCode }: {
269
290
  shortDescription?: string;
@@ -272,14 +293,21 @@ export declare class Client extends ClientAbstract {
272
293
  private getMyInfo;
273
294
  /**
274
295
  * Get the bot's description in the given language. Bot-only.
296
+ *
297
+ * @method
275
298
  */
276
299
  getMyDescription(languageCode?: string): Promise<string>;
277
300
  /**
278
301
  * Set the bot's name in the given language. Bot-only.
302
+ *
303
+ * @method
279
304
  */
280
305
  getMyName(languageCode?: string): Promise<string>;
281
306
  /**
282
307
  * Get the bot's short description in the given language. Bot-only.
308
+ *
309
+ * @method
283
310
  */
284
311
  getMyShortDescription(languageCode?: string): Promise<string>;
285
312
  }
313
+ export {};
@@ -18,10 +18,10 @@ const dGapC = debug("Client/recoverChannelUpdateGap");
18
18
  const dAuth = debug("Client/authorize");
19
19
  const dRecv = debug("Client/receiveLoop");
20
20
  const dUpload = debug("Client/upload");
21
- export const getEntity = Symbol();
22
- export const getStickerSetName = Symbol();
21
+ const getEntity = Symbol();
22
+ const getStickerSetName = Symbol();
23
23
  export const handleMigrationError = Symbol();
24
- export const getMessageWithReply = Symbol();
24
+ const getMessageWithReply = Symbol();
25
25
  export const restartAuth = Symbol();
26
26
  export class ConnectionError extends Error {
27
27
  }
@@ -1241,6 +1241,7 @@ export class Client extends ClientAbstract {
1241
1241
  *
1242
1242
  * @param chatId The chat to send the message to.
1243
1243
  * @param text The message's text.
1244
+ * @method
1244
1245
  */
1245
1246
  async sendMessage(chatId, text, params) {
1246
1247
  const [message, entities] = this.parseText(text, params);
@@ -1294,6 +1295,7 @@ export class Client extends ClientAbstract {
1294
1295
  * @param chatId The chat where the message is.
1295
1296
  * @param messageId The ID of the message.
1296
1297
  * @param text The new text of the message.
1298
+ * @method
1297
1299
  */
1298
1300
  async editMessageText(chatId, messageId, text, params) {
1299
1301
  const [message, entities] = this.parseText(text, params);
@@ -1350,6 +1352,7 @@ export class Client extends ClientAbstract {
1350
1352
  *
1351
1353
  * @param chatId The identifier of the chat to retrieve the messages from.
1352
1354
  * @param messageIds The identifiers of the messages to retrieve.
1355
+ * @method
1353
1356
  */
1354
1357
  async getMessages(chatId_, messageIds) {
1355
1358
  return await this.getMessagesInner(chatId_, messageIds).then((v) => v.map((v) => v.message));
@@ -1363,6 +1366,7 @@ export class Client extends ClientAbstract {
1363
1366
  *
1364
1367
  * @param chatId The identifier of the chat to retrieve the message from.
1365
1368
  * @param messageId The identifier of the message to retrieve.
1369
+ * @method
1366
1370
  */
1367
1371
  async getMessage(chatId, messageId) {
1368
1372
  const messages = await this.getMessages(chatId, [messageId]);
@@ -1413,6 +1417,7 @@ export class Client extends ClientAbstract {
1413
1417
  * Download a file.
1414
1418
  *
1415
1419
  * @param fileId The identifier of the file to download.
1420
+ * @method
1416
1421
  */
1417
1422
  async download(fileId, params) {
1418
1423
  const fileId_ = FileID.decode(fileId);
@@ -1457,6 +1462,7 @@ export class Client extends ClientAbstract {
1457
1462
  * @param from The identifier of the chat to forward the messages from.
1458
1463
  * @param to The identifier of the chat to forward the messages to.
1459
1464
  * @param messageIds The identifiers of the messages to forward.
1465
+ * @method
1460
1466
  */
1461
1467
  async forwardMessages(from, to, messageIds, params) {
1462
1468
  const result = await this.invoke(new functions.MessagesForwardMessages({
@@ -1479,12 +1485,15 @@ export class Client extends ClientAbstract {
1479
1485
  * @param from The identifier of the chat to forward the message from.
1480
1486
  * @param to The identifier of the chat to forward the message to.
1481
1487
  * @param messageId The identifier of the message to forward.
1488
+ * @method
1482
1489
  */
1483
1490
  async forwardMessage(from, to, messageId, params) {
1484
1491
  return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1485
1492
  }
1486
1493
  /**
1487
1494
  * Get information on the currently authorized user.
1495
+ *
1496
+ * @method
1488
1497
  */
1489
1498
  async getMe() {
1490
1499
  const users = await this.invoke(new functions.UsersGetUsers({ id: [new types.InputUserSelf()] }));
@@ -1593,6 +1602,7 @@ export class Client extends ClientAbstract {
1593
1602
  * Answer a callback query. Bot-only.
1594
1603
  *
1595
1604
  * @param id ID of the callback query to answer.
1605
+ * @method
1596
1606
  */
1597
1607
  async answerCallbackQuery(id, params) {
1598
1608
  await this.assertBot("answerCallbackQuery");
@@ -1621,6 +1631,7 @@ export class Client extends ClientAbstract {
1621
1631
  * @param chatId The chat to send the poll to.
1622
1632
  * @param question The poll's question.
1623
1633
  * @param options The poll's options.
1634
+ * @method
1624
1635
  */
1625
1636
  async sendPoll(chatId, question, options, params) {
1626
1637
  const peer = await this.getInputPeer(chatId);
@@ -1673,6 +1684,7 @@ export class Client extends ClientAbstract {
1673
1684
  * @param chatId The chat to send the chat action to.
1674
1685
  * @param action The chat action.
1675
1686
  * @param messageThreadId The thread to send the chat action to.
1687
+ * @method
1676
1688
  */
1677
1689
  async sendChatAction(chatId, action_, messageThreadId) {
1678
1690
  let action;
@@ -1719,6 +1731,7 @@ export class Client extends ClientAbstract {
1719
1731
  * Upload a file.
1720
1732
  *
1721
1733
  * @param contents The contents of the file.
1734
+ * @method
1722
1735
  */
1723
1736
  async upload(contents, params) {
1724
1737
  const isBig = contents.length > 1048576; // 10 MB
@@ -1809,6 +1822,7 @@ export class Client extends ClientAbstract {
1809
1822
  * Set the bot's commands in the given scope and/or language. Bot-only.
1810
1823
  *
1811
1824
  * @param commands The commands to set.
1825
+ * @method
1812
1826
  */
1813
1827
  async setMyCommands(commands, params) {
1814
1828
  await this.invoke(new functions.BotsSetBotCommands({
@@ -1832,6 +1846,7 @@ export class Client extends ClientAbstract {
1832
1846
  *
1833
1847
  * @param id The ID of the inline query to answer.
1834
1848
  * @param results The results to answer with.
1849
+ * @method
1835
1850
  */
1836
1851
  async answerInlineQuery(id, results, params) {
1837
1852
  await this.invoke(new functions.MessagesSetInlineBotResults({
@@ -1896,6 +1911,8 @@ export class Client extends ClientAbstract {
1896
1911
  }
1897
1912
  /**
1898
1913
  * Set the bot's description in the given language. Bot-only.
1914
+ *
1915
+ * @method
1899
1916
  */
1900
1917
  async setMyDescription({ description, languageCode }) {
1901
1918
  await this.assertBot("setMyDescription");
@@ -1903,6 +1920,8 @@ export class Client extends ClientAbstract {
1903
1920
  }
1904
1921
  /**
1905
1922
  * Set the bot's name in the given language. Bot-only.
1923
+ *
1924
+ * @method
1906
1925
  */
1907
1926
  async setMyName({ name, languageCode }) {
1908
1927
  await this.assertBot("setMyName");
@@ -1910,6 +1929,8 @@ export class Client extends ClientAbstract {
1910
1929
  }
1911
1930
  /**
1912
1931
  * Set the bot's short description in the given language. Bot-only.
1932
+ *
1933
+ * @method
1913
1934
  */
1914
1935
  async setMyShortDescription({ shortDescription: about, languageCode }) {
1915
1936
  await this.assertBot("setMyShortDescription");
@@ -1920,6 +1941,8 @@ export class Client extends ClientAbstract {
1920
1941
  }
1921
1942
  /**
1922
1943
  * Get the bot's description in the given language. Bot-only.
1944
+ *
1945
+ * @method
1923
1946
  */
1924
1947
  async getMyDescription(languageCode) {
1925
1948
  await this.assertBot("getMyDescription");
@@ -1927,6 +1950,8 @@ export class Client extends ClientAbstract {
1927
1950
  }
1928
1951
  /**
1929
1952
  * Set the bot's name in the given language. Bot-only.
1953
+ *
1954
+ * @method
1930
1955
  */
1931
1956
  async getMyName(languageCode) {
1932
1957
  await this.assertBot("getMyName");
@@ -1934,6 +1959,8 @@ export class Client extends ClientAbstract {
1934
1959
  }
1935
1960
  /**
1936
1961
  * Get the bot's short description in the given language. Bot-only.
1962
+ *
1963
+ * @method
1937
1964
  */
1938
1965
  async getMyShortDescription(languageCode) {
1939
1966
  await this.assertBot("getMyShortDescription");
@@ -71,12 +71,6 @@ export declare namespace Chat {
71
71
  }
72
72
  interface Channel extends ChannelBase {
73
73
  type: "channel";
74
- /** Title, for supergroups, channels and group chats */
75
- title: string;
76
- /** Username, for private chats, supergroups and channels if available */
77
- username?: string;
78
- /** Additional usernames */
79
- also?: string[];
80
74
  }
81
75
  interface Supergroup extends ChannelBase {
82
76
  type: "supergroup";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.1.105",
5
+ "version": "0.1.106",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.1.105";
8
+ export declare const APP_VERSION = "MTKruto 0.1.106";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
80
80
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
81
81
  exports.INITIAL_DC = "2-test";
82
82
  exports.LAYER = 161;
83
- exports.APP_VERSION = "MTKruto 0.1.105";
83
+ exports.APP_VERSION = "MTKruto 0.1.106";
84
84
  // @ts-ignore: lib
85
85
  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;
86
86
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -7,10 +7,10 @@ import { Migrate } from "../4_errors.js";
7
7
  import { With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
9
9
  import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetMyCommandsParams, Handler, ParseMode, SendMessagesParams, SendPollParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
- export declare const getEntity: unique symbol;
11
- export declare const getStickerSetName: unique symbol;
10
+ declare const getEntity: unique symbol;
11
+ declare const getStickerSetName: unique symbol;
12
12
  export declare const handleMigrationError: unique symbol;
13
- export declare const getMessageWithReply: unique symbol;
13
+ declare const getMessageWithReply: unique symbol;
14
14
  export declare const restartAuth: unique symbol;
15
15
  export declare class ConnectionError extends Error {
16
16
  }
@@ -126,9 +126,9 @@ export declare class Client extends ClientAbstract {
126
126
  private getChannelAccessHash;
127
127
  getInputPeer(id: ChatID): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
128
128
  private getInputPeerInner;
129
- [getEntity](peer: types.PeerUser): Promise<types.User | null>;
130
- [getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
131
- [getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
129
+ private [getEntity];
130
+ private [getEntity];
131
+ private [getEntity];
132
132
  processResult(result: ReadObject): Promise<void>;
133
133
  private updatesToMessages;
134
134
  private resolveSendAs;
@@ -137,6 +137,7 @@ export declare class Client extends ClientAbstract {
137
137
  *
138
138
  * @param chatId The chat to send the message to.
139
139
  * @param text The message's text.
140
+ * @method
140
141
  */
141
142
  sendMessage(chatId: ChatID, text: string, params?: SendMessagesParams): Promise<With<Message, "text">>;
142
143
  private parseText;
@@ -146,6 +147,7 @@ export declare class Client extends ClientAbstract {
146
147
  * @param chatId The chat where the message is.
147
148
  * @param messageId The ID of the message.
148
149
  * @param text The new text of the message.
150
+ * @method
149
151
  */
150
152
  editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
151
153
  private getMessagesInner;
@@ -154,14 +156,16 @@ export declare class Client extends ClientAbstract {
154
156
  *
155
157
  * @param chatId The identifier of the chat to retrieve the messages from.
156
158
  * @param messageIds The identifiers of the messages to retrieve.
159
+ * @method
157
160
  */
158
161
  getMessages(chatId_: ChatID, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
159
- [getMessageWithReply](chatId: ChatID, messageId: number): Promise<Message | null>;
162
+ private [getMessageWithReply];
160
163
  /**
161
164
  * Retrieve a single message.
162
165
  *
163
166
  * @param chatId The identifier of the chat to retrieve the message from.
164
167
  * @param messageId The identifier of the message to retrieve.
168
+ * @method
165
169
  */
166
170
  getMessage(chatId: ChatID, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
167
171
  private downloadInner;
@@ -169,15 +173,17 @@ export declare class Client extends ClientAbstract {
169
173
  * Download a file.
170
174
  *
171
175
  * @param fileId The identifier of the file to download.
176
+ * @method
172
177
  */
173
178
  download(fileId: string, params?: DownloadParams): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
174
- [getStickerSetName](inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
179
+ private [getStickerSetName];
175
180
  /**
176
181
  * Forward multiple messages.
177
182
  *
178
183
  * @param from The identifier of the chat to forward the messages from.
179
184
  * @param to The identifier of the chat to forward the messages to.
180
185
  * @param messageIds The identifiers of the messages to forward.
186
+ * @method
181
187
  */
182
188
  forwardMessages(from: ChatID, to: ChatID, messageIds: number[], params?: ForwardMessagesParams): Promise<Message[]>;
183
189
  /**
@@ -186,10 +192,13 @@ export declare class Client extends ClientAbstract {
186
192
  * @param from The identifier of the chat to forward the message from.
187
193
  * @param to The identifier of the chat to forward the message to.
188
194
  * @param messageId The identifier of the message to forward.
195
+ * @method
189
196
  */
190
197
  forwardMessage(from: ChatID, to: ChatID, messageId: number, params?: ForwardMessagesParams): Promise<Message>;
191
198
  /**
192
199
  * Get information on the currently authorized user.
200
+ *
201
+ * @method
193
202
  */
194
203
  getMe(): Promise<import("../3_types.js").User>;
195
204
  private handleUpdate;
@@ -197,6 +206,7 @@ export declare class Client extends ClientAbstract {
197
206
  * Answer a callback query. Bot-only.
198
207
  *
199
208
  * @param id ID of the callback query to answer.
209
+ * @method
200
210
  */
201
211
  answerCallbackQuery(id: string, params?: AnswerCallbackQueryParams): Promise<void>;
202
212
  private usernameResolver;
@@ -208,6 +218,7 @@ export declare class Client extends ClientAbstract {
208
218
  * @param chatId The chat to send the poll to.
209
219
  * @param question The poll's question.
210
220
  * @param options The poll's options.
221
+ * @method
211
222
  */
212
223
  sendPoll(chatId: ChatID, question: string, options: [string, string, ...string[]], params?: SendPollParams): Promise<With<Message, "poll">>;
213
224
  /**
@@ -216,18 +227,21 @@ export declare class Client extends ClientAbstract {
216
227
  * @param chatId The chat to send the chat action to.
217
228
  * @param action The chat action.
218
229
  * @param messageThreadId The thread to send the chat action to.
230
+ * @method
219
231
  */
220
232
  sendChatAction(chatId: ChatID, action_: ChatAction, messageThreadId?: number): Promise<void>;
221
233
  /**
222
234
  * Upload a file.
223
235
  *
224
236
  * @param contents The contents of the file.
237
+ * @method
225
238
  */
226
239
  upload(contents: Uint8Array, params?: UploadParams): Promise<types.InputFile | types.InputFileBig>;
227
240
  /**
228
241
  * Set the bot's commands in the given scope and/or language. Bot-only.
229
242
  *
230
243
  * @param commands The commands to set.
244
+ * @method
231
245
  */
232
246
  setMyCommands(commands: BotCommand[], params?: SetMyCommandsParams): Promise<void>;
233
247
  /**
@@ -239,6 +253,7 @@ export declare class Client extends ClientAbstract {
239
253
  *
240
254
  * @param id The ID of the inline query to answer.
241
255
  * @param results The results to answer with.
256
+ * @method
242
257
  */
243
258
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
244
259
  private handle;
@@ -250,6 +265,8 @@ export declare class Client extends ClientAbstract {
250
265
  private setMyInfo;
251
266
  /**
252
267
  * Set the bot's description in the given language. Bot-only.
268
+ *
269
+ * @method
253
270
  */
254
271
  setMyDescription({ description, languageCode }: {
255
272
  description?: string;
@@ -257,6 +274,8 @@ export declare class Client extends ClientAbstract {
257
274
  }): Promise<void>;
258
275
  /**
259
276
  * Set the bot's name in the given language. Bot-only.
277
+ *
278
+ * @method
260
279
  */
261
280
  setMyName({ name, languageCode }: {
262
281
  name?: string;
@@ -264,6 +283,8 @@ export declare class Client extends ClientAbstract {
264
283
  }): Promise<void>;
265
284
  /**
266
285
  * Set the bot's short description in the given language. Bot-only.
286
+ *
287
+ * @method
267
288
  */
268
289
  setMyShortDescription({ shortDescription: about, languageCode }: {
269
290
  shortDescription?: string;
@@ -272,14 +293,21 @@ export declare class Client extends ClientAbstract {
272
293
  private getMyInfo;
273
294
  /**
274
295
  * Get the bot's description in the given language. Bot-only.
296
+ *
297
+ * @method
275
298
  */
276
299
  getMyDescription(languageCode?: string): Promise<string>;
277
300
  /**
278
301
  * Set the bot's name in the given language. Bot-only.
302
+ *
303
+ * @method
279
304
  */
280
305
  getMyName(languageCode?: string): Promise<string>;
281
306
  /**
282
307
  * Get the bot's short description in the given language. Bot-only.
308
+ *
309
+ * @method
283
310
  */
284
311
  getMyShortDescription(languageCode?: string): Promise<string>;
285
312
  }
313
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Client = exports.ConnectionError = exports.restartAuth = exports.getMessageWithReply = exports.handleMigrationError = exports.getStickerSetName = exports.getEntity = void 0;
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
- exports.getEntity = Symbol();
25
- exports.getStickerSetName = Symbol();
24
+ const getEntity = Symbol();
25
+ const getStickerSetName = Symbol();
26
26
  exports.handleMigrationError = Symbol();
27
- exports.getMessageWithReply = Symbol();
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
- [exports.getEntity](peer) {
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[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(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[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(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
  }
@@ -1245,6 +1245,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1245
1245
  *
1246
1246
  * @param chatId The chat to send the message to.
1247
1247
  * @param text The message's text.
1248
+ * @method
1248
1249
  */
1249
1250
  async sendMessage(chatId, text, params) {
1250
1251
  const [message, entities] = this.parseText(text, params);
@@ -1298,6 +1299,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1298
1299
  * @param chatId The chat where the message is.
1299
1300
  * @param messageId The ID of the message.
1300
1301
  * @param text The new text of the message.
1302
+ * @method
1301
1303
  */
1302
1304
  async editMessageText(chatId, messageId, text, params) {
1303
1305
  const [message, entities] = this.parseText(text, params);
@@ -1343,7 +1345,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1343
1345
  }
1344
1346
  const messages = new Array();
1345
1347
  for (const message_ of messages_) {
1346
- const message = await (0, _3_types_js_1.constructMessage)(message_, this[exports.getEntity].bind(this), null, this[exports.getStickerSetName].bind(this));
1348
+ const message = await (0, _3_types_js_1.constructMessage)(message_, this[getEntity].bind(this), null, this[getStickerSetName].bind(this));
1347
1349
  const isReplyToMessage = message_ instanceof _2_tl_js_1.types.Message && message_.replyTo instanceof _2_tl_js_1.types.MessageReplyHeader;
1348
1350
  messages.push({ message, isReplyToMessage });
1349
1351
  }
@@ -1354,11 +1356,12 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1354
1356
  *
1355
1357
  * @param chatId The identifier of the chat to retrieve the messages from.
1356
1358
  * @param messageIds The identifiers of the messages to retrieve.
1359
+ * @method
1357
1360
  */
1358
1361
  async getMessages(chatId_, messageIds) {
1359
1362
  return await this.getMessagesInner(chatId_, messageIds).then((v) => v.map((v) => v.message));
1360
1363
  }
1361
- async [exports.getMessageWithReply](chatId, messageId) {
1364
+ async [getMessageWithReply](chatId, messageId) {
1362
1365
  const messages = await this.getMessagesInner(chatId, [messageId]);
1363
1366
  return messages[0]?.message ?? null;
1364
1367
  }
@@ -1367,6 +1370,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1367
1370
  *
1368
1371
  * @param chatId The identifier of the chat to retrieve the message from.
1369
1372
  * @param messageId The identifier of the message to retrieve.
1373
+ * @method
1370
1374
  */
1371
1375
  async getMessage(chatId, messageId) {
1372
1376
  const messages = await this.getMessages(chatId, [messageId]);
@@ -1417,6 +1421,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1417
1421
  * Download a file.
1418
1422
  *
1419
1423
  * @param fileId The identifier of the file to download.
1424
+ * @method
1420
1425
  */
1421
1426
  async download(fileId, params) {
1422
1427
  const fileId_ = _3_types_js_1.FileID.decode(fileId);
@@ -1443,7 +1448,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1443
1448
  (0, _1_utilities_js_1.UNREACHABLE)();
1444
1449
  }
1445
1450
  }
1446
- async [exports.getStickerSetName](inputStickerSet, hash = 0) {
1451
+ async [getStickerSetName](inputStickerSet, hash = 0) {
1447
1452
  const maybeStickerSetName = await this.storage.getStickerSetName(inputStickerSet.id, inputStickerSet.accessHash);
1448
1453
  if (maybeStickerSetName != null && Date.now() - maybeStickerSetName[1].getTime() < _4_constants_js_1.STICKER_SET_NAME_TTL) {
1449
1454
  return maybeStickerSetName[0];
@@ -1461,6 +1466,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1461
1466
  * @param from The identifier of the chat to forward the messages from.
1462
1467
  * @param to The identifier of the chat to forward the messages to.
1463
1468
  * @param messageIds The identifiers of the messages to forward.
1469
+ * @method
1464
1470
  */
1465
1471
  async forwardMessages(from, to, messageIds, params) {
1466
1472
  const result = await this.invoke(new _2_tl_js_1.functions.MessagesForwardMessages({
@@ -1483,12 +1489,15 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1483
1489
  * @param from The identifier of the chat to forward the message from.
1484
1490
  * @param to The identifier of the chat to forward the message to.
1485
1491
  * @param messageId The identifier of the message to forward.
1492
+ * @method
1486
1493
  */
1487
1494
  async forwardMessage(from, to, messageId, params) {
1488
1495
  return await this.forwardMessages(from, to, [messageId], params).then((v) => v[0]);
1489
1496
  }
1490
1497
  /**
1491
1498
  * Get information on the currently authorized user.
1499
+ *
1500
+ * @method
1492
1501
  */
1493
1502
  async getMe() {
1494
1503
  const users = await this.invoke(new _2_tl_js_1.functions.UsersGetUsers({ id: [new _2_tl_js_1.types.InputUserSelf()] }));
@@ -1553,7 +1562,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1553
1562
  update instanceof _2_tl_js_1.types.UpdateEditMessage ||
1554
1563
  update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
1555
1564
  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[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this));
1565
+ const message = await (0, _3_types_js_1.constructMessage)(update.message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this));
1557
1566
  await this.handle({ [key]: message }, _0_utilities_js_1.resolve);
1558
1567
  }
1559
1568
  if (update instanceof _2_tl_js_1.types.UpdateDeleteMessages) {
@@ -1563,7 +1572,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1563
1572
  if (chatId) {
1564
1573
  const message = await this.storage.getMessage(chatId, messageId);
1565
1574
  if (message != null) {
1566
- deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
1575
+ deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
1567
1576
  }
1568
1577
  await this.storage.setMessage(chatId, messageId, null);
1569
1578
  }
@@ -1578,7 +1587,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1578
1587
  for (const messageId of update.messages) {
1579
1588
  const message = await this.storage.getMessage(chatId, messageId);
1580
1589
  if (message) {
1581
- deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
1590
+ deletedMessages.push(await (0, _3_types_js_1.constructMessage)(message, this[getEntity].bind(this), this.getMessage.bind(this), this[getStickerSetName].bind(this)));
1582
1591
  }
1583
1592
  await this.storage.setMessage(chatId, messageId, null);
1584
1593
  }
@@ -1587,16 +1596,17 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1587
1596
  }
1588
1597
  }
1589
1598
  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[exports.getEntity].bind(this), this[exports.getMessageWithReply].bind(this)) }, _0_utilities_js_1.resolve);
1599
+ 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
1600
  }
1592
1601
  else if (update instanceof _2_tl_js_1.types.UpdateBotInlineQuery) {
1593
- await this.handle({ inlineQuery: await (0, _3_types_js_1.constructInlineQuery)(update, this[exports.getEntity].bind(this)) }, _0_utilities_js_1.resolve);
1602
+ await this.handle({ inlineQuery: await (0, _3_types_js_1.constructInlineQuery)(update, this[getEntity].bind(this)) }, _0_utilities_js_1.resolve);
1594
1603
  }
1595
1604
  }
1596
1605
  /**
1597
1606
  * Answer a callback query. Bot-only.
1598
1607
  *
1599
1608
  * @param id ID of the callback query to answer.
1609
+ * @method
1600
1610
  */
1601
1611
  async answerCallbackQuery(id, params) {
1602
1612
  await this.assertBot("answerCallbackQuery");
@@ -1625,6 +1635,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1625
1635
  * @param chatId The chat to send the poll to.
1626
1636
  * @param question The poll's question.
1627
1637
  * @param options The poll's options.
1638
+ * @method
1628
1639
  */
1629
1640
  async sendPoll(chatId, question, options, params) {
1630
1641
  const peer = await this.getInputPeer(chatId);
@@ -1677,6 +1688,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1677
1688
  * @param chatId The chat to send the chat action to.
1678
1689
  * @param action The chat action.
1679
1690
  * @param messageThreadId The thread to send the chat action to.
1691
+ * @method
1680
1692
  */
1681
1693
  async sendChatAction(chatId, action_, messageThreadId) {
1682
1694
  let action;
@@ -1723,6 +1735,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1723
1735
  * Upload a file.
1724
1736
  *
1725
1737
  * @param contents The contents of the file.
1738
+ * @method
1726
1739
  */
1727
1740
  async upload(contents, params) {
1728
1741
  const isBig = contents.length > 1048576; // 10 MB
@@ -1813,6 +1826,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1813
1826
  * Set the bot's commands in the given scope and/or language. Bot-only.
1814
1827
  *
1815
1828
  * @param commands The commands to set.
1829
+ * @method
1816
1830
  */
1817
1831
  async setMyCommands(commands, params) {
1818
1832
  await this.invoke(new _2_tl_js_1.functions.BotsSetBotCommands({
@@ -1836,6 +1850,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1836
1850
  *
1837
1851
  * @param id The ID of the inline query to answer.
1838
1852
  * @param results The results to answer with.
1853
+ * @method
1839
1854
  */
1840
1855
  async answerInlineQuery(id, results, params) {
1841
1856
  await this.invoke(new _2_tl_js_1.functions.MessagesSetInlineBotResults({
@@ -1900,6 +1915,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1900
1915
  }
1901
1916
  /**
1902
1917
  * Set the bot's description in the given language. Bot-only.
1918
+ *
1919
+ * @method
1903
1920
  */
1904
1921
  async setMyDescription({ description, languageCode }) {
1905
1922
  await this.assertBot("setMyDescription");
@@ -1907,6 +1924,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1907
1924
  }
1908
1925
  /**
1909
1926
  * Set the bot's name in the given language. Bot-only.
1927
+ *
1928
+ * @method
1910
1929
  */
1911
1930
  async setMyName({ name, languageCode }) {
1912
1931
  await this.assertBot("setMyName");
@@ -1914,6 +1933,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1914
1933
  }
1915
1934
  /**
1916
1935
  * Set the bot's short description in the given language. Bot-only.
1936
+ *
1937
+ * @method
1917
1938
  */
1918
1939
  async setMyShortDescription({ shortDescription: about, languageCode }) {
1919
1940
  await this.assertBot("setMyShortDescription");
@@ -1924,6 +1945,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1924
1945
  }
1925
1946
  /**
1926
1947
  * Get the bot's description in the given language. Bot-only.
1948
+ *
1949
+ * @method
1927
1950
  */
1928
1951
  async getMyDescription(languageCode) {
1929
1952
  await this.assertBot("getMyDescription");
@@ -1931,6 +1954,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1931
1954
  }
1932
1955
  /**
1933
1956
  * Set the bot's name in the given language. Bot-only.
1957
+ *
1958
+ * @method
1934
1959
  */
1935
1960
  async getMyName(languageCode) {
1936
1961
  await this.assertBot("getMyName");
@@ -1938,6 +1963,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1938
1963
  }
1939
1964
  /**
1940
1965
  * Get the bot's short description in the given language. Bot-only.
1966
+ *
1967
+ * @method
1941
1968
  */
1942
1969
  async getMyShortDescription(languageCode) {
1943
1970
  await this.assertBot("getMyShortDescription");
@@ -71,12 +71,6 @@ export declare namespace Chat {
71
71
  }
72
72
  interface Channel extends ChannelBase {
73
73
  type: "channel";
74
- /** Title, for supergroups, channels and group chats */
75
- title: string;
76
- /** Username, for private chats, supergroups and channels if available */
77
- username?: string;
78
- /** Additional usernames */
79
- also?: string[];
80
74
  }
81
75
  interface Supergroup extends ChannelBase {
82
76
  type: "supergroup";