feat: webhook base64 option

This commit is contained in:
Davidson Gomes 2023-10-05 15:57:53 -03:00
parent 547943a05c
commit e26ae30f6f
2 changed files with 5 additions and 4 deletions

View File

@ -97,7 +97,6 @@ WEBHOOK:
WEBHOOK_BY_EVENTS: false
# Automatically maps webhook paths
# Set the events you want to hear
WEBHOOK_BASE64: false
EVENTS:
APPLICATION_STARTUP: false
QRCODE_UPDATED: true

View File

@ -279,7 +279,6 @@ export class WAStartupService {
this.localWebhook.webhook_base64 = data?.webhook_base64;
this.logger.verbose(`Webhook by webhook_base64: ${this.localWebhook.webhook_base64}`);
this.logger.verbose('Webhook loaded');
}
@ -1533,8 +1532,11 @@ export class WAStartupService {
}
let messageRaw: MessageRaw;
const globalWebhook = this.configService.get<Webhook>('WEBHOOK').GLOBAL;
if (this.localWebhook.webhook_base64 === true && received?.message.documentMessage || received?.message.imageMessage ) {
if (
(this.localWebhook.webhook_base64 === true && received?.message.documentMessage) ||
received?.message.imageMessage
) {
const buffer = await downloadMediaMessage(
{ key: received.key, message: received?.message },
'buffer',