function Messages(upsert, sock) {
    const m = Serialize(upsert, sock);
    if (m.quoted) {
        m.quoted.react = (emoji) =>
            sock.sendMessage(m.chat, {
                react: {
                    text: String(emoji),
                    key: m.quoted.key,
                },
            });

        m.quoted.delete = () => sock.sendMessage(m.chat, { delete: m.quoted.key });
        m.quoted.download = (pathFile) => downloadMedia(m.quoted.message, pathFile);
    }

    m.react = (emoji) =>
        sock.sendMessage(m.chat, {
            react: {
                text: String(emoji),
                key: m.key,
            },
        });

    m.reply = (text) =>
        sock.sendMessage(
            m.chat,
            {
                text: text,
            },
            { quoted: m, ephemeralExpiration: m.contextInfo.expiration }
        );

    /**
     * Represents a function that updates a message with new text.
     * @typedef {function(string | null): Promise<void>} UpdateCallback
     * @param {string | null} n_text - The new text to set (or null to keep the original text).
     * @returns {Promise<void>} - A Promise that resolves when the update is complete.
     */

    /**
     *
     * @param {string} text - The initial text to send.
     * @param {undefined | (function(UpdateCallback): void)} cb - A callback function that receives an update function.
     * @returns {function(UpdateCallback): void} - The update function.
     */
    const replyUpdate = async (text, cb) => {
        const response = await sock.sendMessage(
            m.chat,
            { text: String(text) },
            { quoted: m }
        );
        if (typeof cb === "function") {
            await cb(async (n_text) =>
                sock.sendMessage(m.chat, { text: n_text || "", edit: response.key })
            ).catch(() => {});
        }
        async function update(n_text) {
            await sock.sendMessage(m.chat, { text: String(n_text), edit: response.key });
        }
        return update;
    };
    m.replyUpdate = replyUpdate;

    m.delete = () => sock.sendMessage(m.chat, { delete: m.key });
    m.download = (pathFile) => downloadMedia(m.message, pathFile);

    sock.user.id = jidNormalizedUser(sock.user.id);
    return m;
}
Process an incoming message and return an extended WAMessage object.

@param {import("@whiskeysockets/baileys").BaileysEventMap["messages.upsert"]} upsert - The upsert event object.
@param {import("@whiskeysockets/baileys").WASocket} sock - The WASocket object.
@returns {import("@whiskeysockets/baileys").WAMessage & ExtendedWAMessage | null} - The extended WAMessage object or null if invalid.