mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 04:12:23 -06:00
Merge branch 'ev2' into v2.0.0
This commit is contained in:
@@ -16,4 +16,5 @@ export class ChatwootDto {
|
||||
autoCreate?: boolean;
|
||||
organization?: string;
|
||||
logo?: string;
|
||||
ignoreJids?: string[];
|
||||
}
|
||||
|
||||
@@ -1738,6 +1738,36 @@ export class ChatwootService {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (this.provider?.ignoreJids && this.provider?.ignoreJids.length > 0) {
|
||||
const ignoreJids: any = this.provider?.ignoreJids;
|
||||
|
||||
let ignoreGroups = false;
|
||||
let ignoreContacts = false;
|
||||
|
||||
if (ignoreJids.includes('@g.us')) {
|
||||
ignoreGroups = true;
|
||||
}
|
||||
|
||||
if (ignoreJids.includes('@s.whatsapp.net')) {
|
||||
ignoreContacts = true;
|
||||
}
|
||||
|
||||
if (ignoreGroups && body?.key?.remoteJid.endsWith('@g.us')) {
|
||||
this.logger.warn('Ignoring message from group: ' + body?.key?.remoteJid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ignoreContacts && body?.key?.remoteJid.endsWith('@s.whatsapp.net')) {
|
||||
this.logger.warn('Ignoring message from contact: ' + body?.key?.remoteJid);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ignoreJids.includes(body?.key?.remoteJid)) {
|
||||
this.logger.warn('Ignoring message from jid: ' + body?.key?.remoteJid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event === 'contact.is_not_in_wpp') {
|
||||
const getConversation = await this.createConversation(instance, body);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ export const chatwootSchema: JSONSchema7 = {
|
||||
mergeBrazilContacts: { type: 'boolean', enum: [true, false] },
|
||||
importMessages: { type: 'boolean', enum: [true, false] },
|
||||
daysLimitImportMessages: { type: 'number' },
|
||||
ignoreJids: { type: 'array', items: { type: 'string' } },
|
||||
},
|
||||
required: ['enabled', 'accountId', 'token', 'url', 'signMsg', 'reopenConversation', 'conversationPending'],
|
||||
...isNotEmpty('enabled', 'accountId', 'token', 'url', 'signMsg', 'reopenConversation', 'conversationPending'),
|
||||
|
||||
Reference in New Issue
Block a user