@imessaging/telegram-mtproto 0.2.0 → 0.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imessaging/telegram-mtproto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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.
|
|
34
|
+
"@imessaging/core": "0.3.0",
|
|
35
35
|
"big-integer": "^1.6.52"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
TelegramPeerStore,
|
|
10
10
|
TransportStatus,
|
|
11
11
|
} from "@imessaging/core";
|
|
12
|
-
import { MemoryPeerStore } from "@imessaging/core";
|
|
12
|
+
import { isTelegramRecipient, MemoryPeerStore } from "@imessaging/core";
|
|
13
13
|
import bigInt from "big-integer";
|
|
14
14
|
import { Api, TelegramClient } from "telegram";
|
|
15
15
|
import { CustomFile } from "telegram/client/uploads";
|
|
@@ -167,6 +167,11 @@ export class TelegramMtprotoTransport implements EditableMessageTransport {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
private async resolvePeer(recipient: MessageRecipient): Promise<ResolvedPeer> {
|
|
170
|
+
// Почтовый получатель сюда доходить не должен: разрешать адрес как @username бессмысленно, а
|
|
171
|
+
// сообщение об отказе тогда врало бы про Telegram.
|
|
172
|
+
if (!isTelegramRecipient(recipient)) {
|
|
173
|
+
throw new Error("Telegram MTProto cannot send email");
|
|
174
|
+
}
|
|
170
175
|
if (recipient.type !== "username" && !recipient.username) {
|
|
171
176
|
throw new Error(
|
|
172
177
|
`Cannot resolve uncached Telegram ${recipient.type} ${recipient.id} without a username`,
|