mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 04:12:23 -06:00
Fix prettier errors
This commit is contained in:
@@ -330,13 +330,17 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
|
||||
const buffer = await axios.get(result.data.url, { headers, responseType: 'arraybuffer' });
|
||||
|
||||
const mediaType = message.messages[0].document
|
||||
? 'document'
|
||||
: message.messages[0].image
|
||||
? 'image'
|
||||
: message.messages[0].audio
|
||||
? 'audio'
|
||||
: 'video';
|
||||
let mediaType;
|
||||
|
||||
if (message.messages[0].document) {
|
||||
mediaType = 'document';
|
||||
} else if (message.messages[0].image) {
|
||||
mediaType = 'image';
|
||||
} else if (message.messages[0].audio) {
|
||||
mediaType = 'audio';
|
||||
} else {
|
||||
mediaType = 'video';
|
||||
}
|
||||
|
||||
const mimetype = result.data?.mime_type || result.headers['content-type'];
|
||||
|
||||
@@ -797,7 +801,7 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
}
|
||||
if (message['media']) {
|
||||
const isImage = message['mimetype']?.startsWith('image/');
|
||||
|
||||
|
||||
content = {
|
||||
messaging_product: 'whatsapp',
|
||||
recipient_type: 'individual',
|
||||
@@ -812,7 +816,7 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
};
|
||||
quoted ? (content.context = { message_id: quoted.id }) : content;
|
||||
return await this.post(content, 'messages');
|
||||
}
|
||||
}
|
||||
if (message['audio']) {
|
||||
content = {
|
||||
messaging_product: 'whatsapp',
|
||||
@@ -1100,11 +1104,10 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
|
||||
if (file?.buffer) {
|
||||
mediaData.audio = file.buffer.toString('base64');
|
||||
}
|
||||
else if(isURL(mediaData.audio)){
|
||||
mediaData.audio = mediaData.audio
|
||||
}
|
||||
else {
|
||||
} else if (isURL(mediaData.audio)) {
|
||||
// DO NOTHING
|
||||
// mediaData.audio = mediaData.audio;
|
||||
} else {
|
||||
console.error('El archivo no tiene buffer o file es undefined');
|
||||
throw new Error('File or buffer is undefined');
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ import { instanceSchema, webhookSchema } from '@validate/validate.schema';
|
||||
import { RequestHandler, Router } from 'express';
|
||||
|
||||
export class WebhookRouter extends RouterBroker {
|
||||
constructor(readonly configService: ConfigService, ...guards: RequestHandler[]) {
|
||||
constructor(
|
||||
readonly configService: ConfigService,
|
||||
...guards: RequestHandler[]
|
||||
) {
|
||||
super();
|
||||
this.router
|
||||
.post(this.routerPath('set'), ...guards, async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user