mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 796 forks source link

Update Wapi.js Fix Issue: #1002 #1003

Closed bobaoapae closed 3 years ago

bobaoapae commented 3 years ago

WhatsApp Web: 2.2106.5

fnevesgx commented 3 years ago

Eric sendmessage function is not a promise anymore, i made the fix below:

//.then( function checkmessage() { function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }

            var trials = 0;

            function check() {
                for (let i = chat.msgs.models.length - 1; i >= 0; i--) {
                    let msg = chat.msgs.models[i];

                    if (!msg.senderObj.isMe || msg.body != message) {
                        continue;
                    }
                    done(WAPI._serializeMessageObj(msg));
                    return true;
                }
                trials += 1;
                console.log(trials);
                if (trials > 30) {
                    done(true);
                    return;
                }
                sleep(500).then(check);
            }
            check();
        } //);
        checkmessage();
3dluis commented 3 years ago

SendMessage not found

VM209:372 Uncaught TypeError: Cannot read property 'apply' of undefined at Object.found.sendMessage (:372:41) at Object.window.WAPI.sendMessage (:807:18) at :1:6

3dluis commented 3 years ago

window.Store.sendMessage = function (e) { window.Store.SendTextMsgToChat(this, ...arguments); };

tetradox commented 3 years ago

'modelClass' of undefined

deadpyxel commented 3 years ago

Been getting cyclic object value after applying the changes proposed. anything I should be aware of?

UPDATE: Problem related to custom outdated code, seems to be fine.

wernerpj1 commented 1 year ago

sendMessage send the message but in whatsapp "your message could not be sent"