Created
October 6, 2021 00:31
-
-
Save stampyzfanz/29f0aea420299514d7817c158b454aaa to your computer and use it in GitHub Desktop.
Automated Whatsapp Web messager. Can also detect when a person is typing and cut them off.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMsg(msg) { | |
let txt = document.querySelectorAll('._13NKt')[1] | |
txt.innerText = msg | |
let startTypingEv = new InputEvent('input', { | |
bubbles: true | |
}); | |
txt.dispatchEvent(startTypingEv) | |
let enterEv = new KeyboardEvent('keydown', {altKey:false, | |
bubbles: true, | |
cancelBubble: false, | |
cancelable: true, | |
charCode: 0, | |
code: "Enter", | |
composed: true, | |
ctrlKey: false, | |
currentTarget: null, | |
defaultPrevented: true, | |
detail: 0, | |
eventPhase: 0, | |
isComposing: false, | |
isTrusted: true, | |
key: "Enter", | |
keyCode: 13, | |
location: 0, | |
metaKey: false, | |
repeat: false, | |
returnValue: false, | |
shiftKey: false, | |
type: "keydown", | |
which: 13}); | |
txt.dispatchEvent(enterEv) | |
} | |
function timeout(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
while (true) { | |
if (typer = document.querySelectorAll('.2YPr')[0].innerText.match(/(.*)is typing/)) { | |
sendMsg(`A wild ${typer[1]} is typing`); | |
await timeout(7000) | |
} | |
await timeout(250) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks