diff --git a/backend/src/config/upload.ts b/backend/src/config/upload.ts index 24fb8f8..e7d682d 100644 --- a/backend/src/config/upload.ts +++ b/backend/src/config/upload.ts @@ -1,7 +1,11 @@ import path from "path"; import multer from "multer"; -const publicFolder = path.resolve(__dirname, "..", "..", "public"); +// const publicFolder = path.resolve(__dirname, "..", "..", "public"); +const publicFolder = path.resolve(__dirname, "..", "..","..","..", "public"); + +console.log('publicFolder: ',publicFolder) + export default { directory: publicFolder, diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index f504bae..c2132f2 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -118,8 +118,14 @@ const verifyMediaMessage = async ( } try { + // await writeFileAsync( + // join(__dirname, "..", "..", "..", "public", media.filename), + // media.data, + // "base64" + // ); + await writeFileAsync( - join(__dirname, "..", "..", "..", "public", media.filename), + join(__dirname, "..", "..", "..", "..", "..", "public", media.filename), media.data, "base64" ); @@ -365,19 +371,11 @@ const botSendMessage = (ticket: Ticket, contact: Contact, wbot: Session, msg: st const _clear_lst = () => { - console.log('WHATSAPP MESSAGE ID MULTI SESSION: ', lst.length) - - if (lst.length <= 200 ) return - - console.log('BEFORE lst SLICE: ', lst) - - console.log('lst whatsapp message id sliced! | lst.length: ', lst.length) + if (lst.length <= 200 ) return const chunk: any = Math.floor((lst.length / 2)) - lst = lst.slice(chunk, chunk + lst.length); - - console.log('AFTER lst SLICE: ', lst) + lst = lst.slice(chunk, chunk + lst.length); } @@ -426,38 +424,7 @@ const handleMessage = async ( // console.log('LIST OF ID MESSAGE lst: ', lst) - console.log('PASSOU.................................FROM: ', msg.from.split("@")[0], ' | ID: ', msg.id.id) - - // const contact_message = await getLastId(`contact_message:5517988310949`) - - // if (contact_message && contact_message.id == msg.id.id) { - // console.log('IGNORED MESSAGE SAME ID FROM CLIENT: ', contact_message.id) - // return - // } - - // await insertMessageContactCache(`contact_message:5517988310949`, - // { - // from: msg.from.split("@")[0], - // to: msg.to.split("@")[0], - // id: msg.id.id - // }) - - // console.log('PASSOU............................................... contact_message.id: ',contact_message.id) - - - // if (testLastId == msg.id.id) { - // console.log('IGNORED MESSAGE SAME ID!') - // return - // } - // testLastId = msg.id.id - - // console.log('PASSOU............................................... msg.id.id: ',msg.id.id) - - - - - - + console.log('PASSOU.................................FROM: ', msg.from.split("@")[0], ' | ID: ', msg.id.id) if (!isValidMsg(msg)) {