@mtkruto/node 0.0.988 → 0.0.990
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/client/1_client_abstract.d.ts +6 -0
- package/esm/client/2_client_plain.d.ts +1 -1
- package/esm/client/3_client.d.ts +17 -15
- package/esm/client/3_client.js +75 -38
- package/esm/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/tl/2_types.d.ts +2055 -1617
- package/esm/tl/2_types.js +3447 -3447
- package/esm/tl/3_functions.d.ts +154 -154
- package/esm/tl/3_functions.js +988 -988
- package/esm/types/0_poll_option.d.ts +8 -0
- package/esm/types/0_poll_option.js +6 -0
- package/esm/types/1_chat.js +3 -4
- package/esm/types/1_keyboard_button.js +4 -5
- package/esm/types/1_photo.js +0 -2
- package/esm/types/1_poll.d.ts +32 -0
- package/esm/types/1_poll.js +23 -0
- package/esm/types/1_sticker.js +1 -1
- package/esm/types/1_user.js +1 -2
- package/esm/types/2_game.js +2 -2
- package/esm/types/2_inline_keyboard_markup.js +1 -2
- package/esm/types/2_reply_keyboard_markup.js +1 -2
- package/esm/types/3_message.d.ts +2 -0
- package/esm/types/3_message.js +4 -0
- package/esm/utilities/0_queue.d.ts +2 -0
- package/esm/utilities/0_queue.js +14 -2
- package/esm/utilities/1_misc.js +1 -1
- package/package.json +1 -1
- package/script/client/1_client_abstract.d.ts +6 -0
- package/script/client/2_client_plain.d.ts +1 -1
- package/script/client/3_client.d.ts +17 -15
- package/script/client/3_client.js +75 -38
- package/script/constants.d.ts +1 -1
- package/script/constants.js +1 -1
- package/script/tl/2_types.d.ts +2055 -1617
- package/script/tl/2_types.js +3894 -3894
- package/script/tl/3_functions.d.ts +154 -154
- package/script/tl/3_functions.js +988 -988
- package/script/types/0_poll_option.d.ts +8 -0
- package/script/types/0_poll_option.js +10 -0
- package/script/types/1_chat.js +3 -4
- package/script/types/1_keyboard_button.js +4 -5
- package/script/types/1_photo.js +0 -2
- package/script/types/1_poll.d.ts +32 -0
- package/script/types/1_poll.js +27 -0
- package/script/types/1_sticker.js +1 -1
- package/script/types/1_user.js +1 -2
- package/script/types/2_game.js +2 -2
- package/script/types/2_inline_keyboard_markup.js +1 -2
- package/script/types/2_reply_keyboard_markup.js +1 -2
- package/script/types/3_message.d.ts +2 -0
- package/script/types/3_message.js +4 -0
- package/script/utilities/0_queue.d.ts +2 -0
- package/script/utilities/0_queue.js +14 -2
- package/script/utilities/1_misc.js +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
export interface PollOption {
|
|
3
|
+
/** Option text, 1-100 characters */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Number of users that voted for this option */
|
|
6
|
+
voterCount: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function constructPollOption(option: types.PollAnswer, results: Array<types.TypePollAnswerVoters>): PollOption;
|
package/esm/types/1_chat.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ZERO_CHANNEL_ID } from "../constants.js";
|
|
2
2
|
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
3
3
|
import { cleanObject } from "../utilities/0_object.js";
|
|
4
|
-
import { as } from "../tl/1_tl_object.js";
|
|
5
4
|
import * as types from "../tl/2_types.js";
|
|
6
5
|
import { getIdColor } from "./!0_id_color.js";
|
|
7
6
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
@@ -29,7 +28,7 @@ export function constructChat(chat) {
|
|
|
29
28
|
};
|
|
30
29
|
if (chat_.isBot) {
|
|
31
30
|
chat_.isRestricted = chat.restricted || false;
|
|
32
|
-
chat_.restrictionReason = chat.restrictionReason
|
|
31
|
+
chat_.restrictionReason = chat.restrictionReason;
|
|
33
32
|
}
|
|
34
33
|
if (chat.photo instanceof types.UserProfilePhoto) {
|
|
35
34
|
chat_.photo = constructChatPhoto(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
@@ -81,9 +80,9 @@ export function constructChat(chat) {
|
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
chat_.username = chat.username;
|
|
84
|
-
chat_.also = chat.usernames?.map((v) => v
|
|
83
|
+
chat_.also = chat.usernames?.map((v) => v.username);
|
|
85
84
|
if (chat_.isRestricted) {
|
|
86
|
-
chat_.restrictionReason = chat.restrictionReason
|
|
85
|
+
chat_.restrictionReason = chat.restrictionReason;
|
|
87
86
|
}
|
|
88
87
|
if (chat.photo instanceof types.ChatPhoto) {
|
|
89
88
|
chat_.photo = constructChatPhoto(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UNREACHABLE } from "../utilities/0_control.js";
|
|
2
|
-
import { as } from "../tl/1_tl_object.js";
|
|
3
2
|
import * as types from "../tl/2_types.js";
|
|
4
3
|
import { chatAdministratorRightsToTlObject, constructChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
5
4
|
export function constructKeyboardButton(button_) {
|
|
@@ -30,10 +29,10 @@ export function constructKeyboardButton(button_) {
|
|
|
30
29
|
},
|
|
31
30
|
};
|
|
32
31
|
if (button_.peerType.botAdminRights) {
|
|
33
|
-
button.requestChat.botAdministratorRights = constructChatAdministratorRights(button_.peerType.botAdminRights
|
|
32
|
+
button.requestChat.botAdministratorRights = constructChatAdministratorRights(button_.peerType.botAdminRights);
|
|
34
33
|
}
|
|
35
34
|
if (button_.peerType.userAdminRights) {
|
|
36
|
-
button.requestChat.userAdministratorRights = constructChatAdministratorRights(button_.peerType.userAdminRights
|
|
35
|
+
button.requestChat.userAdministratorRights = constructChatAdministratorRights(button_.peerType.userAdminRights);
|
|
37
36
|
}
|
|
38
37
|
return button;
|
|
39
38
|
}
|
|
@@ -48,10 +47,10 @@ export function constructKeyboardButton(button_) {
|
|
|
48
47
|
},
|
|
49
48
|
};
|
|
50
49
|
if (button_.peerType.botAdminRights) {
|
|
51
|
-
button.requestChat.botAdministratorRights = constructChatAdministratorRights(button_.peerType.botAdminRights
|
|
50
|
+
button.requestChat.botAdministratorRights = constructChatAdministratorRights(button_.peerType.botAdminRights);
|
|
52
51
|
}
|
|
53
52
|
if (button_.peerType.userAdminRights) {
|
|
54
|
-
button.requestChat.userAdministratorRights = constructChatAdministratorRights(button_.peerType.userAdminRights
|
|
53
|
+
button.requestChat.userAdministratorRights = constructChatAdministratorRights(button_.peerType.userAdminRights);
|
|
55
54
|
}
|
|
56
55
|
return button;
|
|
57
56
|
}
|
package/esm/types/1_photo.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { as } from "../tl/1_tl_object.js";
|
|
2
1
|
import * as types from "../tl/2_types.js";
|
|
3
2
|
import { FileID, FileType, FileUniqueID, FileUniqueType, ThumbnailSource } from "./!0_file_id.js";
|
|
4
3
|
import { constructThumbnail } from "./0_thumbnail.js";
|
|
@@ -13,7 +12,6 @@ export function constructPhoto(photo) {
|
|
|
13
12
|
}
|
|
14
13
|
})
|
|
15
14
|
.filter((v) => v instanceof types.PhotoSize)
|
|
16
|
-
.map((v) => v[as](types.PhotoSize))
|
|
17
15
|
.sort((a, b) => a.size - b.size);
|
|
18
16
|
const largest = sizes.slice(-1)[0];
|
|
19
17
|
const { dcId, id: mediaId, accessHash, fileReference } = photo;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
import { MessageEntity } from "./0_message_entity.js";
|
|
3
|
+
import { PollOption } from "./0_poll_option.js";
|
|
4
|
+
export interface Poll {
|
|
5
|
+
/** Unique poll identifier */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Poll question, 1-300 characters */
|
|
8
|
+
question: string;
|
|
9
|
+
/** List of poll options */
|
|
10
|
+
options: PollOption[];
|
|
11
|
+
/** Total number of users that voted in the poll */
|
|
12
|
+
totalVoterCount: number;
|
|
13
|
+
/** True, if the poll is closed */
|
|
14
|
+
isClosed: boolean;
|
|
15
|
+
/** True, if the poll is anonymous */
|
|
16
|
+
isAnonymous: boolean;
|
|
17
|
+
/** Poll type, currently can be “regular” or “quiz” */
|
|
18
|
+
type: "regular" | "quiz";
|
|
19
|
+
/** True, if the poll allows multiple answers */
|
|
20
|
+
allowMultipleAnswers?: boolean;
|
|
21
|
+
/** Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */
|
|
22
|
+
correctOptionId?: number;
|
|
23
|
+
/** Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
|
|
24
|
+
explanation?: string;
|
|
25
|
+
/** Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
|
|
26
|
+
explanationEntities?: MessageEntity[];
|
|
27
|
+
/** Optional. Amount of time in seconds the poll will be active after creation */
|
|
28
|
+
openPeriod?: number;
|
|
29
|
+
/** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */
|
|
30
|
+
closeDate?: Date;
|
|
31
|
+
}
|
|
32
|
+
export declare function constructPoll(media_: types.MessageMediaPoll): Poll;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cleanObject } from "../utilities/0_object.js";
|
|
2
|
+
import { constructMessageEntity } from "./0_message_entity.js";
|
|
3
|
+
import { constructPollOption } from "./0_poll_option.js";
|
|
4
|
+
export function constructPoll(media_) {
|
|
5
|
+
const poll = media_.poll;
|
|
6
|
+
const correctOption = media_.results.results?.find((v) => v.correct)?.option;
|
|
7
|
+
const correctOptionId = correctOption !== undefined ? poll.answers.findIndex((v) => v.option.every((v, i) => correctOption[i] == v)) : undefined;
|
|
8
|
+
return cleanObject({
|
|
9
|
+
id: String(poll.id),
|
|
10
|
+
question: poll.question,
|
|
11
|
+
options: poll.answers.map((v) => constructPollOption(v, media_.results.results ?? [])),
|
|
12
|
+
totalVoterCount: media_.results.totalVoters ?? 0,
|
|
13
|
+
isClosed: poll.closed || false,
|
|
14
|
+
isAnonymous: !poll.publicVoters,
|
|
15
|
+
type: poll.quiz ? "quiz" : "regular",
|
|
16
|
+
allowMultipleAnswers: poll.quiz ? undefined : poll.multipleChoice || false,
|
|
17
|
+
correctOptionId,
|
|
18
|
+
explanation: media_.results.solution,
|
|
19
|
+
explanationEntities: media_.results.solutionEntities?.map(constructMessageEntity).filter((v) => v != null),
|
|
20
|
+
openPeriod: poll.closePeriod,
|
|
21
|
+
closeDate: poll.closeDate ? new Date(poll.closeDate * 1000) : undefined,
|
|
22
|
+
});
|
|
23
|
+
}
|
package/esm/types/1_sticker.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function constructSticker(document, fileId, fileUniqueId, getSticke
|
|
|
20
20
|
emoji: stickerAttribute.alt || undefined,
|
|
21
21
|
setName,
|
|
22
22
|
premiumAnimation: undefined,
|
|
23
|
-
maskPosition: stickerAttribute.maskCoords ? constructMaskPosition(stickerAttribute.maskCoords
|
|
23
|
+
maskPosition: stickerAttribute.maskCoords ? constructMaskPosition(stickerAttribute.maskCoords) : undefined,
|
|
24
24
|
customEmojiId: undefined,
|
|
25
25
|
needsRepainting: undefined,
|
|
26
26
|
fileSize: Number(document.size),
|
package/esm/types/1_user.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cleanObject } from "../utilities/0_object.js";
|
|
2
|
-
import { as } from "../tl/1_tl_object.js";
|
|
3
2
|
import * as types from "../tl/2_types.js";
|
|
4
3
|
import { getIdColor } from "./!0_id_color.js";
|
|
5
4
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
@@ -12,7 +11,7 @@ export function constructUser(user_) {
|
|
|
12
11
|
firstName: user_.firstName || "",
|
|
13
12
|
lastName: user_.lastName,
|
|
14
13
|
username: user_.username,
|
|
15
|
-
also: user_.usernames?.map((v) => v
|
|
14
|
+
also: user_.usernames?.map((v) => v.username),
|
|
16
15
|
languageCode: user_.langCode,
|
|
17
16
|
isScam: user_.scam || false,
|
|
18
17
|
isFake: user_.fake || false,
|
package/esm/types/2_game.js
CHANGED
|
@@ -5,11 +5,11 @@ import { FileID, FileType, FileUniqueID, FileUniqueType } from "./!0_file_id.js"
|
|
|
5
5
|
import { constructAnimation } from "./1_animation.js";
|
|
6
6
|
import { constructPhoto } from "./1_photo.js";
|
|
7
7
|
export function constructGame(media_) {
|
|
8
|
-
const game_ = media_.game
|
|
8
|
+
const game_ = media_.game;
|
|
9
9
|
const document_ = game_.document ? game_.document[as](types.Document) : undefined;
|
|
10
10
|
return cleanObject({
|
|
11
11
|
title: game_.title,
|
|
12
|
-
description:
|
|
12
|
+
description: media_.game.description,
|
|
13
13
|
photo: constructPhoto(game_.photo[as](types.Photo)),
|
|
14
14
|
animation: document_
|
|
15
15
|
? constructAnimation(document_, document_.attributes.find((v) => v instanceof types.DocumentAttributeVideo), document_.attributes.find((v) => v instanceof types.DocumentAttributeFilename), new FileID(null, null, FileType.Animation, document_.dcId, {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { as } from "../tl/1_tl_object.js";
|
|
2
1
|
import * as types from "../tl/2_types.js";
|
|
3
2
|
import { constructInlineKeyboardButton, inlineKeyboardButtonToTlObject } from "./1_inline_keyboard_button.js";
|
|
4
3
|
export function constructInlineKeyboardMarkup(keyboard_) {
|
|
5
4
|
const rows = new Array();
|
|
6
|
-
for (const row_ of keyboard_.rows
|
|
5
|
+
for (const row_ of keyboard_.rows) {
|
|
7
6
|
const row = new Array();
|
|
8
7
|
for (const button_ of row_.buttons) {
|
|
9
8
|
row.push(constructInlineKeyboardButton(button_));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { as } from "../tl/1_tl_object.js";
|
|
2
1
|
import * as types from "../tl/2_types.js";
|
|
3
2
|
import { constructKeyboardButton, keyboardButtonToTlObject } from "./1_keyboard_button.js";
|
|
4
3
|
export function constructReplyKeyboardMarkup(keyboard_) {
|
|
5
4
|
const rows = new Array();
|
|
6
|
-
for (const row_ of keyboard_.rows
|
|
5
|
+
for (const row_ of keyboard_.rows) {
|
|
7
6
|
const row = new Array();
|
|
8
7
|
for (const button_ of row_.buttons) {
|
|
9
8
|
row.push(constructKeyboardButton(button_));
|
package/esm/types/3_message.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { Voice } from "./0_voice.js";
|
|
|
18
18
|
import { Dice } from "./0_dice.js";
|
|
19
19
|
import { Contact } from "./0_contact.js";
|
|
20
20
|
import { Game } from "./2_game.js";
|
|
21
|
+
import { Poll } from "./1_poll.js";
|
|
21
22
|
import { Venue } from "./0_venue.js";
|
|
22
23
|
import { Location } from "./0_location.js";
|
|
23
24
|
/** This object represents a message. */
|
|
@@ -100,6 +101,7 @@ export interface Message {
|
|
|
100
101
|
contact?: Contact;
|
|
101
102
|
/** Message is a game, information about the game. */
|
|
102
103
|
game?: Game;
|
|
104
|
+
poll?: Poll;
|
|
103
105
|
/** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */
|
|
104
106
|
venue?: Venue;
|
|
105
107
|
/** Message is a shared location, information about the location */
|
package/esm/types/3_message.js
CHANGED
|
@@ -22,6 +22,7 @@ import { constructDice } from "./0_dice.js";
|
|
|
22
22
|
import { FileID, FileType, FileUniqueID, FileUniqueType } from "./!0_file_id.js";
|
|
23
23
|
import { constructContact } from "./0_contact.js";
|
|
24
24
|
import { constructGame } from "./2_game.js";
|
|
25
|
+
import { constructPoll } from "./1_poll.js";
|
|
25
26
|
import { constructVenue } from "./0_venue.js";
|
|
26
27
|
import { constructLocation } from "./0_location.js";
|
|
27
28
|
import { ZERO_CHANNEL_ID } from "../constants.js";
|
|
@@ -376,6 +377,9 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
376
377
|
else if (message_.media instanceof types.MessageMediaGame) {
|
|
377
378
|
message.game = constructGame(message_.media);
|
|
378
379
|
}
|
|
380
|
+
else if (message_.media instanceof types.MessageMediaPoll) {
|
|
381
|
+
message.poll = constructPoll(message_.media);
|
|
382
|
+
}
|
|
379
383
|
else if (message_.media instanceof types.MessageMediaVenue) {
|
|
380
384
|
message.venue = constructVenue(message_.media);
|
|
381
385
|
}
|
package/esm/utilities/0_queue.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { debug } from "../deps.js";
|
|
1
2
|
export class Queue {
|
|
2
|
-
constructor() {
|
|
3
|
+
constructor(name) {
|
|
4
|
+
Object.defineProperty(this, "d", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: void 0
|
|
9
|
+
});
|
|
3
10
|
Object.defineProperty(this, "functions", {
|
|
4
11
|
enumerable: true,
|
|
5
12
|
configurable: true,
|
|
@@ -12,6 +19,7 @@ export class Queue {
|
|
|
12
19
|
writable: true,
|
|
13
20
|
value: false
|
|
14
21
|
});
|
|
22
|
+
this.d = debug(`q/${name}`);
|
|
15
23
|
}
|
|
16
24
|
add(fn) {
|
|
17
25
|
this.functions.push(fn);
|
|
@@ -26,7 +34,11 @@ export class Queue {
|
|
|
26
34
|
}
|
|
27
35
|
const fn = this.functions.shift();
|
|
28
36
|
if (fn !== undefined) {
|
|
29
|
-
fn()
|
|
37
|
+
fn()
|
|
38
|
+
.catch((err) => {
|
|
39
|
+
this.d("%o", err);
|
|
40
|
+
})
|
|
41
|
+
.finally(() => {
|
|
30
42
|
this.busy = false;
|
|
31
43
|
this.check();
|
|
32
44
|
});
|
package/esm/utilities/1_misc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
2
|
import { DC, TransportProvider } from "../transport/2_transport_provider.js";
|
|
3
3
|
export interface ClientAbstractParams {
|
|
4
|
+
/**
|
|
5
|
+
* The first DC to connect to. This is commonly used to decide whether to connect to test or production servers. It is not necessarily the DC that the client will directly connect to or is currently connected to. Defaults to the default initial DC.
|
|
6
|
+
*/
|
|
4
7
|
initialDc?: DC;
|
|
5
8
|
/**
|
|
6
9
|
* The transport provider to use. Defaults to `webSocketTransportProvider` with its default options.
|
|
7
10
|
*/
|
|
8
11
|
transportProvider?: TransportProvider;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the connection is with a CDN server. Defaults to false.
|
|
14
|
+
*/
|
|
9
15
|
cdn?: boolean;
|
|
10
16
|
}
|
|
11
17
|
export declare abstract class ClientAbstract {
|
|
@@ -3,7 +3,7 @@ import { Function } from "../tl/3_functions.js";
|
|
|
3
3
|
import { ClientAbstract, ClientAbstractParams } from "./1_client_abstract.js";
|
|
4
4
|
export interface ClientPlainParams extends ClientAbstractParams {
|
|
5
5
|
/**
|
|
6
|
-
* MTProto public keys to use in the `[keyId, [key, exponent]][]` format. Don't set this unless you know what you are doing.
|
|
6
|
+
* MTProto public keys to use in the `[keyId, [key, exponent]][]` format. Don't set this unless you know what you are doing. Defaults to Telegram servers' public keys.
|
|
7
7
|
*/
|
|
8
8
|
publicKeys?: PublicKeys;
|
|
9
9
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
+
import { DC } from "../transport/2_transport_provider.js";
|
|
2
3
|
import * as types from "../tl/2_types.js";
|
|
3
|
-
import * as functions from "../tl/3_functions.js";
|
|
4
4
|
import { ReadObject } from "../tl/3_tl_reader.js";
|
|
5
|
-
import
|
|
6
|
-
import { DC } from "../transport/2_transport_provider.js";
|
|
7
|
-
import { MessageEntity } from "../types/0_message_entity.js";
|
|
5
|
+
import * as functions from "../tl/3_functions.js";
|
|
8
6
|
import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
|
|
7
|
+
import { MessageEntity } from "../types/0_message_entity.js";
|
|
9
8
|
import { ForceReply } from "../types/0_force_reply.js";
|
|
10
|
-
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
11
9
|
import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
|
|
10
|
+
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
12
11
|
import { Message } from "../types/3_message.js";
|
|
13
|
-
import {
|
|
12
|
+
import { Storage } from "../storage/0_storage.js";
|
|
14
13
|
import { ClientPlainParams } from "./2_client_plain.js";
|
|
14
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
15
15
|
export declare const getEntity: unique symbol;
|
|
16
16
|
export declare const getStickerSetName: unique symbol;
|
|
17
17
|
export declare const handleMigrationError: unique symbol;
|
|
@@ -27,35 +27,35 @@ export interface AuthorizeUserParams<S = string> {
|
|
|
27
27
|
}
|
|
28
28
|
export interface ClientParams extends ClientPlainParams {
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* A parse mode to use when the `parseMode` parameter is not specified when sending or editing messages. Defauls to `ParseMode.None`.
|
|
31
31
|
*/
|
|
32
32
|
parseMode?: ParseMode;
|
|
33
33
|
/**
|
|
34
|
-
* The app_version parameter to be passed to initConnection when calling `authorize`.
|
|
34
|
+
* The app_version parameter to be passed to initConnection when calling `authorize`. It is recommended that this parameter is changed if users are authorized. Defaults to "MTKruto" followed by this version of MTKruto.
|
|
35
35
|
*/
|
|
36
36
|
appVersion?: string;
|
|
37
37
|
/**
|
|
38
|
-
* The device_version parameter to be passed to initConnection when calling `authorize`.
|
|
38
|
+
* The device_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
|
|
39
39
|
*/
|
|
40
40
|
deviceModel?: string;
|
|
41
41
|
/**
|
|
42
|
-
* The lang_code parameter to be passed to initConnection when calling `authorize`.
|
|
42
|
+
* The lang_code parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
|
|
43
43
|
*/
|
|
44
44
|
langCode?: string;
|
|
45
45
|
/**
|
|
46
|
-
* The lang_pack parameter to be passed to initConnection when calling `authorize`.
|
|
46
|
+
* The lang_pack parameter to be passed to initConnection when calling `authorize`. Defaults to an empty string.
|
|
47
47
|
*/
|
|
48
48
|
langPack?: string;
|
|
49
49
|
/**
|
|
50
|
-
* The system_lang_cde parameter to be passed to initConnection when calling `authorize`.
|
|
50
|
+
* The system_lang_cde parameter to be passed to initConnection when calling `authorize`. Defaults to the runtime's language or `"en"`.
|
|
51
51
|
*/
|
|
52
52
|
systemLangCode?: string;
|
|
53
53
|
/**
|
|
54
|
-
* The system_version parameter to be passed to initConnection when calling `authorize`.
|
|
54
|
+
* The system_version parameter to be passed to initConnection when calling `authorize`. The default varies by the current runtime.
|
|
55
55
|
*/
|
|
56
56
|
systemVersion?: string;
|
|
57
57
|
/**
|
|
58
|
-
* Whether to automatically call `start` with no parameters in the first `invoke` call.
|
|
58
|
+
* Whether to automatically call `start` with no parameters in the first `invoke` call. Defaults to `true`.
|
|
59
59
|
*/
|
|
60
60
|
autoStart?: boolean;
|
|
61
61
|
}
|
|
@@ -171,6 +171,7 @@ export declare class Client extends ClientAbstract {
|
|
|
171
171
|
*/
|
|
172
172
|
constructor(storage?: Storage, apiId?: number | null, apiHash?: string | null, params?: ClientParams);
|
|
173
173
|
private propagateConnectionState;
|
|
174
|
+
private lastPropagatedConnectionState;
|
|
174
175
|
protected stateChangeHandler: (connected: boolean) => void;
|
|
175
176
|
private storageInited;
|
|
176
177
|
/**
|
|
@@ -308,7 +309,7 @@ export declare class Client extends ClientAbstract {
|
|
|
308
309
|
private handleUpdate;
|
|
309
310
|
handler: Handler;
|
|
310
311
|
use(middleware: Handler): void;
|
|
311
|
-
on<U extends keyof Update, K extends keyof Update[U]>(filter: Update[U] extends string ? U : U | [U, ...K[]], handler: Handler<Pick<{
|
|
312
|
+
on<U extends keyof Update, K extends keyof Update[U]>(filter: Update[U] extends string ? U : Update[U] extends Array<any> ? U : U | [U, ...K[]], handler: Handler<Pick<{
|
|
312
313
|
[P in U]: With<Update[U], K>;
|
|
313
314
|
}, U>>): void;
|
|
314
315
|
}
|
|
@@ -318,6 +319,7 @@ export interface Update {
|
|
|
318
319
|
message: Message;
|
|
319
320
|
editedMessage: Message;
|
|
320
321
|
connectionState: ConnectionState;
|
|
322
|
+
deletedMessages: [Message, ...Message[]];
|
|
321
323
|
}
|
|
322
324
|
export interface Handler<U extends Partial<Update> = Partial<Update>> {
|
|
323
325
|
(update: U, next: () => Promise<void>): MaybePromise<void>;
|