@rubytech/create-maxy 1.0.675 → 1.0.676
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/server/server.js +17 -2
package/package.json
CHANGED
package/payload/server/server.js
CHANGED
|
@@ -14894,6 +14894,12 @@ function storeMessage(storeKey, entry) {
|
|
|
14894
14894
|
console.error(`${TAG13} message store trimmed for ${storeKey}: ${trimmed} oldest messages removed`);
|
|
14895
14895
|
}
|
|
14896
14896
|
}
|
|
14897
|
+
function deriveSessionKey(input) {
|
|
14898
|
+
if (input.isOwnerMirror || input.agentType === "admin") {
|
|
14899
|
+
return `whatsapp:${input.accountId}`;
|
|
14900
|
+
}
|
|
14901
|
+
return `whatsapp:${input.accountId}:${input.senderPhone}`;
|
|
14902
|
+
}
|
|
14897
14903
|
async function init(opts) {
|
|
14898
14904
|
if (initialized) {
|
|
14899
14905
|
console.error(`${TAG13} already initialized`);
|
|
@@ -15359,7 +15365,12 @@ async function handleInboundMessage(conn, msg) {
|
|
|
15359
15365
|
isGroup: isGroup2,
|
|
15360
15366
|
groupJid: isGroup2 ? remoteJid : void 0,
|
|
15361
15367
|
reply: reply2,
|
|
15362
|
-
sessionKey:
|
|
15368
|
+
sessionKey: deriveSessionKey({
|
|
15369
|
+
agentType: "admin",
|
|
15370
|
+
accountId: conn.accountId,
|
|
15371
|
+
senderPhone: senderPhone2,
|
|
15372
|
+
isOwnerMirror: true
|
|
15373
|
+
}),
|
|
15363
15374
|
isOwnerMirror: true
|
|
15364
15375
|
});
|
|
15365
15376
|
return;
|
|
@@ -15438,7 +15449,11 @@ async function handleInboundMessage(conn, msg) {
|
|
|
15438
15449
|
if (!currentSock) throw new Error("WhatsApp disconnected \u2014 cannot reply");
|
|
15439
15450
|
await sendTextMessage(currentSock, remoteJid, text, { accountId: conn.accountId });
|
|
15440
15451
|
};
|
|
15441
|
-
const sessionKey =
|
|
15452
|
+
const sessionKey = deriveSessionKey({
|
|
15453
|
+
agentType: accessResult.agentType,
|
|
15454
|
+
accountId: conn.accountId,
|
|
15455
|
+
senderPhone
|
|
15456
|
+
});
|
|
15442
15457
|
conn.lastMessageAt = Date.now();
|
|
15443
15458
|
const payload = {
|
|
15444
15459
|
accountId: conn.accountId,
|