@mtkruto/node 0.100.3 → 0.101.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_utilities.d.ts +1 -1
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.d.ts +117 -762
- package/esm/tl/1_telegram_api.d.ts.map +1 -1
- package/esm/tl/1_telegram_api.js +194 -57
- package/esm/types/0_gift_component_rarity.d.ts +39 -0
- package/esm/types/0_gift_component_rarity.d.ts.map +1 -0
- package/esm/types/0_gift_component_rarity.js +43 -0
- package/esm/types/3_gift_upgraded_component.d.ts +7 -6
- package/esm/types/3_gift_upgraded_component.d.ts.map +1 -1
- package/esm/types/3_gift_upgraded_component.js +4 -4
- 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_utilities.d.ts +1 -1
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/tl/1_telegram_api.d.ts +117 -762
- package/script/tl/1_telegram_api.d.ts.map +1 -1
- package/script/tl/1_telegram_api.js +194 -57
- package/script/types/0_gift_component_rarity.d.ts +39 -0
- package/script/types/0_gift_component_rarity.d.ts.map +1 -0
- package/script/types/0_gift_component_rarity.js +46 -0
- package/script/types/3_gift_upgraded_component.d.ts +7 -6
- package/script/types/3_gift_upgraded_component.d.ts.map +1 -1
- package/script/types/3_gift_upgraded_component.js +4 -4
|
@@ -0,0 +1,46 @@
|
|
|
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 });
|
|
22
|
+
exports.constructGiftComponentRarity = constructGiftComponentRarity;
|
|
23
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
24
|
+
function constructGiftComponentRarity(rarity) {
|
|
25
|
+
switch (rarity._) {
|
|
26
|
+
case "starGiftAttributeRarity":
|
|
27
|
+
return {
|
|
28
|
+
type: "perMille",
|
|
29
|
+
perMille: rarity.permille,
|
|
30
|
+
};
|
|
31
|
+
case "starGiftAttributeRarityUncommon":
|
|
32
|
+
return {
|
|
33
|
+
type: "uncommon",
|
|
34
|
+
};
|
|
35
|
+
case "starGiftAttributeRarityRare":
|
|
36
|
+
return {
|
|
37
|
+
type: "rare",
|
|
38
|
+
};
|
|
39
|
+
case "starGiftAttributeRarityEpic":
|
|
40
|
+
return { type: "epic" };
|
|
41
|
+
case "starGiftAttributeRarityLegendary":
|
|
42
|
+
return { type: "legendary" };
|
|
43
|
+
default:
|
|
44
|
+
(0, _0_deps_js_1.unreachable)();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
|
+
import { type GiftComponentRarity } from "./0_gift_component_rarity.js";
|
|
21
22
|
import { type Sticker } from "./1_sticker.js";
|
|
22
23
|
import { type MessageEntity } from "./2_message_entity.js";
|
|
23
24
|
/**
|
|
@@ -32,8 +33,8 @@ export interface GiftUpgradedComponentModel {
|
|
|
32
33
|
name: string;
|
|
33
34
|
/** The sticker belonging to the model. */
|
|
34
35
|
sticker: Sticker;
|
|
35
|
-
/**
|
|
36
|
-
|
|
36
|
+
/** The rarity of the model. */
|
|
37
|
+
rarity: GiftComponentRarity;
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* The pattern of an upgraded gift.
|
|
@@ -47,8 +48,8 @@ export interface GiftUpgradedComponentPattern {
|
|
|
47
48
|
name: string;
|
|
48
49
|
/** The sticker belonging to the pattern. */
|
|
49
50
|
sticker: Sticker;
|
|
50
|
-
/**
|
|
51
|
-
|
|
51
|
+
/** The rarity of the pattern. */
|
|
52
|
+
rarity: GiftComponentRarity;
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
55
|
* The backdrop of an upgraded gift.
|
|
@@ -68,8 +69,8 @@ export interface GiftUpgradedComponentBackdrop {
|
|
|
68
69
|
patternColor: number;
|
|
69
70
|
/** The text color of the backdrop. */
|
|
70
71
|
textColor: number;
|
|
71
|
-
/**
|
|
72
|
-
|
|
72
|
+
/** The rarity of the backdrop. */
|
|
73
|
+
rarity: GiftComponentRarity;
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* The original details of an upgraded gift.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3_gift_upgraded_component.d.ts","sourceRoot":"","sources":["../../src/types/3_gift_upgraded_component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,qBAAqB;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"3_gift_upgraded_component.d.ts","sourceRoot":"","sources":["../../src/types/3_gift_upgraded_component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEnF;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,qBAAqB;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qBAAqB;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,qBAAqB;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,oCAAoC;IACnD,qBAAqB;IACrB,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,GAAG,4BAA4B,GAAG,6BAA6B,GAAG,oCAAoC,CAAC;AAErK,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,GAAG,CAAC,iBAAiB,GAAG,qBAAqB,CA8DtG"}
|
|
@@ -24,11 +24,11 @@ const _0_deps_js_1 = require("../0_deps.js");
|
|
|
24
24
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
25
25
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
26
26
|
const _file_id_js_1 = require("./_file_id.js");
|
|
27
|
+
const _0_gift_component_rarity_js_1 = require("./0_gift_component_rarity.js");
|
|
27
28
|
const _1_sticker_js_1 = require("./1_sticker.js");
|
|
28
29
|
const _2_message_entity_js_1 = require("./2_message_entity.js");
|
|
29
30
|
function constructGiftUpgradedComponent(attribute) {
|
|
30
31
|
const name = "name" in attribute ? attribute.name : "";
|
|
31
|
-
const rarityLevel = "rarity_permille" in attribute ? attribute.rarity_permille : 0;
|
|
32
32
|
switch (attribute._) {
|
|
33
33
|
case "starGiftAttributeModel": {
|
|
34
34
|
if (!_2_tl_js_1.Api.is("document", attribute.document)) {
|
|
@@ -45,7 +45,7 @@ function constructGiftUpgradedComponent(attribute) {
|
|
|
45
45
|
type: "model",
|
|
46
46
|
name,
|
|
47
47
|
sticker,
|
|
48
|
-
|
|
48
|
+
rarity: (0, _0_gift_component_rarity_js_1.constructGiftComponentRarity)(attribute.rarity),
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
case "starGiftAttributePattern": {
|
|
@@ -63,7 +63,7 @@ function constructGiftUpgradedComponent(attribute) {
|
|
|
63
63
|
type: "pattern",
|
|
64
64
|
name,
|
|
65
65
|
sticker,
|
|
66
|
-
|
|
66
|
+
rarity: (0, _0_gift_component_rarity_js_1.constructGiftComponentRarity)(attribute.rarity),
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
case "starGiftAttributeBackdrop":
|
|
@@ -74,7 +74,7 @@ function constructGiftUpgradedComponent(attribute) {
|
|
|
74
74
|
edgeColor: attribute.edge_color,
|
|
75
75
|
patternColor: attribute.pattern_color,
|
|
76
76
|
textColor: attribute.text_color,
|
|
77
|
-
|
|
77
|
+
rarity: (0, _0_gift_component_rarity_js_1.constructGiftComponentRarity)(attribute.rarity),
|
|
78
78
|
};
|
|
79
79
|
case "starGiftAttributeOriginalDetails":
|
|
80
80
|
return (0, _1_utilities_js_1.cleanObject)({
|