Open thedeaddan opened 5 months ago
The client's constant:
const client = new Client({
authStrategy: new LocalAuth(),
puppeteer: {
executablePath: process.env.CHROME_EXECUTABLE_PATH,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
headless: 'new',
}
});
I can also add that the system is used without a graphical shell (terminal only). If this is important, please let us know
@thedeaddan Do you use #2272?
@alechkos yep
@thedeaddan Also please send your code
@thedeaddan
That's a very high delay in sending
The delay is after each message or after you started the script and it is sending to 700 users and you can't use other funtion?
@pedroslopez Yes
@thedeaddan
That's a very high delay in sending
The delay is after each message or after you started the script and it is sending to 700 users and you can't use other funtion?
There is a delay in sending almost every message. It works in the following mode: It received a message from one chat for 500+ people and forwarded it to another chat for 700+ people. And vice versa
There is also a problem that if there are a lot of messages in the chat, let's say if it has been working for a long time. Then he just stops receiving them. Either it takes a very long time to receive, and it takes even longer to forward
Already opened issues that maybe can help you: #1567, #2381
@alechkos Unfortunately, it didn't help. I even changed the hosting to a more powerful one. 16 GB OF RAM. 150 GB NVMe. But it didn't help at all, over time he just can't forward. There is a feeling that it depends on the number of messages in the chats. I did the cleanup at startup. But it works for the first time, and then it freezes again
@thedeaddan
Unfortunately, it didn't help.
Do you use https://github.com/pedroslopez/whatsapp-web.js/pull/2272?
If you currently are using the forward
method from the pr, then try to use an old one defined in the library, proceed npm i github:pedroslopez/whatsapp-web.js#main
and check.
After it update if you have a problem with forwarding
@alechkos When using this branch, forwarding falls into error:
/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^
Error: Evaluation failed: TypeError: chat.forwardMessages is not a function
at __puppeteer_evaluation_script__:5:31
at ExecutionContext._evaluateInternal (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Message.forward (/root/wapp/node_modules/whatsapp-web.js/src/structures/Message.js:441:9)
Node.js v21.6.1
I am sending it using:
await msg.forward(target_chat);
@alechkos So is it to overwrite the file after each update?
So is it to overwrite the file after each update?
No, just check it once
@alechkos
/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
^
Error: Evaluation failed: TypeError: window.Store.Chat.forwardMessagesToChats is not a function
at __puppeteer_evaluation_script__:4:31
at ExecutionContext._evaluateInternal (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
at async Message.forward (/root/wapp/node_modules/whatsapp-web.js/src/structures/Message.js:441:9)
Node.js v21.6.1
@thedeaddan
What wweb are you using? console.log(await client.getWWebVersion())
@alechkos 2.2405.4
@thedeaddan I have to check it
@alechkos And for the rest, does message forwarding work normally, or is it not a popular method? Is there any other way?
@thedeaddan
And for the rest, does message forwarding work normally, or is it not a popular method? Is there any other way?
Yes it works but in the pr
@thedeaddan
And for the rest, does message forwarding work normally, or is it not a popular method? Is there any other way?
Yes it works but in the pr
This is just a branch
npm install github:alechkos/whatsapp-web.js#forward-with-caption
?
@thedeaddan Yep
@alechkos Yes, I am on this branch. I will try to do something for now. (Delete the original message after forwarding or clean the chat more often)
@thedeaddan In my pr I didn't implement the cache while forwarding media if you are using my pr and you forward media then maybe this is the problem with slow forwarding
@alechkos And then what can I do?
@thedeaddan
And then what can I do?
You can check the code and fix the implementation or to wait until I'll fix it but firstly we have to check if the problem is with unimplemented cache
@alechkos If anything, here are the client settings:
const client = new Client({
authStrategy: new LocalAuth(),
puppeteer: {
executablePath: process.env.CHROME_EXECUTABLE_PATH,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
ignoreDefaultArgs: ['--disable-dev-shm-usage'],
ignoreHTTPSErrors: true,
headless: 'new',
}
});
@alechkos Sometimes such errors also happen:
[2024-02-05 10:41:03] error: Evaluation failed: Error: msg is not a media msg: unknown, isGif=false
at e (https://web.whatsapp.com/:2:4913)
at d (https://web.whatsapp.com/app.f048d8d89717819d6c73.js:269:59333)
at t.getMsgMediaType (https://web.whatsapp.com/app.f048d8d89717819d6c73.js:269:57346)
at https://web.whatsapp.com/app.f048d8d89717819d6c73.js:266:682842
at async Object.window.WWebJS.forwardMediaMessage (__puppeteer_evaluation_script__:308:16)
at async Object.window.WWebJS.forwardMessage (__puppeteer_evaluation_script__:234:28)
at async __puppeteer_evaluation_script__:7:20
/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221 throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); ^ Error: Evaluation failed: TypeError: window.Store.Chat.forwardMessagesToChats is not a function at __puppeteer_evaluation_script__:4:31 at ExecutionContext._evaluateInternal (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Message.forward (/root/wapp/node_modules/whatsapp-web.js/src/structures/Message.js:441:9) Node.js v21.6.1
I have the same problem, is there already a solution to this?
/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221 throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails)); ^ Error: Evaluation failed: TypeError: window.Store.Chat.forwardMessagesToChats is not a function at __puppeteer_evaluation_script__:4:31 at ExecutionContext._evaluateInternal (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ExecutionContext.evaluate (/root/wapp/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Message.forward (/root/wapp/node_modules/whatsapp-web.js/src/structures/Message.js:441:9) Node.js v21.6.1
I have the same problem, is there already a solution to this?
npm install github:alechkos/whatsapp-web.js#forward-with-caption
But the work is still not stable, even on this branch. You have to constantly restart the script
Did you figure out why?
Is there an existing issue for this?
Describe the bug
When the bot forwards a message to a chat for ~700 people. That's a very high delay in sending. And an error often occurs:
[2024-01-15 13:32:37] error: Evaluation failed: Error: msg is not a media msg: unknown, isGif=false at e (https://web.whatsapp.com/:2:4911) at d (https://web.whatsapp.com/app.d61b42d11fedf617d4e8.js:269:59292) at t.getMsgMediaType (https://web.whatsapp.com/app.d61b42d11fedf617d4e8.js:269:57305) at https://web.whatsapp.com/app.d61b42d11fedf617d4e8.js:266:676147 at async Object.window.WWebJS.forwardMediaMessage (__puppeteer_evaluation_script__:308:16) at async Object.window.WWebJS.forwardMessage (__puppeteer_evaluation_script__:234:28) at async __puppeteer_evaluation_script__:7:20
Expected behavior
The forwarding speed should be higher
Steps to Reproduce the Bug or Issue
await msg.forward(msg.chat);
Relevant Code
No response
Browser Type
Chromium
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Debian GNU/Linux 11 (bullseye) x86_64 Phone OS: Android 13 whatsapp-web.js version: v1.23.1-alpha.4 WhatsApp Web version: 2.2402.5 NodeJS ver: v20.9.0
Additional context
No response