From 119c7d073983910a0e19d1a347c13c33037cc156 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Fri, 17 Jan 2025 10:02:32 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20WA-log=20=E4=B8=8D=E5=8A=A0=20channelId?= =?UTF-8?q?,=20QR=20=E4=BA=8B=E4=BB=B6=E5=90=8D=E5=AD=97=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wai-server/core/baileys/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wai-server/core/baileys/index.js b/wai-server/core/baileys/index.js index c087f39..120eafa 100644 --- a/wai-server/core/baileys/index.js +++ b/wai-server/core/baileys/index.js @@ -30,7 +30,7 @@ const createWhatsApp = async phone => { const externalIdCache = new NodeCache({ stdTTL: 60*5 }); // 缓存群信息,过期时间为 24 小时 const groupSubjectCache = new NodeCache({ stdTTL: 60*60*24 }); - const logger = P({ timestamp: () => `,"time":"${new Date().toJSON()}"` }, P.destination('./logs/wa-logs-' + phone + '_' + channelId + '.txt')); + const logger = P({ timestamp: () => `,"time":"${new Date().toJSON()}"` }, P.destination('./logs/wa-logs-' + phone + '.txt')); logger.level = 'trace'; const msgRetryCounterCache = new NodeCache(); const storeFilename = './baileys_auth_info/baileys_store_' + phone + '.json' @@ -81,7 +81,7 @@ const createWhatsApp = async phone => { if (isJidStatusBroadcast(msg.key.remoteJid)) continue; const messageType = Object.keys(msg.message)[0]; - // 如果是群发(status@broadcast),participant 是发送人,不然则是 remoteJid + // 如果是群发(xxx@broadcast),participant 是发送人,不然则是 remoteJid const remoteNo = isJidBroadcast(msg.key.remoteJid) ? decodeJid(msg.key.participant) : decodeJid(msg.key.remoteJid); const externalId = externalIdCache.get(msg.key.id); const isPersonal = isJidUser(msg.key.remoteJid) || isJidBroadcast(msg.key.remoteJid); @@ -171,7 +171,7 @@ const createWhatsApp = async phone => { for (const msg of upsert.messages) { if (msg.message?.conversation || msg.message?.extendedTextMessage?.text) { const text = msg.message?.conversation || msg.message?.extendedTextMessage?.text; - // 如果是群发(status@broadcast),participant 是发送人,不然则是 remoteJid + // 如果是群发(xxx@broadcast),participant 是发送人,不然则是 remoteJid const remoteNo = isJidBroadcast(msg.key.remoteJid) ? decodeJid(msg.key.participant) : decodeJid(msg.key.remoteJid); const externalId = externalIdCache.get(msg.key.id); const isPersonal = isJidUser(msg.key.remoteJid) || isJidBroadcast(msg.key.remoteJid); @@ -221,7 +221,7 @@ const createWhatsApp = async phone => { if (ignore) continue; - // 如果是群发(status@broadcast),participant 是发送人,不然则是 remoteJid + // 如果是群发(xxx@broadcast),participant 是发送人,不然则是 remoteJid const remoteNo = isJidBroadcast(msg.key.remoteJid) ? decodeJid(msg.key.participant) : decodeJid(msg.key.remoteJid); const externalId = externalIdCache.get(msg.key.id); const isPersonal = isJidUser(msg.key.remoteJid) || isJidBroadcast(msg.key.remoteJid); @@ -318,8 +318,7 @@ const createWhatsApp = async phone => { waEmitter.emit('creds:update', { id: generateId(), qr, whatsAppNo, - server:serverConfig.name, - eventSource: 'creds.update', + eventSource: serverConfig.name + '.connection.update.qr', createTime: formatTimestamp(new Date().getTime() / 1000), }); } else {