@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imessaging/avito",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Avito Messenger transport for imessaging",
5
5
  "keywords": [
6
6
  "avito",
@@ -454,10 +454,11 @@ export class AvitoTransport
454
454
  }
455
455
 
456
456
  function avitoChatId(transportId: string, recipient: MessageRecipient): string {
457
- if (recipient.type !== "avito") {
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
  }