import type { proto, WAMessage } from "@whiskeysockets/baileys"; import { logVerbose } from "openclaw/plugin-sdk/runtime-env"; import type { createWaSocket } from "../session.js"; import { downloadMediaMessage, normalizeMessageContent } from "./runtime-api.js";
/** * Resolve the MIME type for an inbound media message. * Falls back to WhatsApp's standard formats when Baileys omits the MIME.
*/ function resolveMediaMimetype(message: proto.IMessage): string | undefined { const explicit =
message.imageMessage?.mimetype ??
message.videoMessage?.mimetype ??
message.documentMessage?.mimetype ??
message.audioMessage?.mimetype ??
message.stickerMessage?.mimetype ??
undefined; if (explicit) { return explicit;
} // WhatsApp voice messages (PTT) and audio use OGG Opus by default if (message.audioMessage) { return"audio/ogg; codecs=opus";
} if (message.imageMessage) { return"image/jpeg";
} if (message.videoMessage) { return"video/mp4";
} if (message.stickerMessage) { return"image/webp";
} return undefined;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.