Skip to content

Commit

Permalink
fix: Fixed sendFile function
Browse files Browse the repository at this point in the history
  • Loading branch information
moskoweb committed Jun 20, 2023
1 parent ea55c19 commit 3d30923
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/controller/messageController.ts
Expand Up @@ -126,6 +126,8 @@ export async function sendFile(req: Request, res: Response) {
*/
const { phone, path, base64, filename = 'file', message, caption } = req.body;

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

if (!path && !req.file && !base64)
return res.status(401).send({
message: 'Sending the file is mandatory',
Expand All @@ -136,11 +138,12 @@ export async function sendFile(req: Request, res: Response) {

try {
const results: any = [];
for (const contato of phone) {
for (const contact of phone) {
results.push(
await req.client.sendFile(contato, pathFile, {
await req.client.sendFile(contact, pathFile, {
filename: filename,
caption: msg,
...options,
})
);
}
Expand Down

0 comments on commit 3d30923

Please sign in to comment.