@mtkruto/node 0.1.104 → 0.1.105

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 CHANGED
@@ -21,6 +21,7 @@ export * from "./types/0_message_entity.js";
21
21
  export * from "./types/0_parse_mode.js";
22
22
  export * from "./types/0_poll_option.js";
23
23
  export * from "./types/0_reply_keyboard_remove.js";
24
+ export * from "./types/0_restriction_reason.js";
24
25
  export * from "./types/0_thumbnail.js";
25
26
  export * from "./types/0_venue.js";
26
27
  export * from "./types/0_voice.js";
package/esm/3_types.js CHANGED
@@ -21,6 +21,7 @@ export * from "./types/0_message_entity.js";
21
21
  export * from "./types/0_parse_mode.js";
22
22
  export * from "./types/0_poll_option.js";
23
23
  export * from "./types/0_reply_keyboard_remove.js";
24
+ export * from "./types/0_restriction_reason.js";
24
25
  export * from "./types/0_thumbnail.js";
25
26
  export * from "./types/0_venue.js";
26
27
  export * from "./types/0_voice.js";
@@ -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.104";
8
+ export declare const APP_VERSION = "MTKruto 0.1.105";
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.104";
57
+ export const APP_VERSION = "MTKruto 0.1.105";
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];
@@ -0,0 +1,7 @@
1
+ import { types } from "../2_tl.js";
2
+ export interface RestrictionReason {
3
+ platform: string;
4
+ reason: string;
5
+ text: string;
6
+ }
7
+ export declare function constructRestrictionReason(rr: types.TypeRestrictionReason): RestrictionReason;
@@ -0,0 +1,3 @@
1
+ export function constructRestrictionReason(rr) {
2
+ return { platform: rr.platform, reason: rr.reason, text: rr.text };
3
+ }
@@ -1,6 +1,7 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
3
  import { Color } from "./0_color.js";
4
+ import { RestrictionReason } from "./0_restriction_reason.js";
4
5
  export type ChatType = "private" | "group" | "supergroup" | "channel";
