fix: optimize send message from group with mentions

This commit is contained in:
Davidson Gomes 2023-07-13 20:12:29 -03:00
parent 16d03d20ac
commit 1c5ae4eb4d

View File

@ -98,11 +98,11 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
if (!id) { if (!id) {
throw new Error('id is required'); console.log('id is required');
} }
const contact = await client.contact.getContactable({ const contact = await client.contact.getContactable({
@ -126,7 +126,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
const findInbox: any = await client.inboxes.list({ const findInbox: any = await client.inboxes.list({
@ -208,7 +208,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
let data: any = {}; let data: any = {};
@ -241,11 +241,11 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
if (!id) { if (!id) {
throw new Error('id is required'); console.log('id is required');
} }
const contact = await client.contacts.update({ const contact = await client.contacts.update({
@ -261,7 +261,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
let query: any; let query: any;
@ -289,7 +289,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
const isGroup = body.key.remoteJid.includes('@g.us'); const isGroup = body.key.remoteJid.includes('@g.us');
@ -371,7 +371,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
const inbox = (await client.inboxes.list({ const inbox = (await client.inboxes.list({
@ -610,7 +610,7 @@ export class ChatwootService {
return; return;
} catch (error) { } catch (error) {
throw new Error(error); console.log(error);
} }
} }
@ -803,7 +803,7 @@ export class ChatwootService {
const client = await this.clientCw(instance); const client = await this.clientCw(instance);
if (!client) { if (!client) {
throw new Error('client not found'); console.log('client not found');
} }
const waInstance = this.waMonitor.waInstances[instance.instanceName]; const waInstance = this.waMonitor.waInstances[instance.instanceName];