Skip to content

Commit

Permalink
fix: Fixed caption for WPP.chat.sendFileMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Apr 26, 2022
1 parent 664d04b commit d2f370b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/chat/functions/sendFileMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ export async function sendFileMessage(
? await assertFindChat(chatId)
: assertGetChat(chatId);

const file = await convertToFile(content, options.mimetype, options.filename);
const file = await convertToFile(
content,
options.mimetype,
options.caption || options.filename
);

const filename = file.name;

const opaqueData = await OpaqueData.createFromData(file, file.type);

Expand Down Expand Up @@ -200,7 +206,8 @@ export async function sendFileMessage(
let rawMessage = await prepareRawMessage<RawMessage>(
chat,
{
caption: options.caption,
caption: filename,
filename: filename,
},
options
);
Expand Down

0 comments on commit d2f370b

Please sign in to comment.