From 01b09d301787169814d0c63f606783add98b3358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3nalan=20de=20Lima?= Date: Wed, 20 Jul 2022 20:20:11 -0300 Subject: [PATCH] fix: resolve sendMessage --- README.md | 3 +-- src/webpack/api/layes/sender.layes.ts | 38 ++++++++++++++------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0fba8f4..8b8aad2 100644 --- a/README.md +++ b/README.md @@ -470,7 +470,7 @@ await client.sendImage("0000000000@c.us", './file.jpg') const contacts = await client.getAllContacts(); ``` -## Retrieving Data +## Group Management Group number example `-@g.us` or `@g.us` @@ -502,7 +502,6 @@ await client.setGroupDescription('00000000-000000@g.us', 'group description') ``` - ### Debugging Building the hydra-bot is very simple diff --git a/src/webpack/api/layes/sender.layes.ts b/src/webpack/api/layes/sender.layes.ts index aea6e03..8c10e0a 100644 --- a/src/webpack/api/layes/sender.layes.ts +++ b/src/webpack/api/layes/sender.layes.ts @@ -282,46 +282,48 @@ export class SenderLayer extends RetrieverLayer { }); } - if (options.type === FunctionType.sendFile || options.type === FunctionType.sendImage) { + if ( + options.type === FunctionType.sendFile || + options.type === FunctionType.sendImage + ) { this.sendFile(to, body, options) - .then((e) => { - return reject(e); - }) - .catch((e) => { + .then((e: any) => { return resolve(e); + }) + .catch((e: any) => { + return reject(e); }); } if (options.type === FunctionType.sendAudioBase64) { this.sendAudioBase64(to, body, options) - .then((e) => { - return reject(e); - }) - .catch((e) => { + .then((e: any) => { return resolve(e); + }) + .catch((e: any) => { + return reject(e); }); } if (options.type === FunctionType.sendAudio) { this.sendAudio(to, body, options) - .then((e) => { - return reject(e); - }) - .catch((e) => { + .then((e: any) => { return resolve(e); + }) + .catch((e: any) => { + return reject(e); }); } if (options.type === FunctionType.sendText) { this.sendText(to, body, options) - .then((e) => { - return reject(e); - }) - .catch((e) => { + .then((e: any) => { return resolve(e); + }) + .catch((e: any) => { + return reject(e); }); } }); } - }