@mtkruto/browser 0.134.0 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/3_types.d.ts +1 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +1 -0
- package/esm/client/0_params.d.ts +24 -2
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/1_client_generic.d.ts +11 -3
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +13 -9
- package/esm/client/4_gift_manager.d.ts +3 -2
- package/esm/client/4_gift_manager.d.ts.map +1 -1
- package/esm/client/4_gift_manager.js +9 -0
- package/esm/client/4_poll_manager.js +1 -1
- package/esm/client/6_client.d.ts +11 -3
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +11 -1
- package/esm/client/6_client_dispatcher.d.ts +11 -3
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +11 -1
- package/esm/tl/1_telegram_api.d.ts +1616 -10
- package/esm/tl/1_telegram_api.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.js +333 -48
- package/esm/types/0_premium_subscription_duration.d.ts +21 -0
- package/esm/types/0_premium_subscription_duration.d.ts.map +1 -0
- package/esm/types/0_premium_subscription_duration.js +20 -0
- package/esm/types/3_poll_option.d.ts +1 -1
- package/esm/types/3_poll_option.d.ts.map +1 -1
- package/esm/types/3_poll_option.js +2 -1
- package/esm/types/4_poll.d.ts +3 -3
- package/esm/types/4_poll.d.ts.map +1 -1
- package/esm/types/4_poll.js +5 -3
- package/package.json +1 -1
- package/script/3_types.d.ts +1 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +1 -0
- package/script/client/0_params.d.ts +24 -2
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/1_client_generic.d.ts +11 -3
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +13 -9
- package/script/client/4_gift_manager.d.ts +3 -2
- package/script/client/4_gift_manager.d.ts.map +1 -1
- package/script/client/4_gift_manager.js +9 -0
- package/script/client/4_poll_manager.js +1 -1
- package/script/client/6_client.d.ts +11 -3
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +11 -1
- package/script/client/6_client_dispatcher.d.ts +11 -3
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +11 -1
- package/script/tl/1_telegram_api.d.ts +1616 -10
- package/script/tl/1_telegram_api.d.ts.map +1 -1
- package/script/tl/1_telegram_api.js +333 -48
- package/script/types/0_premium_subscription_duration.d.ts +21 -0
- package/script/types/0_premium_subscription_duration.d.ts.map +1 -0
- package/script/types/0_premium_subscription_duration.js +21 -0
- package/script/types/3_poll_option.d.ts +1 -1
- package/script/types/3_poll_option.d.ts.map +1 -1
- package/script/types/3_poll_option.js +2 -1
- package/script/types/4_poll.d.ts +3 -3
- package/script/types/4_poll.d.ts.map +1 -1
- package/script/types/4_poll.js +5 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export type PremiumSubscriptionDuration = 3 | 6 | 12;
|
|
21
|
+
//# sourceMappingURL=0_premium_subscription_duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_premium_subscription_duration.d.ts","sourceRoot":"","sources":["../../src/types/0_premium_subscription_duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2026 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import
|
|
20
|
+
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type MessageEntity } from "./2_message_entity.js";
|
|
22
22
|
/** A poll option. */
|
|
23
23
|
export interface PollOption {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_poll_option.d.ts","sourceRoot":"","sources":["../../src/types/3_poll_option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"3_poll_option.d.ts","sourceRoot":"","sources":["../../src/types/3_poll_option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEnF,qBAAqB;AACrB,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAQ5G"}
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.constructPollOption = constructPollOption;
|
|
23
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
23
24
|
const _2_message_entity_js_1 = require("./2_message_entity.js");
|
|
24
25
|
function constructPollOption(option, results) {
|
|
25
|
-
const result = results.find((v) => v.option.every((v, i) => option.option[i] === v));
|
|
26
|
+
const result = results.find((v) => v.option.every((v, i) => _2_tl_js_1.Api.as("pollAnswer", option).option[i] === v));
|
|
26
27
|
return {
|
|
27
28
|
text: option.text.text,
|
|
28
29
|
entities: option.text.entities?.map(_2_message_entity_js_1.constructMessageEntity).filter((v) => v !== null),
|
package/script/types/4_poll.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import
|
|
20
|
+
import { Api } from "../2_tl.js";
|
|
21
21
|
import { type MessageEntity } from "./2_message_entity.js";
|
|
22
22
|
import { type PollOption } from "./3_poll_option.js";
|
|
23
23
|
/** A poll. */
|
|
@@ -40,8 +40,8 @@ export interface Poll {
|
|
|
40
40
|
type: "regular" | "quiz";
|
|
41
41
|
/** Whether the poll allows multiple answers. */
|
|
42
42
|
allowMultipleAnswers?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
|
|
43
|
+
/** The indexes of correct options. */
|
|
44
|
+
correctOptionIndexes?: number[];
|
|
45
45
|
/** A text that is shown to the user when the poll is answered. */
|
|
46
46
|
explanation?: string;
|
|
47
47
|
/** The explanation's entities. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_poll.d.ts","sourceRoot":"","sources":["../../src/types/4_poll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"4_poll.d.ts","sourceRoot":"","sources":["../../src/types/4_poll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,cAAc;AACd,MAAM,WAAW,IAAI;IACnB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,gBAAgB,EAAE,aAAa,EAAE,CAAC;IAClC,0BAA0B;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,gDAAgD;IAChD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,sCAAsC;IACtC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,mBAAmB,CAAC,EAAE,aAAa,EAAE,CAAC;IACtC,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAoBhE"}
|
package/script/types/4_poll.js
CHANGED
|
@@ -20,13 +20,15 @@
|
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.constructPoll = constructPoll;
|
|
23
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
23
24
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
25
|
+
const _2_tl_js_1 = require("../2_tl.js");
|
|
24
26
|
const _2_message_entity_js_1 = require("./2_message_entity.js");
|
|
25
27
|
const _3_poll_option_js_1 = require("./3_poll_option.js");
|
|
26
28
|
function constructPoll(media_) {
|
|
27
29
|
const poll = media_.poll;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
+
const correctOptions = media_.results.results?.filter((v) => v.correct).map((v) => v.option);
|
|
31
|
+
const correctOptionIndexes = correctOptions !== undefined ? poll.answers.filter((v) => correctOptions.some((v_) => (0, _0_deps_js_1.equals)(v_, _2_tl_js_1.Api.as("pollAnswer", v).option))).map((_, i) => i) : undefined;
|
|
30
32
|
return (0, _1_utilities_js_1.cleanObject)({
|
|
31
33
|
id: String(poll.id),
|
|
32
34
|
question: poll.question.text,
|
|
@@ -37,7 +39,7 @@ function constructPoll(media_) {
|
|
|
37
39
|
isAnonymous: !poll.public_voters,
|
|
38
40
|
type: poll.quiz ? "quiz" : "regular",
|
|
39
41
|
allowMultipleAnswers: poll.quiz ? undefined : poll.multiple_choice || false,
|
|
40
|
-
|
|
42
|
+
correctOptionIndexes,
|
|
41
43
|
explanation: media_.results.solution,
|
|
42
44
|
explanationEntities: media_.results.solution_entities?.map(_2_message_entity_js_1.constructMessageEntity).filter((v) => v !== null),
|
|
43
45
|
openPeriod: poll.close_period,
|