@mtkruto/node 0.0.904 → 0.0.906

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.
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.904";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.906";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
package/esm/constants.js CHANGED
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
62
62
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
63
63
  export const DEFAULT_INITIAL_DC = "2-test";
64
64
  export const LAYER = 158;
65
- export const DEFAULT_APP_VERSION = "MTKruto 0.0.904";
65
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.906";
66
66
  // @ts-ignore: lib
67
67
  export const DEFAULT_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;
68
68
  export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -10,6 +10,7 @@ export declare namespace Chat {
10
10
  interface Base {
11
11
  type: ChatType;
12
12
  id: number;
13
+ idColor: string;
13
14
  photo?: ChatPhoto;
14
15
  }
15
16
  interface Private extends Base {
@@ -52,6 +53,7 @@ export declare namespace Chat {
52
53
  }
53
54
  interface Supergroup extends ChannelBase {
54
55
  type: ChatType.Supergroup;
56
+ isForum: boolean;
55
57
  }
56
58
  }
57
59
  export type Chat = Chat.Private | Chat.Group | Chat.Supergroup | Chat.Channel;
@@ -4,6 +4,7 @@ import { cleanObject } from "../utilities/0_object.js";
4
4
  import { as } from "../tl/1_tl_object.js";
5
5
  import * as types from "../tl/2_types.js";
6
6
  import { constructChatPhoto } from "./0_chat_photo.js";
7
+ import { getIdColor } from "./utilities/0_id_color.js";
7
8
  export var ChatType;
8
9
  (function (ChatType) {
9
10
  ChatType["Private"] = "private";
@@ -13,10 +14,12 @@ export var ChatType;
13
14
  })(ChatType || (ChatType = {}));
14
15
  export function constructChat(chat) {
15
16
  if (chat instanceof types.User) {
17
+ const id = Number(chat.id);
16
18
  const chat_ = {
17
19
  type: ChatType.Private,
18
20
  isBot: chat.bot || false,
19
- id: Number(chat.id),
21
+ id,
22
+ idColor: getIdColor(id),
20
23
  firstName: chat.firstName || "",
21
24
  lastName: chat.lastName,
22
25
  isScam: chat.scam || false,
@@ -34,9 +37,11 @@ export function constructChat(chat) {
34
37
  return cleanObject(chat_);
35
38
  }
36
39
  else if (chat instanceof types.Chat) {
40
+ const id = Number(-chat.id);
37
41
  const chat_ = {
38
42
  type: ChatType.Group,
39
- id: Number(-chat.id),
43
+ id,
44
+ idColor: getIdColor(id),
40
45
  title: chat.title,
41
46
  isCreator: chat.creator || false,
42
47
  };
@@ -48,11 +53,32 @@ export function constructChat(chat) {
48
53
  else if (chat instanceof types.Channel) {
49
54
  let chat_;
50
55
  const { title, scam: isScam = false, fake: isFake = false, verified: isVerified = false, restricted: isRestricted = false, } = chat;
56
+ const id = ZERO_CHANNEL_ID + -Number(chat.id);
51
57
  if (chat.megagroup) {
52
- chat_ = { id: ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Supergroup, title, isScam, isFake, isVerified, isRestricted };
58
+ chat_ = {
59
+ id,
60
+ idColor: getIdColor(id),
61
+ type: ChatType.Supergroup,
62
+ title,
63
+ isScam,
64
+ isFake,
65
+ isVerified,
66
+ isRestricted,
67
+ isForum: chat.forum || false,
68
+ };
53
69
  }
54
70
  else {
55
- chat_ = { id: ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Channel, title, isScam, isFake, isVerified, isRestricted };
71
+ const id = ZERO_CHANNEL_ID + -Number(chat.id);
72
+ chat_ = {
73
+ id,
74
+ idColor: getIdColor(id),
75
+ type: ChatType.Channel,
76
+ title,
77
+ isScam,
78
+ isFake,
79
+ isVerified,
80
+ isRestricted,
81
+ };
56
82
  }
57
83
  chat_.username = chat.username;
58
84
  chat_.also = chat.usernames?.map((v) => v[as](types.Username)).map((v) => v.username);
@@ -2,6 +2,7 @@ import * as types from "../tl/2_types.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
3
  export interface User {
4
4
  id: number;
5
+ idColor: string;
5
6
  isBot: boolean;
6
7
  firstName: string;
7
8
  lastName?: string;
@@ -2,9 +2,12 @@ import { cleanObject } from "../utilities/0_object.js";
2
2
  import { as } from "../tl/1_tl_object.js";
3
3
  import * as types from "../tl/2_types.js";
4
4
  import { constructChatPhoto } from "./0_chat_photo.js";
5
+ import { getIdColor } from "./utilities/0_id_color.js";
5
6
  export function constructUser(user_) {
7
+ const id = Number(user_.id);
6
8
  const user = {
7
- id: Number(user_.id),
9
+ id,
10
+ idColor: getIdColor(id),
8
11
  isBot: user_.bot || false,
9
12
  firstName: user_.firstName || "",
10
13
  lastName: user_.lastName,
@@ -9,17 +9,32 @@ import { InlineKeyboardMarkup } from "./2_inline_keyboard_markup.js";
9
9
  import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
10
10
  export interface Message {
11
11
  id: number;
12
+ threadId?: number;
12
13
  from?: User;
14
+ senderChat?: Chat;
15
+ date?: Date;
13
16
  chat: Chat;
17
+ forwardFrom?: User;
18
+ forwardFromChat?: Chat;
19
+ forwardId?: number;
20
+ forwardSignature?: string;
21
+ forwardSenderName?: string;
22
+ forwardDate?: Date;
23
+ isTopicMessage: boolean;
24
+ isAutomaticForward?: boolean;
25
+ replyToMessage?: Omit<Message, "replyToMessage">;
26
+ viaBot?: User;
27
+ editDate?: Date;
28
+ hasProtectedContent: boolean;
29
+ mediaGroupId?: string;
30
+ authorSignature?: string;
14
31
  text?: string;
15
- caption?: string;
16
32
  entities?: MessageEntity[];
33
+ caption?: string;
17
34
  captionEntities?: MessageEntity[];
18
- date?: Date;
19
- editDate?: Date;
35
+ hasMediaSpoiler?: boolean;
20
36
  views?: number;
21
37
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
22
- replyToMessage?: Omit<Message, "replyToMessage">;
23
38
  }
24
39
  export declare function constructMessage(message_: types.Message, getEntity: {
25
40
  (peer: types.PeerUser): MaybePromise<types.User | null>;
@@ -42,7 +42,19 @@ export async function constructMessage(message_, getEntity, getMessage) {
42
42
  else {
43
43
  UNREACHABLE();
44
44
  }
45
- const message = { id: message_.id, chat: chat_, views: message_.views };
45
+ const message = {
46
+ id: message_.id,
47
+ chat: chat_,
48
+ views: message_.views,
49
+ isTopicMessage: false,
50
+ hasProtectedContent: message_.noforwards || false,
51
+ };
52
+ if (message_.media instanceof types.MessageMediaPhoto || message_.media instanceof types.MessageMediaDocument) {
53
+ message.hasMediaSpoiler = message_.media.spoiler || false;
54
+ }
55
+ if (message_.groupedId != undefined) {
56
+ message.mediaGroupId = String(message_.groupedId);
57
+ }
46
58
  if (message_.fromId instanceof types.PeerUser) {
47
59
  const entity = await getEntity(message_.fromId);
48
60
  if (entity) {
@@ -89,14 +101,68 @@ export async function constructMessage(message_, getEntity, getMessage) {
89
101
  UNREACHABLE();
90
102
  }
91
103
  }
104
+ // message_.
92
105
  if (getMessage && message_.replyTo instanceof types.MessageReplyHeader) {
106
+ if (message_.replyTo.forumTopic) {
107
+ message.isTopicMessage = true;
108
+ }
93
109
  const replyToMessage = await getMessage(message.chat.id, message_.replyTo.replyToMsgId);
94
110
  if (replyToMessage) {
95
111
  message.replyToMessage = replyToMessage;
112
+ message.threadId = message_.replyTo.replyToTopId;
96
113
  }
97
114
  else {
98
115
  d("couldn't get replied message");
99
116
  }
100
117
  }
118
+ if (message_.viaBotId != undefined) {
119
+ const viaBot = await getEntity(new types.PeerUser({ userId: message_.viaBotId }));
120
+ if (viaBot) {
121
+ message.viaBot = constructUser(viaBot);
122
+ }
123
+ else {
124
+ UNREACHABLE();
125
+ }
126
+ }
127
+ if (message_.postAuthor != undefined) {
128
+ message.authorSignature = message_.postAuthor;
129
+ }
130
+ if (message_.fwdFrom instanceof types.MessageFwdHeader) {
131
+ message.isAutomaticForward = message_.fwdFrom.savedFromPeer != undefined && message_.fwdFrom.savedFromMsgId != undefined;
132
+ message.forwardSenderName = message_.fwdFrom.fromName;
133
+ message.forwardId = message_.fwdFrom.channelPost;
134
+ message.forwardSignature = message_.fwdFrom.postAuthor;
135
+ message.forwardDate = new Date(message_.date * 1000);
136
+ if (message_.fwdFrom.fromId instanceof types.PeerUser) {
137
+ const entity = await getEntity(message_.fwdFrom.fromId);
138
+ if (entity) {
139
+ message.forwardFrom = constructUser(entity);
140
+ }
141
+ else {
142
+ UNREACHABLE();
143
+ }
144
+ }
145
+ else if (message_.fwdFrom.fromId instanceof types.PeerChat) {
146
+ const entity = await getEntity(message_.fwdFrom.fromId);
147
+ if (entity) {
148
+ message.forwardFromChat = constructChat(entity);
149
+ }
150
+ else {
151
+ UNREACHABLE();
152
+ }
153
+ }
154
+ else if (message_.fwdFrom.fromId instanceof types.PeerChannel) {
155
+ const entity = await getEntity(message_.fwdFrom.fromId);
156
+ if (entity) {
157
+ message.forwardFromChat = constructChat(entity);
158
+ }
159
+ else {
160
+ UNREACHABLE();
161
+ }
162
+ }
163
+ else {
164
+ UNREACHABLE();
165
+ }
166
+ }
101
167
  return cleanObject(message);
102
168
  }
@@ -0,0 +1 @@
1
+ export declare function getIdColor(id: number): string;
@@ -0,0 +1,16 @@
1
+ const colors = [
2
+ "#ff5a2b",
3
+ "#ffa92b",
4
+ "#b364f1",
5
+ "#30dc53",
6
+ "#30dcc2",
7
+ "#309cdc",
8
+ "#e52eb1", // pink
9
+ ];
10
+ export function getIdColor(id) {
11
+ id = Number(String(id).replaceAll("-100", "-"));
12
+ if (id < 0) {
13
+ id = -id;
14
+ }
15
+ return colors[id % 7];
16
+ }
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.0.904",
5
+ "version": "0.0.906",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.904";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.906";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
88
88
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
89
89
  exports.DEFAULT_INITIAL_DC = "2-test";
90
90
  exports.LAYER = 158;
91
- exports.DEFAULT_APP_VERSION = "MTKruto 0.0.904";
91
+ exports.DEFAULT_APP_VERSION = "MTKruto 0.0.906";
92
92
  // @ts-ignore: lib
93
93
  exports.DEFAULT_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;
94
94
  exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -10,6 +10,7 @@ export declare namespace Chat {
10
10
  interface Base {
11
11
  type: ChatType;
12
12
  id: number;
13
+ idColor: string;
13
14
  photo?: ChatPhoto;
14
15
  }
15
16
  interface Private extends Base {
@@ -52,6 +53,7 @@ export declare namespace Chat {
52
53
  }
53
54
  interface Supergroup extends ChannelBase {
54
55
  type: ChatType.Supergroup;
56
+ isForum: boolean;
55
57
  }
56
58
  }
57
59
  export type Chat = Chat.Private | Chat.Group | Chat.Supergroup | Chat.Channel;
@@ -30,6 +30,7 @@ const _0_object_js_1 = require("../utilities/0_object.js");
30
30
  const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
31
31
  const types = __importStar(require("../tl/2_types.js"));
32
32
  const _0_chat_photo_js_1 = require("./0_chat_photo.js");
33
+ const _0_id_color_js_1 = require("./utilities/0_id_color.js");
33
34
  var ChatType;
34
35
  (function (ChatType) {
35
36
  ChatType["Private"] = "private";
@@ -39,10 +40,12 @@ var ChatType;
39
40
  })(ChatType = exports.ChatType || (exports.ChatType = {}));
40
41
  function constructChat(chat) {
41
42
  if (chat instanceof types.User) {
43
+ const id = Number(chat.id);
42
44
  const chat_ = {
43
45
  type: ChatType.Private,
44
46
  isBot: chat.bot || false,
45
- id: Number(chat.id),
47
+ id,
48
+ idColor: (0, _0_id_color_js_1.getIdColor)(id),
46
49
  firstName: chat.firstName || "",
47
50
  lastName: chat.lastName,
48
51
  isScam: chat.scam || false,
@@ -60,9 +63,11 @@ function constructChat(chat) {
60
63
  return (0, _0_object_js_1.cleanObject)(chat_);
61
64
  }
62
65
  else if (chat instanceof types.Chat) {
66
+ const id = Number(-chat.id);
63
67
  const chat_ = {
64
68
  type: ChatType.Group,
65
- id: Number(-chat.id),
69
+ id,
70
+ idColor: (0, _0_id_color_js_1.getIdColor)(id),
66
71
  title: chat.title,
67
72
  isCreator: chat.creator || false,
68
73
  };
@@ -74,11 +79,32 @@ function constructChat(chat) {
74
79
  else if (chat instanceof types.Channel) {
75
80
  let chat_;
76
81
  const { title, scam: isScam = false, fake: isFake = false, verified: isVerified = false, restricted: isRestricted = false, } = chat;
82
+ const id = constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id);
77
83
  if (chat.megagroup) {
78
- chat_ = { id: constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Supergroup, title, isScam, isFake, isVerified, isRestricted };
84
+ chat_ = {
85
+ id,
86
+ idColor: (0, _0_id_color_js_1.getIdColor)(id),
87
+ type: ChatType.Supergroup,
88
+ title,
89
+ isScam,
90
+ isFake,
91
+ isVerified,
92
+ isRestricted,
93
+ isForum: chat.forum || false,
94
+ };
79
95
  }
80
96
  else {
81
- chat_ = { id: constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id), type: ChatType.Channel, title, isScam, isFake, isVerified, isRestricted };
97
+ const id = constants_js_1.ZERO_CHANNEL_ID + -Number(chat.id);
98
+ chat_ = {
99
+ id,
100
+ idColor: (0, _0_id_color_js_1.getIdColor)(id),
101
+ type: ChatType.Channel,
102
+ title,
103
+ isScam,
104
+ isFake,
105
+ isVerified,
106
+ isRestricted,
107
+ };
82
108
  }
83
109
  chat_.username = chat.username;
84
110
  chat_.also = chat.usernames?.map((v) => v[_1_tl_object_js_1.as](types.Username)).map((v) => v.username);
@@ -2,6 +2,7 @@ import * as types from "../tl/2_types.js";
2
2
  import { ChatPhoto } from "./0_chat_photo.js";
3
3
  export interface User {
4
4
  id: number;
5
+ idColor: string;
5
6
  isBot: boolean;
6
7
  firstName: string;
7
8
  lastName?: string;
@@ -28,9 +28,12 @@ const _0_object_js_1 = require("../utilities/0_object.js");
28
28
  const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
29
29
  const types = __importStar(require("../tl/2_types.js"));
30
30
  const _0_chat_photo_js_1 = require("./0_chat_photo.js");
31
+ const _0_id_color_js_1 = require("./utilities/0_id_color.js");
31
32
  function constructUser(user_) {
33
+ const id = Number(user_.id);
32
34
  const user = {
33
- id: Number(user_.id),
35
+ id,
36
+ idColor: (0, _0_id_color_js_1.getIdColor)(id),
34
37
  isBot: user_.bot || false,
35
38
  firstName: user_.firstName || "",
36
39
  lastName: user_.lastName,
@@ -9,17 +9,32 @@ import { InlineKeyboardMarkup } from "./2_inline_keyboard_markup.js";
9
9
  import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
10
10
  export interface Message {
11
11
  id: number;
12
+ threadId?: number;
12
13
  from?: User;
14
+ senderChat?: Chat;
15
+ date?: Date;
13
16
  chat: Chat;
17
+ forwardFrom?: User;
18
+ forwardFromChat?: Chat;
19
+ forwardId?: number;
20
+ forwardSignature?: string;
21
+ forwardSenderName?: string;
22
+ forwardDate?: Date;
23
+ isTopicMessage: boolean;
24
+ isAutomaticForward?: boolean;
25
+ replyToMessage?: Omit<Message, "replyToMessage">;
26
+ viaBot?: User;
27
+ editDate?: Date;
28
+ hasProtectedContent: boolean;
29
+ mediaGroupId?: string;
30
+ authorSignature?: string;
14
31
  text?: string;
15
- caption?: string;
16
32
  entities?: MessageEntity[];
33
+ caption?: string;
17
34
  captionEntities?: MessageEntity[];
18
- date?: Date;
19
- editDate?: Date;
35
+ hasMediaSpoiler?: boolean;
20
36
  views?: number;
21
37
  replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
22
- replyToMessage?: Omit<Message, "replyToMessage">;
23
38
  }
24
39
  export declare function constructMessage(message_: types.Message, getEntity: {
25
40
  (peer: types.PeerUser): MaybePromise<types.User | null>;
@@ -68,7 +68,19 @@ async function constructMessage(message_, getEntity, getMessage) {
68
68
  else {
69
69
  (0, _0_control_js_1.UNREACHABLE)();
70
70
  }
71
- const message = { id: message_.id, chat: chat_, views: message_.views };
71
+ const message = {
72
+ id: message_.id,
73
+ chat: chat_,
74
+ views: message_.views,
75
+ isTopicMessage: false,
76
+ hasProtectedContent: message_.noforwards || false,
77
+ };
78
+ if (message_.media instanceof types.MessageMediaPhoto || message_.media instanceof types.MessageMediaDocument) {
79
+ message.hasMediaSpoiler = message_.media.spoiler || false;
80
+ }
81
+ if (message_.groupedId != undefined) {
82
+ message.mediaGroupId = String(message_.groupedId);
83
+ }
72
84
  if (message_.fromId instanceof types.PeerUser) {
73
85
  const entity = await getEntity(message_.fromId);
74
86
  if (entity) {
@@ -115,15 +127,69 @@ async function constructMessage(message_, getEntity, getMessage) {
115
127
  (0, _0_control_js_1.UNREACHABLE)();
116
128
  }
117
129
  }
130
+ // message_.
118
131
  if (getMessage && message_.replyTo instanceof types.MessageReplyHeader) {
132
+ if (message_.replyTo.forumTopic) {
133
+ message.isTopicMessage = true;
134
+ }
119
135
  const replyToMessage = await getMessage(message.chat.id, message_.replyTo.replyToMsgId);
120
136
  if (replyToMessage) {
121
137
  message.replyToMessage = replyToMessage;
138
+ message.threadId = message_.replyTo.replyToTopId;
122
139
  }
123
140
  else {
124
141
  d("couldn't get replied message");
125
142
  }
126
143
  }
144
+ if (message_.viaBotId != undefined) {
145
+ const viaBot = await getEntity(new types.PeerUser({ userId: message_.viaBotId }));
146
+ if (viaBot) {
147
+ message.viaBot = (0, _1_user_js_1.constructUser)(viaBot);
148
+ }
149
+ else {
150
+ (0, _0_control_js_1.UNREACHABLE)();
151
+ }
152
+ }
153
+ if (message_.postAuthor != undefined) {
154
+ message.authorSignature = message_.postAuthor;
155
+ }
156
+ if (message_.fwdFrom instanceof types.MessageFwdHeader) {
157
+ message.isAutomaticForward = message_.fwdFrom.savedFromPeer != undefined && message_.fwdFrom.savedFromMsgId != undefined;
158
+ message.forwardSenderName = message_.fwdFrom.fromName;
159
+ message.forwardId = message_.fwdFrom.channelPost;
160
+ message.forwardSignature = message_.fwdFrom.postAuthor;
161
+ message.forwardDate = new Date(message_.date * 1000);
162
+ if (message_.fwdFrom.fromId instanceof types.PeerUser) {
163
+ const entity = await getEntity(message_.fwdFrom.fromId);
164
+ if (entity) {
165
+ message.forwardFrom = (0, _1_user_js_1.constructUser)(entity);
166
+ }
167
+ else {
168
+ (0, _0_control_js_1.UNREACHABLE)();
169
+ }
170
+ }
171
+ else if (message_.fwdFrom.fromId instanceof types.PeerChat) {
172
+ const entity = await getEntity(message_.fwdFrom.fromId);
173
+ if (entity) {
174
+ message.forwardFromChat = (0, _1_chat_js_1.constructChat)(entity);
175
+ }
176
+ else {
177
+ (0, _0_control_js_1.UNREACHABLE)();
178
+ }
179
+ }
180
+ else if (message_.fwdFrom.fromId instanceof types.PeerChannel) {
181
+ const entity = await getEntity(message_.fwdFrom.fromId);
182
+ if (entity) {
183
+ message.forwardFromChat = (0, _1_chat_js_1.constructChat)(entity);
184
+ }
185
+ else {
186
+ (0, _0_control_js_1.UNREACHABLE)();
187
+ }
188
+ }
189
+ else {
190
+ (0, _0_control_js_1.UNREACHABLE)();
191
+ }
192
+ }
127
193
  return (0, _0_object_js_1.cleanObject)(message);
128
194
  }
129
195
  exports.constructMessage = constructMessage;
@@ -0,0 +1 @@
1
+ export declare function getIdColor(id: number): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIdColor = void 0;
4
+ const colors = [
5
+ "#ff5a2b",
6
+ "#ffa92b",
7
+ "#b364f1",
8
+ "#30dc53",
9
+ "#30dcc2",
10
+ "#309cdc",
11
+ "#e52eb1", // pink
12
+ ];
13
+ function getIdColor(id) {
14
+ id = Number(String(id).replaceAll("-100", "-"));
15
+ if (id < 0) {
16
+ id = -id;
17
+ }
18
+ return colors[id % 7];
19
+ }
20
+ exports.getIdColor = getIdColor;