@imessaging/avito 0.1.0 → 0.1.1
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 +1 -1
- package/src/avito-transport.ts +3 -2
package/package.json
CHANGED
package/src/avito-transport.ts
CHANGED
|
@@ -454,10 +454,11 @@ export class AvitoTransport
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
function avitoChatId(transportId: string, recipient: MessageRecipient): string {
|
|
457
|
-
|
|
457
|
+
// Ответ на входящее: шлюз адресует `{ type: "user", id: message.chatId }`, как в Telegram и MAX.
|
|
458
|
+
if (recipient.type !== "avito" && recipient.type !== "user") {
|
|
458
459
|
throw new Error(`${transportId} sends Avito messages and cannot address ${recipient.type}`);
|
|
459
460
|
}
|
|
460
|
-
const chatId = recipient.chatId.trim();
|
|
461
|
+
const chatId = ("id" in recipient ? recipient.id : recipient.chatId).trim();
|
|
461
462
|
if (!chatId) throw new Error("Avito chatId must not be empty");
|
|
462
463
|
return chatId;
|
|
463
464
|
}
|