async function sendScript(text){
const lines = text.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
main = document.querySelector("#main"),
textarea = main.querySelector(`div[contenteditable="true"]`)
if(!textarea) throw new Error("not an open conversation")
for(const line of lines){
textarea.focus();
document.execCommand('insertText', false, line);
textarea.dispatchEvent(new Event('change', {bubbles: true}));
setTimeout(() => {
(main.querySelector(`[data-testid="send"]`) || main.querySelector(`[data-tab="11"]`)).click();
}, 100);
if(lines.indexOf(line) !== lines.length - 1) await new Promise(resolve => setTimeout(resolve, 250));
}
return lines.length;
}
sendScript(`
Hey
This
Is
A
Auto
Sender
`)-
Notifications
You must be signed in to change notification settings - Fork 0
ceconcarlsen/whats-app-script-sender
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published