@mtkruto/node 0.0.989 → 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/3_client.js +12 -12
- 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/3_client.js +12 -12
- 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
|
@@ -246,13 +246,13 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
246
246
|
enumerable: true,
|
|
247
247
|
configurable: true,
|
|
248
248
|
writable: true,
|
|
249
|
-
value: new _0_queue_js_1.Queue()
|
|
249
|
+
value: new _0_queue_js_1.Queue("handleUpdate")
|
|
250
250
|
});
|
|
251
251
|
Object.defineProperty(this, "processUpdatesQueue", {
|
|
252
252
|
enumerable: true,
|
|
253
253
|
configurable: true,
|
|
254
254
|
writable: true,
|
|
255
|
-
value: new _0_queue_js_1.Queue()
|
|
255
|
+
value: new _0_queue_js_1.Queue("processUpdates")
|
|
256
256
|
});
|
|
257
257
|
Object.defineProperty(this, "handler", {
|
|
258
258
|
enumerable: true,
|
|
@@ -604,7 +604,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
604
604
|
body = new _3_tl_reader_js_1.TLReader((0, deps_js_1.gunzip)(body.packedData)).readObject();
|
|
605
605
|
}
|
|
606
606
|
dRecv("received %s", body.constructor.name);
|
|
607
|
-
if (body instanceof types.
|
|
607
|
+
if (body instanceof types._TypeUpdates || body instanceof types._TypeUpdate) {
|
|
608
608
|
this.processUpdatesQueue.add(() => this.processUpdates(body));
|
|
609
609
|
}
|
|
610
610
|
else if (message.body instanceof _5_rpc_result_js_1.RPCResult) {
|
|
@@ -631,7 +631,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
631
631
|
this.promises.delete(messageId);
|
|
632
632
|
}
|
|
633
633
|
};
|
|
634
|
-
if (result instanceof types.
|
|
634
|
+
if (result instanceof types._TypeUpdates || result instanceof types._TypeUpdate) {
|
|
635
635
|
this.processUpdatesQueue.add(async () => {
|
|
636
636
|
await this.processUpdates(result);
|
|
637
637
|
resolvePromise();
|
|
@@ -735,7 +735,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
735
735
|
await this.storage.updateUsernames("channel", chat.id, [chat.username]);
|
|
736
736
|
}
|
|
737
737
|
if (chat.usernames) {
|
|
738
|
-
await this.storage.updateUsernames("channel", chat.id, chat.usernames.map((v) => v
|
|
738
|
+
await this.storage.updateUsernames("channel", chat.id, chat.usernames.map((v) => v.username));
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
else if (chat instanceof types.Chat) {
|
|
@@ -752,7 +752,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
752
752
|
await this.storage.updateUsernames("user", user.id, [user.username]);
|
|
753
753
|
}
|
|
754
754
|
if (user.usernames) {
|
|
755
|
-
await this.storage.updateUsernames("user", user.id, user.usernames.map((v) => v
|
|
755
|
+
await this.storage.updateUsernames("user", user.id, user.usernames.map((v) => v.username));
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
758
|
}
|
|
@@ -806,7 +806,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
806
806
|
await this.recoverUpdateGap("updatesTooLong");
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
|
-
else if (updates_ instanceof types.
|
|
809
|
+
else if (updates_ instanceof types._TypeUpdate) {
|
|
810
810
|
updates = [updates_];
|
|
811
811
|
}
|
|
812
812
|
else {
|
|
@@ -885,7 +885,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
885
885
|
await this.recoverChannelUpdateGap(update.channelId, "updateChannelTooLong");
|
|
886
886
|
}
|
|
887
887
|
else if (update instanceof types.UpdateUserName) {
|
|
888
|
-
await this.storage.updateUsernames("user", update.userId, update.usernames.map((v) => v
|
|
888
|
+
await this.storage.updateUsernames("user", update.userId, update.usernames.map((v) => v.username));
|
|
889
889
|
}
|
|
890
890
|
else if (update instanceof types.UpdatePtsChanged) {
|
|
891
891
|
await this.fetchState("updatePtsChanged");
|
|
@@ -897,7 +897,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
899
|
/// If there were any Update, they will be passed to the update handling queue.
|
|
900
|
-
if (update instanceof types.
|
|
900
|
+
if (update instanceof types._TypeUpdate) {
|
|
901
901
|
updatesToHandle.push(update);
|
|
902
902
|
}
|
|
903
903
|
}
|
|
@@ -949,12 +949,12 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
949
949
|
await this.processUpdates(update, true);
|
|
950
950
|
}
|
|
951
951
|
if (difference instanceof types.UpdatesDifference) {
|
|
952
|
-
await this.storage.setState(difference.state
|
|
952
|
+
await this.storage.setState(difference.state);
|
|
953
953
|
dGap("recovered from update gap");
|
|
954
954
|
break;
|
|
955
955
|
}
|
|
956
956
|
else if (difference instanceof types.UpdatesDifferenceSlice) {
|
|
957
|
-
state = difference.intermediateState
|
|
957
|
+
state = difference.intermediateState;
|
|
958
958
|
}
|
|
959
959
|
else {
|
|
960
960
|
(0, _0_control_js_1.UNREACHABLE)();
|
|
@@ -1407,7 +1407,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
else {
|
|
1409
1409
|
const stickerSet = await this.invoke(new functions.MessagesGetStickerSet({ stickerset: inputStickerSet, hash }));
|
|
1410
|
-
const name = stickerSet[_1_tl_object_js_1.as](types.MessagesStickerSet).set
|
|
1410
|
+
const name = stickerSet[_1_tl_object_js_1.as](types.MessagesStickerSet).set.shortName;
|
|
1411
1411
|
await this.storage.updateStickerSetName(inputStickerSet.id, inputStickerSet.accessHash, name);
|
|
1412
1412
|
return name;
|
|
1413
1413
|
}
|
package/script/constants.d.ts
CHANGED
|
@@ -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.0.
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.0.990";
|
|
9
9
|
export declare const DEVICE_MODEL: string;
|
|
10
10
|
export declare const LANG_CODE: string;
|
|
11
11
|
export declare const LANG_PACK = "";
|
package/script/constants.js
CHANGED
|
@@ -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.0.
|
|
83
|
+
exports.APP_VERSION = "MTKruto 0.0.990";
|
|
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];
|