5
6
  export declare namespace Chat {
6
7
  interface Base {
@@ -37,7 +38,7 @@ export declare namespace Chat {
37
38
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
38
39
  isRestricted?: boolean;
39
40
  /** Contains the reason why access to the user must be restricted. */
40
- restrictionReason?: types.RestrictionReason[];
41
+ restrictionReason?: RestrictionReason[];
41
42
  }
42
43
  interface Group extends Base {
43
44
  type: "group";
@@ -66,7 +67,7 @@ export declare namespace Chat {
66
67
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
67
68
  isRestricted: boolean;
68
69
  /** Contains the reason why access to the user must be restricted. */
69
- restrictionReason?: types.RestrictionReason[];
70
+ restrictionReason?: RestrictionReason[];
70
71
  }
71
72
  interface Channel extends ChannelBase {
72
73
  type: "channel";
@@ -3,6 +3,7 @@ import { types } from "../2_tl.js";
3
3
  import { ZERO_CHANNEL_ID } from "../4_constants.js";
4
4
  import { constructChatPhoto } from "./0_chat_photo.js";
5
5
  import { getColor } from "./0_color.js";
6
+ import { constructRestrictionReason } from "./0_restriction_reason.js";
6
7
  export function constructChat(chat) {
7
8
  if (chat instanceof types.User) {
8
9
  const id = Number(chat.id);
@@ -74,7 +75,7 @@ export function constructChat(chat) {
74
75
  chat_.username = chat.username;
75
76
  chat_.also = chat.usernames?.map((v) => v.username);
76
77
  if (chat_.isRestricted) {
77
- chat_.restrictionReason = chat.restrictionReason;
78
+ chat_.restrictionReason = (chat.restrictionReason ?? []).map(constructRestrictionReason);
78
79
  }
79
80
  if (chat.photo instanceof types.ChatPhoto) {
80
81
  chat_.photo = constructChatPhoto(chat.photo, chat_.id, chat.accessHash ?? 0n);
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.104",
5
+ "version": "0.1.105",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -21,6 +21,7 @@ export * from "./types/0_message_entity.js";
21
21
  export * from "./types/0_parse_mode.js";
22
22
  export * from "./types/0_poll_option.js";
23
23
  export * from "./types/0_reply_keyboard_remove.js";
24
+ export * from "./types/0_restriction_reason.js";
24
25
  export * from "./types/0_thumbnail.js";
25
26
  export * from "./types/0_venue.js";
26
27
  export * from "./types/0_voice.js";
package/script/3_types.js CHANGED
@@ -37,6 +37,7 @@ __exportStar(require("./types/0_message_entity.js"), exports);
37
37
  __exportStar(require("./types/0_parse_mode.js"), exports);
38
38
  __exportStar(require("./types/0_poll_option.js"), exports);
39
39
  __exportStar(require("./types/0_reply_keyboard_remove.js"), exports);
40
+ __exportStar(require("./types/0_restriction_reason.js"), exports);
40
41
  __exportStar(require("./types/0_thumbnail.js"), exports);
41
42
  __exportStar(require("./types/0_venue.js"), exports);
42
43
  __exportStar(require("./types/0_voice.js"), exports);
@@ -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.104";
8
+ export declare const APP_VERSION = "MTKruto 0.1.105";
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.104";
83
+ exports.APP_VERSION = "MTKruto 0.1.105";
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];
@@ -0,0 +1,7 @@
1
+ import { types } from "../2_tl.js";
2
+ export interface RestrictionReason {
3
+ platform: string;
4
+ reason: string;
5
+ text: string;
6
+ }
7
+ export declare function constructRestrictionReason(rr: types.TypeRestrictionReason): RestrictionReason;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructRestrictionReason = void 0;
4
+ function constructRestrictionReason(rr) {
5
+ return { platform: rr.platform, reason: rr.reason, text: rr.text };
6
+ }
7
+ exports.constructRestrictionReason = constructRestrictionReason;
@@ -1,6 +1,7 @@
1
1
  import { types } from "../2_tl.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
3
  import { Color } from "./0_color.js";
4
+ import { RestrictionReason } from "./0_restriction_reason.js";
4
5
  export type ChatType = "private" | "group" | "supergroup" | "channel";
5
6
  export declare namespace Chat {
6
7
  interface Base {
@@ -37,7 +38,7 @@ export declare namespace Chat {
37
38
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
38
39
  isRestricted?: boolean;
39
40
  /** Contains the reason why access to the user must be restricted. */
40
- restrictionReason?: types.RestrictionReason[];
41
+ restrictionReason?: RestrictionReason[];
41
42
  }
42
43
  interface Group extends Base {
43
44
  type: "group";
@@ -66,7 +67,7 @@ export declare namespace Chat {
66
67
  /** True, if the access to the user must be restricted for the reason specified in `restriction_reason` */
67
68
  isRestricted: boolean;
68
69
  /** Contains the reason why access to the user must be restricted. */
69
- restrictionReason?: types.RestrictionReason[];
70
+ restrictionReason?: RestrictionReason[];
70
71
  }
71
72
  interface Channel extends ChannelBase {
72
73
  type: "channel";
@@ -6,6 +6,7 @@ const _2_tl_js_1 = require("../2_tl.js");
6
6
  const _4_constants_js_1 = require("../4_constants.js");
7
7
  const _0_chat_photo_js_1 = require("./0_chat_photo.js");
8
8
  const _0_color_js_1 = require("./0_color.js");
9
+ const _0_restriction_reason_js_1 = require("./0_restriction_reason.js");
9
10
  function constructChat(chat) {
10
11
  if (chat instanceof _2_tl_js_1.types.User) {
11
12
  const id = Number(chat.id);
@@ -77,7 +78,7 @@ function constructChat(chat) {
77
78
  chat_.username = chat.username;
78
79
  chat_.also = chat.usernames?.map((v) => v.username);
79
80
  if (chat_.isRestricted) {
80
- chat_.restrictionReason = chat.restrictionReason;
81
+ chat_.restrictionReason = (chat.restrictionReason ?? []).map(_0_restriction_reason_js_1.constructRestrictionReason);
81
82
  }
82
83
  if (chat.photo instanceof _2_tl_js_1.types.ChatPhoto) {
83
84
  chat_.photo = (0, _0_chat_photo_js_1.constructChatPhoto)(chat.photo, chat_.id, chat.accessHash ?? 0n);