mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-26 10:28:38 -06:00
filter chat.update for ignored contacts
This commit is contained in:
parent
6003297bcf
commit
ba39283a05
@ -867,7 +867,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
'contacts.update': async (contacts: Partial<Contact>[], database: Database) => {
|
'contacts.update': async (contacts: Partial<Contact>[], database: Database) => {
|
||||||
this.logger.verbose('Event received: contacts.update');
|
this.logger.verbose('Event received: contacts.update');
|
||||||
this.logger.info('THIS IS WHEN CONTACTS ARE UPDATED ON DATABASE' + JSON.stringify(contacts))
|
this.logger.info('THIS IS WHEN CONTACTS ARE UPDATED ON DATABASE' + JSON.stringify(contacts));
|
||||||
|
|
||||||
this.logger.verbose('Verifying if contacts exists in database to update');
|
this.logger.verbose('Verifying if contacts exists in database to update');
|
||||||
const contactsRaw: ContactRaw[] = [];
|
const contactsRaw: ContactRaw[] = [];
|
||||||
@ -1575,8 +1575,12 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
|
|
||||||
if (events['chats.update']) {
|
if (events['chats.update']) {
|
||||||
this.logger.verbose('Listening event: chats.update');
|
this.logger.verbose('Listening event: chats.update');
|
||||||
const payload = events['chats.update'];
|
const payload = events['chats.update'].filter(
|
||||||
this.chatHandle['chats.update'](payload);
|
(x) => !settings.ignore_list || !settings.ignore_list.includes(x['id']),
|
||||||
|
);
|
||||||
|
if (payload.length > 0) {
|
||||||
|
this.chatHandle['chats.update'](payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (events['chats.delete']) {
|
if (events['chats.delete']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user