mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 20:12:02 -06:00
eovlution_api_hotfix_id_group
This commit is contained in:
parent
16a9d1faf5
commit
1b1eb0356a
@ -2,7 +2,7 @@ services:
|
||||
api:
|
||||
container_name: evolution_api_${ENVIROMNENT}
|
||||
build: .
|
||||
image: adaptweb/evolution-api:1.7.0
|
||||
image: adaptweb/evolution-api:1.7.1
|
||||
restart: always
|
||||
depends_on:
|
||||
- redis
|
||||
|
@ -236,7 +236,7 @@ export class InstanceController {
|
||||
autoCreate: instanceData.chatwootAutoCreate !== false,
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.log(error);
|
||||
//this.logger.log(error);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -173,7 +173,7 @@ export class EvolutionStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
//this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
|
||||
|
||||
@ -498,7 +498,7 @@ export class EvolutionStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
// this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.SEND_MESSAGE, messageRaw);
|
||||
|
||||
|
@ -514,7 +514,7 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
//this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
|
||||
|
||||
@ -953,7 +953,7 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
source: 'unknown',
|
||||
};
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
// this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.SEND_MESSAGE, messageRaw);
|
||||
|
||||
|
@ -1306,17 +1306,17 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
if (received.key.fromMe === false) {
|
||||
if (msg.status === status[3]) {
|
||||
this.logger.log(`Update not read messages ${received.key.remoteJid}`);
|
||||
// this.logger.log(`Update not read messages ${received.key.remoteJid}`);
|
||||
|
||||
await this.updateChatUnreadMessages(received.key.remoteJid);
|
||||
} else if (msg.status === status[4]) {
|
||||
this.logger.log(`Update readed messages ${received.key.remoteJid} - ${msg.messageTimestamp}`);
|
||||
// this.logger.log(`Update readed messages ${received.key.remoteJid} - ${msg.messageTimestamp}`);
|
||||
|
||||
await this.updateMessagesReadedByTimestamp(received.key.remoteJid, msg.messageTimestamp);
|
||||
}
|
||||
} else {
|
||||
// is send message by me
|
||||
this.logger.log(`Update readed messages ${received.key.remoteJid} - ${msg.messageTimestamp}`);
|
||||
//this.logger.log(`Update readed messages ${received.key.remoteJid} - ${msg.messageTimestamp}`);
|
||||
|
||||
await this.updateMessagesReadedByTimestamp(received.key.remoteJid, msg.messageTimestamp);
|
||||
}
|
||||
@ -1413,7 +1413,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
//this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
|
||||
|
||||
@ -1484,7 +1484,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
},
|
||||
|
||||
'messages.update': async (args: WAMessageUpdate[], settings: any) => {
|
||||
this.logger.log(`Update messages ${JSON.stringify(args, undefined, 2)}`);
|
||||
//this.logger.log(`Update messages ${JSON.stringify(args, undefined, 2)}`);
|
||||
|
||||
const readChatToUpdate: Record<string, true> = {}; // {remoteJid: true}
|
||||
|
||||
@ -1587,7 +1587,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
readChatToUpdate[key.remoteJid] = true;
|
||||
|
||||
if (status[update.status] === status[4]) {
|
||||
this.logger.log(`Update as read ${key.remoteJid} - ${findMessage.messageTimestamp}`);
|
||||
//this.logger.log(`Update as read ${key.remoteJid} - ${findMessage.messageTimestamp}`);
|
||||
this.updateMessagesReadedByTimestamp(key.remoteJid, findMessage.messageTimestamp);
|
||||
}
|
||||
}
|
||||
@ -2398,7 +2398,7 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.log(messageRaw);
|
||||
//this.logger.log(messageRaw);
|
||||
|
||||
this.sendDataWebhook(Events.SEND_MESSAGE, messageRaw);
|
||||
|
||||
@ -3382,7 +3382,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
broadcast: [],
|
||||
users: [],
|
||||
};
|
||||
|
||||
data.numbers.forEach((number) => {
|
||||
const jid = createJid(number);
|
||||
|
||||
@ -4252,7 +4251,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
public async findGroup(id: GroupJid, reply: 'inner' | 'out' = 'out') {
|
||||
try {
|
||||
const group = await this.client.groupMetadata(id.groupJid);
|
||||
|
||||
if (!group) {
|
||||
this.logger.error('Group not found');
|
||||
return null;
|
||||
|
@ -109,7 +109,7 @@ export class ChatbotController {
|
||||
) {
|
||||
if (userMessageDebounce[remoteJid]) {
|
||||
userMessageDebounce[remoteJid].message += `\n${content}`;
|
||||
this.logger.log('message debounced: ' + userMessageDebounce[remoteJid].message);
|
||||
//this.logger.log('message debounced: ' + userMessageDebounce[remoteJid].message);
|
||||
clearTimeout(userMessageDebounce[remoteJid].timeoutId);
|
||||
} else {
|
||||
userMessageDebounce[remoteJid] = {
|
||||
@ -120,7 +120,7 @@ export class ChatbotController {
|
||||
|
||||
userMessageDebounce[remoteJid].timeoutId = setTimeout(() => {
|
||||
const myQuestion = userMessageDebounce[remoteJid].message;
|
||||
this.logger.log('Debounce complete. Processing message: ' + myQuestion);
|
||||
// this.logger.log('Debounce complete. Processing message: ' + myQuestion);
|
||||
|
||||
delete userMessageDebounce[remoteJid];
|
||||
callback(myQuestion);
|
||||
|
@ -110,7 +110,7 @@ export class ChatwootService {
|
||||
await this.waMonitor.waInstances[instance.instanceName].setChatwoot(data);
|
||||
|
||||
if (data.autoCreate) {
|
||||
this.logger.log('Auto create chatwoot instance');
|
||||
//this.logger.log('Auto create chatwoot instance');
|
||||
const urlServer = this.configService.get<HttpServer>('SERVER').URL;
|
||||
|
||||
await this.initInstanceChatwoot(
|
||||
@ -185,7 +185,7 @@ export class ChatwootService {
|
||||
|
||||
let inboxId: number;
|
||||
|
||||
this.logger.log('Creating chatwoot inbox');
|
||||
//this.logger.log('Creating chatwoot inbox');
|
||||
if (!checkDuplicate) {
|
||||
const data = {
|
||||
type: 'api',
|
||||
@ -216,15 +216,15 @@ export class ChatwootService {
|
||||
|
||||
inboxId = inbox.id;
|
||||
}
|
||||
this.logger.log(`Inbox created - inboxId: ${inboxId}`);
|
||||
//this.logger.log(`Inbox created - inboxId: ${inboxId}`);
|
||||
|
||||
if (!this.configService.get<Chatwoot>('CHATWOOT').BOT_CONTACT) {
|
||||
this.logger.log('Chatwoot bot contact is disabled');
|
||||
// this.logger.log('Chatwoot bot contact is disabled');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
this.logger.log('Creating chatwoot bot contact');
|
||||
//this.logger.log('Creating chatwoot bot contact');
|
||||
const contact =
|
||||
(await this.findContact(instance, '123456')) ||
|
||||
((await this.createContact(
|
||||
@ -242,10 +242,10 @@ export class ChatwootService {
|
||||
}
|
||||
|
||||
const contactId = contact.id || contact.payload.contact.id;
|
||||
this.logger.log(`Contact created - contactId: ${contactId}`);
|
||||
//this.logger.log(`Contact created - contactId: ${contactId}`);
|
||||
|
||||
if (qrcode) {
|
||||
this.logger.log('QR code enabled');
|
||||
//this.logger.log('QR code enabled');
|
||||
const data = {
|
||||
contact_id: contactId.toString(),
|
||||
inbox_id: inboxId.toString(),
|
||||
@ -280,7 +280,7 @@ export class ChatwootService {
|
||||
this.logger.warn('conversation not found');
|
||||
return null;
|
||||
}
|
||||
this.logger.log('Init message sent');
|
||||
// this.logger.log('Init message sent');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1005,7 +1005,7 @@ export class ChatwootService {
|
||||
}
|
||||
|
||||
if (!this.configService.get<Chatwoot>('CHATWOOT').BOT_CONTACT) {
|
||||
this.logger.log('Chatwoot bot contact is disabled');
|
||||
// this.logger.log('Chatwoot bot contact is disabled');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ export class PusherController extends EventController implements EventController
|
||||
const pusherLocalEvents = instance.events;
|
||||
if (Array.isArray(pusherLocalEvents) && pusherLocalEvents.includes(we)) {
|
||||
if (enabledLog) {
|
||||
this.logger.log({
|
||||
/* this.logger.log({
|
||||
local: `${origin}.sendData-Pusher`,
|
||||
appId: instance.appId,
|
||||
...pusherData,
|
||||
});
|
||||
}); */
|
||||
}
|
||||
try {
|
||||
const pusher = this.pusherClients[instanceName];
|
||||
@ -188,11 +188,11 @@ export class PusherController extends EventController implements EventController
|
||||
const globalEvents = this.pusherConfig.EVENTS;
|
||||
if (globalEvents[we]) {
|
||||
if (enabledLog) {
|
||||
this.logger.log({
|
||||
/* this.logger.log({
|
||||
local: `${origin}.sendData-Pusher-Global`,
|
||||
appId: this.pusherConfig.GLOBAL?.APP_ID,
|
||||
...pusherData,
|
||||
});
|
||||
}); */
|
||||
}
|
||||
try {
|
||||
if (this.globalPusherClient) {
|
||||
|
@ -190,13 +190,13 @@ export class WebhookController extends EventController implements EventControlle
|
||||
while (attempts < maxRetries) {
|
||||
try {
|
||||
await httpService.post('', webhookData);
|
||||
if (attempts > 0) {
|
||||
/* if (attempts > 0) {
|
||||
this.logger.log({
|
||||
local: `${origin}`,
|
||||
message: `Sucesso no envio após ${attempts + 1} tentativas`,
|
||||
url: baseURL,
|
||||
});
|
||||
}
|
||||
} */
|
||||
return;
|
||||
} catch (error) {
|
||||
attempts++;
|
||||
|
@ -148,12 +148,12 @@ export class WebsocketController extends EventController implements EventControl
|
||||
this.socket.of(`/${instanceName}`).emit(event, message);
|
||||
|
||||
if (logEnabled) {
|
||||
this.logger.log({ local: `${origin}.sendData-Websocket`, ...message });
|
||||
// this.logger.log({ local: `${origin}.sendData-Websocket`, ...message });
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (logEnabled) {
|
||||
this.logger.log(err);
|
||||
// this.logger.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export function createJid(number: string): string {
|
||||
.split(':')[0]
|
||||
.split('@')[0];
|
||||
|
||||
if (number.includes('-') && number.length >= 24) {
|
||||
if (number.includes('-') && number.length >= 23) {
|
||||
number = number.replace(/[^\d-]/g, '');
|
||||
return `${number}@g.us`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user