@imessaging/telegram-mtproto 0.8.15 → 0.8.17
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imessaging/telegram-mtproto",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.17",
|
|
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.8.
|
|
34
|
+
"@imessaging/core": "^0.8.15",
|
|
35
35
|
"big-integer": "^1.6.52"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -413,6 +413,12 @@ export class TelegramMtprotoTransport
|
|
|
413
413
|
if (replyTo !== undefined && (!Number.isSafeInteger(replyTo) || replyTo <= 0)) {
|
|
414
414
|
throw new Error(`Telegram message id must be a positive integer: ${draft.replyToMessageId}`);
|
|
415
415
|
}
|
|
416
|
+
const threadId = draft.threadId;
|
|
417
|
+
if (threadId !== undefined && (!Number.isSafeInteger(threadId) || threadId <= 0)) {
|
|
418
|
+
throw new Error(`Telegram thread id must be a positive integer: ${threadId}`);
|
|
419
|
+
}
|
|
420
|
+
// Тема: topMsgId всегда, без него черновик ложится в General; без ответа — ответ на корень темы.
|
|
421
|
+
const replyToMsgId = replyTo ?? threadId;
|
|
416
422
|
const ft = draft.format ? formatText(draft.text, draft.format) : undefined;
|
|
417
423
|
const save = async (peer: Api.TypeInputPeer) =>
|
|
418
424
|
this.client.invoke(
|
|
@@ -420,7 +426,14 @@ export class TelegramMtprotoTransport
|
|
|
420
426
|
peer,
|
|
421
427
|
message: ft ? ft.text : draft.text,
|
|
422
428
|
...(ft && ft.entities.length > 0 ? { entities: toTelegramEntities(ft) } : {}),
|
|
423
|
-
...(
|
|
429
|
+
...(replyToMsgId
|
|
430
|
+
? {
|
|
431
|
+
replyTo: new Api.InputReplyToMessage({
|
|
432
|
+
replyToMsgId,
|
|
433
|
+
...(threadId ? { topMsgId: threadId } : {}),
|
|
434
|
+
}),
|
|
435
|
+
}
|
|
436
|
+
: {}),
|
|
424
437
|
}),
|
|
425
438
|
);
|
|
426
439
|
try {
|