Skip to content

Commit

Permalink
fix(message): fix depercated sendFileFromBase64 (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saifallak committed Jun 30, 2022
1 parent 7c0091f commit 49d9152
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controller/messageController.js
Expand Up @@ -92,14 +92,16 @@ export async function sendFile(req, res) {
}

export async function sendFile64(req, res) {
const { base64, phone, filename = 'file', message } = req.body;
const { base64, phone } = req.body;

if (!base64) return res.status(401).send({ message: 'The base64 of the file was not informed' });

const options = req.body.options || {};

try {
let results = [];
for (const contato of phone) {
results.push(await req.client.sendFileFromBase64(contato, base64, filename, message));
results.push(await req.client.sendFile(contato, base64, options));
}

if (results.length === 0) return res.status(400).json('Error sending message');
Expand Down

0 comments on commit 49d9152

Please sign in to comment.