mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
Merge pull request #348 from w3nder/master
Fix bug SendWhatsAppMedia mustache body null
This commit is contained in:
@@ -19,13 +19,16 @@ const SendWhatsAppMedia = async ({
|
||||
}: Request): Promise<WbotMessage> => {
|
||||
try {
|
||||
const wbot = await GetTicketWbot(ticket);
|
||||
const hasBody = body
|
||||
? formatBody(body as string, ticket.contact)
|
||||
: undefined;
|
||||
|
||||
const newMedia = MessageMedia.fromFilePath(media.path);
|
||||
const sentMessage = await wbot.sendMessage(
|
||||
`${ticket.contact.number}@${ticket.isGroup ? "g" : "c"}.us`,
|
||||
newMedia,
|
||||
{
|
||||
caption: formatBody(body as string, ticket.contact),
|
||||
caption: hasBody,
|
||||
sendAudioAsVoice: true
|
||||
}
|
||||
);
|
||||
@@ -36,6 +39,7 @@ const SendWhatsAppMedia = async ({
|
||||
|
||||
return sentMessage;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
throw new AppError("ERR_SENDING_WAPP_MSG");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user