[core] ChatWoot - Album Message
fix #1405 closes devlikeapro/waha-plus#24 (cherry picked from bergpinheiro/waha-plus@947fc000bb) Thanks @bergpinheiro Co-authored-by: bergpinheiro <berg.pinheiro2009@gmail.com>
This commit is contained in:
1 parent
d60dfba90a
commit
3890071f77
21 files changed
+312
No files matched your search
@@ -28,6 +28,7 @@ import {
|
||||
ShareContactMessage,
|
||||
TextMessage,
|
||||
UnsupportedMessage,
|
||||
AlbumMessage,
|
||||
resolveProtoMessage,
|
||||
} from '@waha/apps/chatwoot/messages/to/chatwoot';
|
||||
import { EngineHelper } from '@waha/apps/chatwoot/waha';
|
||||
@@ -127,6 +128,12 @@ export class MessageAnyHandler extends MessageBaseHandler<WAMessage> {
|
||||
return msg;
|
||||
}
|
||||
|
||||
converter = new AlbumMessage(this.l);
|
||||
msg = await converter.convert(payload, protoMessage);
|
||||
if (msg) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
converter = new HasMediaWithNoMediaMessage(this.l, this.job);
|
||||
msg = await converter.convert(payload, protoMessage);
|
||||
if (msg) {
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
التفاصيل: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **تم استلام رسالة ألبوم**
|
||||
|
||||
{{#totalCount}}
|
||||
تم استلام ألبوم يحتوي على **{{totalCount}}** ملف وسائط.
|
||||
{{#expectedImageCount}}
|
||||
📸 صور: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 فيديوهات: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
سيتم تسليم ملفات الوسائط في الرسائل التالية.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **إعلان فيسبوك**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
বিস্তারিত: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **অ্যালবাম বার্তা প্রাপ্ত**
|
||||
|
||||
{{#totalCount}}
|
||||
**{{totalCount}}** মিডিয়া ফাইল সহ একটি অ্যালবাম প্রাপ্ত হয়েছে।
|
||||
{{#expectedImageCount}}
|
||||
📸 ছবি: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 ভিডিও: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
মিডিয়া ফাইলগুলি পরবর্তী বার্তাগুলিতে সরবরাহ করা হবে।
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **ফেসবুক বিজ্ঞাপন**
|
||||
|
||||
|
||||
@@ -492,6 +492,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Details: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Album-Nachricht Empfangen**
|
||||
|
||||
{{#totalCount}}
|
||||
Ein Album mit **{{totalCount}}** Mediendatei(en) erhalten.
|
||||
{{#expectedImageCount}}
|
||||
📸 Bilder: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Videos: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Die Mediendateien werden in den folgenden Nachrichten geliefert.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **FACEBOOK-ANZEIGE**
|
||||
|
||||
|
||||
@@ -285,6 +285,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Details: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Album Message Received**
|
||||
|
||||
{{#totalCount}}
|
||||
Received an album with **{{totalCount}}** media file(s).
|
||||
{{#expectedImageCount}}
|
||||
📸 Images: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Videos: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
The media files will be delivered in the following messages.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **FACEBOOK AD**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Detalles: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Mensaje de Álbum Recibido**
|
||||
|
||||
{{#totalCount}}
|
||||
Recibido un álbum con **{{totalCount}}** archivo(s) de medios.
|
||||
{{#expectedImageCount}}
|
||||
📸 Imágenes: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Videos: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Los archivos de medios se entregarán en los siguientes mensajes.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **ANUNCIO DE FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
جزئیات: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **پیام آلبوم دریافت شد**
|
||||
|
||||
{{#totalCount}}
|
||||
یک آلبوم با **{{totalCount}}** فایل رسانهای دریافت شد.
|
||||
{{#expectedImageCount}}
|
||||
📸 تصاویر: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 ویدیوها: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
فایلهای رسانهای در پیامهای بعدی تحویل داده خواهند شد.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **آگهی فیسبوک**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Détails: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Message d'Album Reçu**
|
||||
|
||||
{{#totalCount}}
|
||||
Reçu un album avec **{{totalCount}}** fichier(s) multimédia.
|
||||
{{#expectedImageCount}}
|
||||
📸 Images: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Vidéos: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Les fichiers multimédias seront livrés dans les messages suivants.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **PUBLICITÉ FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
פרטים: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **הודעת אלבום התקבלה**
|
||||
|
||||
{{#totalCount}}
|
||||
התקבל אלבום עם **{{totalCount}}** קובץ/קבצי מדיה.
|
||||
{{#expectedImageCount}}
|
||||
📸 תמונות: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 סרטונים: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
קבצי המדיה יועברו בהודעות הבאות.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **מודעת פייסבוק**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
विवरण: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **एल्बम संदेश प्राप्त हुआ**
|
||||
|
||||
{{#totalCount}}
|
||||
**{{totalCount}}** मीडिया फ़ाइल(ओं) वाला एक एल्बम प्राप्त हुआ।
|
||||
{{#expectedImageCount}}
|
||||
📸 छवियाँ: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 वीडियो: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
मीडिया फ़ाइलें अगले संदेशों में वितरित की जाएंगी।
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **फेसबुक विज्ञापन**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Detail: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Pesan Album Diterima**
|
||||
|
||||
{{#totalCount}}
|
||||
Menerima album dengan **{{totalCount}}** file media.
|
||||
{{#expectedImageCount}}
|
||||
📸 Gambar: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Video: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
File media akan dikirimkan dalam pesan berikutnya.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **IKLAN FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
ਵੇਰਵੇ: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **ਐਲਬਮ ਸੁਨੇਹਾ ਪ੍ਰਾਪਤ ਹੋਇਆ**
|
||||
|
||||
{{#totalCount}}
|
||||
**{{totalCount}}** ਮੀਡੀਆ ਫ਼ਾਈਲ(ਾਂ) ਵਾਲਾ ਇੱਕ ਐਲਬਮ ਪ੍ਰਾਪਤ ਹੋਇਆ।
|
||||
{{#expectedImageCount}}
|
||||
📸 ਤਸਵੀਰਾਂ: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 ਵੀਡੀਓ: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
ਮੀਡੀਆ ਫ਼ਾਈਲਾਂ ਅਗਲੇ ਸੁਨੇਹਿਆਂ ਵਿੱਚ ਵਿਤਰਿਤ ਕੀਤੀਆਂ ਜਾਣਗੀਆਂ।
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **ਫੇਸਬੁੱਕ ਵਿਗਿਆਪਨ**
|
||||
|
||||
|
||||
@@ -494,6 +494,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Detalhes: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Mensagem de Álbum Recebida**
|
||||
|
||||
{{#totalCount}}
|
||||
Recebido um álbum com **{{totalCount}}** arquivo(s) de mídia.
|
||||
{{#expectedImageCount}}
|
||||
📸 Imagens: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Vídeos: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Os arquivos de mídia serão entregues nas mensagens seguintes.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **ANÚNCIO DO FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Подробности: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Получено сообщение с альбомом**
|
||||
|
||||
{{#totalCount}}
|
||||
Получен альбом с **{{totalCount}}** медиафайлом(ами).
|
||||
{{#expectedImageCount}}
|
||||
📸 Изображений: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Видео: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Медиафайлы будут доставлены в следующих сообщениях.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **РЕКЛАМА FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Ayrıntılar: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Albüm Mesajı Alındı**
|
||||
|
||||
{{#totalCount}}
|
||||
**{{totalCount}}** medya dosyası içeren bir albüm alındı.
|
||||
{{#expectedImageCount}}
|
||||
📸 Resimler: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Videolar: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Medya dosyaları aşağıdaki mesajlarda teslim edilecek.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **FACEBOOK İLANI**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
Подробиці: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **Отримано повідомлення з альбомом**
|
||||
|
||||
{{#totalCount}}
|
||||
Отримано альбом з **{{totalCount}}** медіафайлом(ами).
|
||||
{{#expectedImageCount}}
|
||||
📸 Зображень: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 Відео: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
Медіафайли будуть доставлені в наступних повідомленнях.
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **РЕКЛАМА FACEBOOK**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
تفصیلات: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **البم پیغام موصول ہوا**
|
||||
|
||||
{{#totalCount}}
|
||||
**{{totalCount}}** میڈیا فائل(ز) کے ساتھ ایک البم موصول ہوا۔
|
||||
{{#expectedImageCount}}
|
||||
📸 تصاویر: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 ویڈیوز: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
میڈیا فائلیں اگلے پیغامات میں فراہم کی جائیں گی۔
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **فیس بک اشتہار**
|
||||
|
||||
|
||||
@@ -489,6 +489,21 @@ whatsapp.to.chatwoot.message.unsupported: |-
|
||||
|
||||
详情: [{{{details.text}}}]({{{details.url}}})
|
||||
|
||||
whatsapp.to.chatwoot.message.album: |-
|
||||
📷 **收到相册消息**
|
||||
|
||||
{{#totalCount}}
|
||||
收到一个包含 **{{totalCount}}** 个媒体文件的相册。
|
||||
{{#expectedImageCount}}
|
||||
📸 图片: **{{expectedImageCount}}**
|
||||
{{/expectedImageCount}}
|
||||
{{#expectedVideoCount}}
|
||||
🎥 视频: **{{expectedVideoCount}}**
|
||||
{{/expectedVideoCount}}
|
||||
|
||||
媒体文件将在以下消息中送达。
|
||||
{{/totalCount}}
|
||||
|
||||
whatsapp.to.chatwoot.message.facebook.ad: |-
|
||||
📢 **Facebook 广告**
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ export enum TKey {
|
||||
WA_TO_CW_MESSAGE_UNSUPPORTED = 'whatsapp.to.chatwoot.message.unsupported',
|
||||
WA_TO_CW_MESSAGE_FACEBOOK_AD = 'whatsapp.to.chatwoot.message.facebook.ad',
|
||||
WA_TO_CW_MESSAGE_LIST = 'whatsapp.to.chatwoot.message.list',
|
||||
WA_TO_CW_MESSAGE_ALBUM = 'whatsapp.to.chatwoot.message.album',
|
||||
|
||||
//
|
||||
// App Inbox
|
||||
@@ -189,6 +190,11 @@ export type TemplatePayloads = {
|
||||
payload: WAMessage;
|
||||
adData: FacebookAdTemplateData;
|
||||
};
|
||||
[TKey.WA_TO_CW_MESSAGE_ALBUM]: {
|
||||
expectedImageCount: number;
|
||||
expectedVideoCount: number;
|
||||
totalCount: number;
|
||||
};
|
||||
[TKey.JOB_SCHEDULED_ERROR_HEADER]: void;
|
||||
[TKey.JOB_REPORT_ERROR]: {
|
||||
header: string;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Locale } from '@waha/apps/chatwoot/i18n/locale';
|
||||
import { TKey } from '@waha/apps/chatwoot/i18n/templates';
|
||||
import { ChatWootMessagePartial } from '@waha/apps/chatwoot/consumers/waha/base';
|
||||
import { isEmptyString } from './utils/proto';
|
||||
import * as lodash from 'lodash';
|
||||
import type { proto } from '@adiwajshing/baileys';
|
||||
import { WAMessage } from '@waha/structures/responses.dto';
|
||||
import { MessageToChatWootConverter } from '@waha/apps/chatwoot/messages/to/chatwoot';
|
||||
|
||||
export class AlbumMessage implements MessageToChatWootConverter {
|
||||
constructor(private readonly locale: Locale) {}
|
||||
|
||||
convert(
|
||||
payload: WAMessage,
|
||||
protoMessage: proto.Message | null,
|
||||
): ChatWootMessagePartial | null {
|
||||
// Check if it's an album message
|
||||
const isAlbumMessage =
|
||||
payload._data?.Info?.MediaType === 'collection' ||
|
||||
!lodash.isEmpty(protoMessage?.albumMessage);
|
||||
|
||||
if (!isAlbumMessage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract album information
|
||||
const albumInfo = protoMessage?.albumMessage;
|
||||
const expectedImageCount = albumInfo?.expectedImageCount || 0;
|
||||
const expectedVideoCount = albumInfo?.expectedVideoCount || 0;
|
||||
|
||||
const content = this.locale.key(TKey.WA_TO_CW_MESSAGE_ALBUM).r({
|
||||
expectedImageCount,
|
||||
expectedVideoCount,
|
||||
totalCount: expectedImageCount + expectedVideoCount,
|
||||
});
|
||||
|
||||
return {
|
||||
content,
|
||||
attachments: [],
|
||||
private: undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ export { PollMessage } from './PollMessage';
|
||||
export { EventMessage } from './EventMessage';
|
||||
export { PixMessage } from './PixMessage';
|
||||
export { ListMessage } from './ListMessage';
|
||||
export { AlbumMessage } from './AlbumMessage';
|
||||
|
||||
export type Awaitable<T> = T | Promise<T>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user