This commit is contained in:
Davidson Gomes 2024-03-27 15:05:00 -03:00
parent 73c003907b
commit 9f1003e94e
2 changed files with 19 additions and 2 deletions

View File

@ -472,7 +472,7 @@ export class BaileysStartupService extends WAStartupService {
if (this.localProxy.enabled) {
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
if (this.localProxy.proxy.host.includes('proxyscrape')) {
if (this.localProxy?.proxy?.host?.includes('proxyscrape')) {
try {
const response = await axios.get(this.localProxy.proxy.host);
const text = response.data;

View File

@ -663,6 +663,18 @@ export class WAStartupService {
};
}
private assertExchangeAsync = (channel, exchangeName, exchangeType, options) => {
return new Promise((resolve, reject) => {
channel.assertExchange(exchangeName, exchangeType, options, (error, ok) => {
if (error) {
reject(error);
} else {
resolve(ok);
}
});
});
};
public async sendDataWebhook<T = any>(event: Events, data: T, local = true) {
const webhookGlobal = this.configService.get<Webhook>('WEBHOOK');
const webhookLocal = this.localWebhook.events;
@ -687,7 +699,12 @@ export class WAStartupService {
if (Array.isArray(rabbitmqLocal) && rabbitmqLocal.includes(we)) {
const exchangeName = this.instanceName ?? 'evolution_exchange';
await amqp.assertExchange(exchangeName, 'topic', {
// await amqp.assertExchange(exchangeName, 'topic', {
// durable: true,
// autoDelete: false,
// });
await this.assertExchangeAsync(amqp, exchangeName, 'topic', {
durable: true,
autoDelete: false,
});