mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 07:04:50 -06:00
chore: update package-lock.json and refactor WhatsApp Baileys service
- Added new dependency `audio-decode` version 2.2.3. - Introduced `@eshaz/web-worker` version 1.2.2 with its metadata. - Refactored `userDevicesCache` initialization and various object destructuring for improved readability in `whatsapp.baileys.service.ts`. - Streamlined multiple object property assignments for better code clarity. - Removed deprecated `@typescript-eslint/project-service` and related packages from package-lock.json.
This commit is contained in:
parent
421e762c2d
commit
7cfc359be9
586
package-lock.json
generated
586
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -415,8 +415,9 @@ export class ChatwootService {
|
|||||||
|
|
||||||
let query: any;
|
let query: any;
|
||||||
const isGroup = phoneNumber.includes('@g.us');
|
const isGroup = phoneNumber.includes('@g.us');
|
||||||
|
const isLid = phoneNumber.includes('@lid');
|
||||||
|
|
||||||
if (!isGroup) {
|
if (!isGroup && !isLid) {
|
||||||
query = `+${phoneNumber}`;
|
query = `+${phoneNumber}`;
|
||||||
} else {
|
} else {
|
||||||
query = phoneNumber;
|
query = phoneNumber;
|
||||||
@ -424,7 +425,7 @@ export class ChatwootService {
|
|||||||
|
|
||||||
let contact: any;
|
let contact: any;
|
||||||
|
|
||||||
if (isGroup) {
|
if (isGroup || isLid) {
|
||||||
contact = await client.contacts.search({
|
contact = await client.contacts.search({
|
||||||
accountId: this.provider.accountId,
|
accountId: this.provider.accountId,
|
||||||
q: query,
|
q: query,
|
||||||
@ -444,7 +445,7 @@ export class ChatwootService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isGroup) {
|
if (!isGroup && !isLid) {
|
||||||
return contact.payload.length > 1 ? this.findContactInContactList(contact.payload, query) : contact.payload[0];
|
return contact.payload.length > 1 ? this.findContactInContactList(contact.payload, query) : contact.payload[0];
|
||||||
} else {
|
} else {
|
||||||
return contact.payload.find((contact) => contact.identifier === query);
|
return contact.payload.find((contact) => contact.identifier === query);
|
||||||
@ -594,12 +595,13 @@ export class ChatwootService {
|
|||||||
if (!client) return null;
|
if (!client) return null;
|
||||||
|
|
||||||
const isGroup = remoteJid.includes('@g.us');
|
const isGroup = remoteJid.includes('@g.us');
|
||||||
const chatId = isGroup ? remoteJid : remoteJid.split('@')[0];
|
const isLid = remoteJid.includes('@lid');
|
||||||
|
const chatId = isGroup || isLid ? remoteJid : remoteJid.split('@')[0];
|
||||||
let nameContact = !body.key.fromMe ? body.pushName : chatId;
|
let nameContact = !body.key.fromMe ? body.pushName : chatId;
|
||||||
const filterInbox = await this.getInbox(instance);
|
const filterInbox = await this.getInbox(instance);
|
||||||
if (!filterInbox) return null;
|
if (!filterInbox) return null;
|
||||||
|
|
||||||
if (isGroup) {
|
if (isGroup || isLid) {
|
||||||
this.logger.verbose(`Processing group conversation`);
|
this.logger.verbose(`Processing group conversation`);
|
||||||
const group = await this.waMonitor.waInstances[instance.instanceName].client.groupMetadata(chatId);
|
const group = await this.waMonitor.waInstances[instance.instanceName].client.groupMetadata(chatId);
|
||||||
this.logger.verbose(`Group metadata: ${JSON.stringify(group)}`);
|
this.logger.verbose(`Group metadata: ${JSON.stringify(group)}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user