|
|
|
@ -15,7 +15,7 @@ const { writeFile } = require('fs/promises');
|
|
|
|
|
const waEmitter = require('../emitter');
|
|
|
|
|
const serverConfig = require('../../config').server;
|
|
|
|
|
|
|
|
|
|
const { encodeJid, decodeJid, formatStatus, formatTimestamp, getFileExtension, uint8ArrayToBase64 } = require('./helper');
|
|
|
|
|
const { encodeJid, decodeJid, formatStatus, formatTimestamp, getFileExtension, uint8ArrayToBase64, isJidPersonal } = require('./helper');
|
|
|
|
|
const generateId = require('../../utils/generateId.util');
|
|
|
|
|
const NodeCache = require('node-cache');
|
|
|
|
|
const P = require('pino');
|
|
|
|
@ -84,7 +84,7 @@ const createWhatsApp = async phone => {
|
|
|
|
|
// 如果是群发(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);
|
|
|
|
|
const isPersonal = isJidPersonal(msg.key.remoteJid);
|
|
|
|
|
const conversationType = isPersonal ? 'individual' : 'group';
|
|
|
|
|
const isGroup = isJidGroup(msg.key.remoteJid);
|
|
|
|
|
let groupSubject = groupSubjectCache.get(msg.key.remoteJid);
|
|
|
|
@ -174,7 +174,7 @@ const createWhatsApp = async phone => {
|
|
|
|
|
// 如果是群发(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);
|
|
|
|
|
const isPersonal = isJidPersonal(msg.key.remoteJid);
|
|
|
|
|
const conversationType = isPersonal ? 'individual' : 'group';
|
|
|
|
|
|
|
|
|
|
const emitEventName = msg.key.fromMe ? 'message:updated' : 'message:received';
|
|
|
|
@ -224,7 +224,7 @@ const createWhatsApp = async phone => {
|
|
|
|
|
// 如果是群发(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);
|
|
|
|
|
const isPersonal = isJidPersonal(msg.key.remoteJid);
|
|
|
|
|
const conversationType = isPersonal ? 'individual' : 'group';
|
|
|
|
|
|
|
|
|
|
const msgDirection = msg.key.fromMe ? 'outbound' : 'inbound';
|
|
|
|
|