fix: preserve whatsapp group JIDs

This commit is contained in:
Peter Steinberger
2025-12-23 03:05:59 +01:00
parent fc4a395c88
commit 4af08b1606
5 changed files with 30 additions and 4 deletions

View File

@@ -13,7 +13,12 @@ import { loadConfig } from "../config/config.js";
import { isVerbose, logVerbose } from "../globals.js";
import { createSubsystemLogger, getChildLogger } from "../logging.js";
import { saveMediaBuffer } from "../media/store.js";
import { isSelfChatMode, jidToE164, normalizeE164 } from "../utils.js";
import {
isSelfChatMode,
jidToE164,
normalizeE164,
toWhatsappJid,
} from "../utils.js";
import {
createWaSocket,
getStatusCode,
@@ -336,7 +341,7 @@ export async function monitorWebInbox(options: {
mediaBuffer?: Buffer,
mediaType?: string,
): Promise<{ messageId: string }> => {
const jid = `${to.replace(/^\+/, "")}@s.whatsapp.net`;
const jid = toWhatsappJid(to);
let payload: AnyMessageContent;
if (mediaBuffer && mediaType) {
if (mediaType.startsWith("image/")) {
@@ -376,7 +381,7 @@ export async function monitorWebInbox(options: {
* Used after IPC send to show more messages are coming.
*/
sendComposingTo: async (to: string): Promise<void> => {
const jid = `${to.replace(/^\+/, "")}@s.whatsapp.net`;
const jid = toWhatsappJid(to);
await sock.sendPresenceUpdate("composing", jid);
},
} as const;