This commit is contained in:
Davidson Gomes 2024-03-08 12:58:23 -03:00
parent bd09328ec2
commit a81f5953fc
2 changed files with 149 additions and 154 deletions

View File

@ -67,11 +67,11 @@ export const initQueues = (instanceName: string, events: string[]) => {
const amqp = getAMQP();
const rabbitMode = rabbitConfig.MODE || 'isolated';
const exchangeName = rabbitConfig.EXCHANGE_NAME ?? 'evolution_exchange';
let exchangeName = rabbitConfig.EXCHANGE_NAME ?? 'evolution_exchange';
const receivedEvents = events.map(parseEvtName);
if (rabbitMode === 'isolated') {
// exchangeName = instanceName ?? 'evolution_exchange';
exchangeName = instanceName ?? 'evolution_exchange';
receivedEvents.forEach((event) => {
amqp.assertExchange(exchangeName, 'topic', {
@ -196,8 +196,8 @@ interface SendEventData {
export const sendEventData = ({ data, event, wuid, apiKey, instanceName }: SendEventData) => {
const rabbitConfig = configService.get<Rabbitmq>('RABBITMQ');
const rabbitMode = rabbitConfig.MODE || 'isolated';
const exchangeName = rabbitConfig.EXCHANGE_NAME ?? 'evolution_exchange';
// if (rabbitMode === 'isolated') exchangeName = instanceName ?? 'evolution_exchange';
let exchangeName = rabbitConfig.EXCHANGE_NAME ?? 'evolution_exchange';
if (rabbitMode === 'isolated') exchangeName = instanceName ?? 'evolution_exchange';
console.log('exchangeName: ', exchangeName);
console.log('rabbitMode: ', rabbitMode);

View File

@ -936,14 +936,9 @@ export class BaileysStartupService extends WAStartupService {
) => {
try {
this.logger.verbose('Event received: messages.upsert');
const received = messages[0];
// for (const received of messages) {
for (const received of messages) {
if (
// (type !== 'notify' && type !== 'append') ||
type !== 'notify' ||
!received?.message ||
(type !== 'notify' && type !== 'append') ||
received.message?.protocolMessage ||
received.message?.pollUpdateMessage
) {
@ -1111,7 +1106,7 @@ export class BaileysStartupService extends WAStartupService {
this.logger.verbose('Inserting contact in database');
this.repository.contact.insert([contactRaw], this.instance.name, database.SAVE_DATA.CONTACTS);
// }
}
} catch (error) {
this.logger.error(error);
}