@imessaging/telegram-mtproto 0.7.3 → 0.7.4
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/package.json +2 -2
- package/src/incoming.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imessaging/telegram-mtproto",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Telegram MTProto user-account transport for imessaging",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"messaging",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@imessaging/core": "^0.7.
|
|
34
|
+
"@imessaging/core": "^0.7.4",
|
|
35
35
|
"big-integer": "^1.6.52"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
package/src/incoming.ts
CHANGED
|
@@ -53,6 +53,13 @@ export type MtprotoMessageLike = {
|
|
|
53
53
|
title?: string;
|
|
54
54
|
accessHash?: { toString(): string } | string | number;
|
|
55
55
|
};
|
|
56
|
+
/** Сущность САМОГО чата из обновления: канал, группа или собеседник. Может не прийти. */
|
|
57
|
+
chat?: {
|
|
58
|
+
username?: string;
|
|
59
|
+
firstName?: string;
|
|
60
|
+
lastName?: string;
|
|
61
|
+
title?: string;
|
|
62
|
+
};
|
|
56
63
|
/**
|
|
57
64
|
* Пир отправителя ВМЕСТЕ с `accessHash` — так его отдаёт само обновление.
|
|
58
65
|
*
|
|
@@ -251,6 +258,12 @@ export function toIncomingMessage(
|
|
|
251
258
|
else if (message.sender.title) senderName = message.sender.title;
|
|
252
259
|
}
|
|
253
260
|
|
|
261
|
+
const chatName = [message.chat?.firstName, message.chat?.lastName]
|
|
262
|
+
.filter(Boolean)
|
|
263
|
+
.join(" ")
|
|
264
|
+
.trim();
|
|
265
|
+
const chatTitle = message.chat?.title || chatName || undefined;
|
|
266
|
+
|
|
254
267
|
let threadId: number | undefined;
|
|
255
268
|
let replyToMessageId: string | undefined;
|
|
256
269
|
if (message.replyTo?.forumTopic === true) {
|
|
@@ -274,6 +287,8 @@ export function toIncomingMessage(
|
|
|
274
287
|
// связывают человека со своей учётной записью.
|
|
275
288
|
senderUsername: message.sender?.username,
|
|
276
289
|
senderName,
|
|
290
|
+
chatTitle,
|
|
291
|
+
chatUsername: message.chat?.username ?? undefined,
|
|
277
292
|
messageId: String(message.id),
|
|
278
293
|
albumId: message.groupedId?.toString(),
|
|
279
294
|
text: message.message ?? "",
|