pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.13k stars 3.61k forks source link

message.delete() is not working #3245

Open krajasekhar opened 1 month ago

krajasekhar commented 1 month ago

Is there an existing issue for this?

Describe the bug

I am able to do all other actions successfully but message.delete() is not reflecting anything while it is not even throwing it. It is even able to find the same message when I re-run the script.

Expected behavior

Delete the actual message (for me)

Steps to Reproduce the Bug or Issue

Run a simple snippet, scan qr code and all. Now send the 'TEST MESSAGE' text to your phone. It won't get deleted on the phone or other whatsapp web. Also applies when I do the same deletion with message after searchMessages or chat.fetchMessages.

Relevant Code

Some simple code to test this:

client.on('message_create', async (message) => {
    try {
        if (message.body === 'TEST MESSAGE') {
            await message.delete();
            await message.reply('Thanks for message, let me come back soon');
        }
    } catch (error) {
        console.error('An error occurred:', error);
    }
});

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

Mac iOS ^1.25.0 2.3000.1015762919 v22.6.0

Additional context

No response

gamoridev commented 4 days ago

Is this successfuly resolved? @alechkos @krajasekhar I tried with the latest release v1.26.0 and still happens as described.

I can delete a message for everyone using message.delete(true) but just "for me", nothing happens and I still get the message on chat context and no errors.

alechkos commented 4 days ago

@gamoridev We will check

krajasekhar commented 3 days ago

I tried ^1.26.0 with both message.delete(true) and message.delete(false) and is still failing to delete the message.