From 0686b6928660610d4e79eac4a824725d9f999b02 Mon Sep 17 00:00:00 2001 From: Widya Ardianto Date: Thu, 9 Mar 2023 21:14:20 +0700 Subject: [PATCH] fix undefined message key --- src/fw.ts | 1 + src/interface.ts | 3 ++- src/utils.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fw.ts b/src/fw.ts index aeee1b2..c16dbce 100644 --- a/src/fw.ts +++ b/src/fw.ts @@ -70,6 +70,7 @@ function handleSock(sock) { groupJid: null, textMessage, message: msg.message, + msg, remoteJid: msg.key.remoteJid, } diff --git a/src/interface.ts b/src/interface.ts index 0ebbcac..e0c1c3d 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -1,4 +1,4 @@ -import { WASocket } from '@adiwajshing/baileys' +import {WAMessage, WASocket} from '@adiwajshing/baileys' export interface Properties { command: string, @@ -9,6 +9,7 @@ export interface Properties { groupJid?: string | null, textMessage?: string | null message: any, + msg: WAMessage, [key: string]: any } diff --git a/src/utils.ts b/src/utils.ts index 37167ff..22db11b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,11 +25,11 @@ async function sendMessageWithTyping (sock, jid: string, content: AnyMessageCont } async function quoteReply(sock, props: Properties, content: AnyMessageContent, options?: MiscMessageGenerationOptions) { - await sock.sendMessage(props.remoteJid, content, { quoted: props.message, ...options }) + await sock.sendMessage(props.remoteJid, content, { quoted: props.msg, ...options }) } async function quoteReplyWithTyping(sock, props: Properties, content: AnyMessageContent, options?: MiscMessageGenerationOptions) { - await sendMessageWithTyping(sock, props.remoteJid, content, { quoted: props.message,...options }) + await sendMessageWithTyping(sock, props.remoteJid, content, { quoted: props.msg,...options }) } export {