Auto WhatsApp : same message
var checkpost = 'yes'; function countDivsWithRoleRow() { const count = document.querySelectorAll('div[role="row"]').length; if (count !== countDivsWithRoleRow.prevCount) { countDivsWithRoleRow.prevCount = count; handleCountChange(count); } } function handleCountChange(count) { autowpx(); } countDivsWithRoleRow.prevCount = -2; setInterval(countDivsWithRoleRow, 500); function autowpx() { if (checkpost == 'no') {} else { autowp(); } } function autowp() { checkpost = 'no'; let messagex = document.querySelectorAll('span._ao3e.selectable-text.copyable-text')[document.querySelectorAll('span._ao3e.selectable-text.copyable-text').length - 1].innerText; sendMessage(messagex); setTimeout(function() { checkpost = 'yes'; }, 2000); } function sendMessage(message) { const mainEl = document.querySelector('#main'); const textareaEl = mainEl.querySelector('div[contenteditable="true"]'); if (!textareaEl) { throw new Error('There is no opened conversation'); } textareaEl.focus(); document.execCommand('insertText', false, message); textareaEl.dispatchEvent(new Event('change', { bubbles: true })); setTimeout(() => { (mainEl.querySelector('[data-testid="send"]') || mainEl.querySelector('[data-icon="send"]')).click(); }, 100); }
Newer Post
Older Post
Home
Loading...
Programmed by Subham Mandal
▣
✖
Loading...