orkestral/venom

sendFile and sendImage not working properly

wluisvilhegas opened this issue ยท 15 comments

Description

Im using the most recent version, simply trying to send a PDF and a PNG file but can't.

Error when sending: {
me: {
id: {
server: 'c.us',
user: '55XXXXXXXXXXX',
_serialized: '55XXXXXXXXXXX@c.us'
},
displayName: null,
verifiedName: null,
searchName: null,
pushname: null,
notifyName: null,
isBusiness: null,
formattedUser: null,
tag: '1695338692',
eurl: 'https://pps.whatsapp.net/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?ccb=11-4&oh=01_AdRxE89sQZIwBXhuyihyIzMQUJGYMRWTmF8NVFR8xG3rdw&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
previewEurl: 'https://pps.whatsapp.net/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdSRVgL78g82By2vk_Y-6F4V6QqFlJHd2gnUMSBVm_eJrA&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
fullDirectPath: '/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?ccb=11-4&oh=01_AdRxE89sQZIwBXhuyihyIzMQUJGYMRWTmF8NVFR8xG3rdw&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
previewDirectPath: '/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdSRVgL78g82By2vk_Y-6F4V6QqFlJHd2gnUMSBVm_eJrA&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
filehash: 'rJj3z/t3AECqnoiHKVU6pofHVLyA52ldSF+Gg//1UlA=',
stale: false,
eurlStale: false,
timestamp: 1695339379959,
hostRetryCount: 0
},
to: {
server: 'c.us',
user: '55XXXXXXXXXXX',
_serialized: '55XXXXXXXXXXX@c.us'
},
erro: true,
text: 'Error to processFiles',
status: 404
}

Your Code

I tried with local file:

await client.sendImage(message.from, "21577.jpg", "21577.jpg", "TesteCaption")
.then((result) => {
console.log("Result: ", result); //return object success
}).catch((erro) => {
console.error("Error when sending: ", erro); //return object error
});

and with URL

await client.sendImage(message.from, "https://img.ibxk.com.br/materias/5866/21577.jpg", "image.jpg", "TesteCaption")
.then((result) => {
console.log("Result: ", result); //return object success
}).catch((erro) => {
console.error("Error when sending: ", erro); //return object error
});

both ways return me the same error.

erro: true,
text: 'Error to processFiles',
status: 404

I can send messages normally, the error is when sending files or images, how can i solve it?

I dont know exactly what it was, but it was something about windows, I changed to a ubuntu server and its working fine now.

Same error here, last night the image worked, today it doesn't

If I fix it I'll come back and tell you, Maybe it's an anti-virus update or firewall, is the only think changes in my computer today, check it

ono77 commented

same problem here..

Cannot read properties of undefined (reading 'isNewsletter')
at t.getMaxNumberSelectableMedia (app.f8ceec360734d3a1abb3.js:51:662539)

same problem heree.I have checked and found that this error occurs in the latest version of WhatsApp web

I am also having this issue. Started coming with whatsapp web version 2.2340.9

I have the same problem here

rzlnhd commented

I've tried to change from this

await mediaCollection.processAttachments(
    Debug.VERSION === '0.4.613'
      ? blobs
      : blobs.map((blob) => {
          return {
            file: blob
          };
        }),
    chat,
    1
  );

to this

await mediaCollection.processAttachments(
    Debug.VERSION === '0.4.613'
      ? blobs
      : blobs.map((blob) => {
          return {
            file: blob
          };
        }),
    chat,
    chat
  );

on src/lib/wapi/functions/process-files.js and src/lib/wapi/help/process-files.js file. Works good for me.

I'm still waiting the correct ways to solve this issue though.

Works for me, thanks

We are also facing same issue,while sending pdf
image

How to resolve this

I am facing the same problem file and image not send.
Error when sending: {
me: {
id: {
server: 'c.us',
user: '55XXXXXXXXXXX',
_serialized: '55XXXXXXXXXXX@c.us'
},
displayName: null,
verifiedName: null,
searchName: null,
pushname: null,
notifyName: null,
isBusiness: null,
formattedUser: null,
tag: '1695338692',
eurl: 'https://pps.whatsapp.net/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?ccb=11-4&oh=01_AdRxE89sQZIwBXhuyihyIzMQUJGYMRWTmF8NVFR8xG3rdw&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
previewEurl: 'https://pps.whatsapp.net/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdSRVgL78g82By2vk_Y-6F4V6QqFlJHd2gnUMSBVm_eJrA&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
fullDirectPath: '/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?ccb=11-4&oh=01_AdRxE89sQZIwBXhuyihyIzMQUJGYMRWTmF8NVFR8xG3rdw&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
previewDirectPath: '/v/t61.24694-24/378017733_688551789817191_5553061098892593864_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdSRVgL78g82By2vk_Y-6F4V6QqFlJHd2gnUMSBVm_eJrA&oe=6519FD11&_nc_sid=000000&_nc_cat=105',
filehash: 'rJj3z/t3AECqnoiHKVU6pofHVLyA52ldSF+Gg//1UlA=',
stale: false,
eurlStale: false,
timestamp: 1695339379959,
hostRetryCount: 0
},
to: {
server: 'c.us',
user: '55XXXXXXXXXXX',
_serialized: '55XXXXXXXXXXX@c.us'
},
erro: true,
text: 'Error to processFiles',
status: 404
}

How to resolve it?

on your project go to node_modules/venom-bot/dist/lib/wapi/wapi.js

find this code
image

change 1 to e, like this
image

this work for me

Solution not work

I've tried to change from this

await mediaCollection.processAttachments(
    Debug.VERSION === '0.4.613'
      ? blobs
      : blobs.map((blob) => {
          return {
            file: blob
          };
        }),
    chat,
    1
  );

to this

await mediaCollection.processAttachments(
    Debug.VERSION === '0.4.613'
      ? blobs
      : blobs.map((blob) => {
          return {
            file: blob
          };
        }),
    chat,
    chat
  );

on src/lib/wapi/functions/process-files.js and src/lib/wapi/help/process-files.js file. Works good for me.

I'm still waiting the correct ways to solve this issue though.

worked,thank you so much