Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rcesar/97a05b7ed3f60e9f361f0f53cee36536 to your computer and use it in GitHub Desktop.
Save rcesar/97a05b7ed3f60e9f361f0f53cee36536 to your computer and use it in GitHub Desktop.
Como fazer alguém te responder no whatsapp
var counter = 0;
var i = setInterval(function() {
window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {
bubbles: true
});
var textbox = document.querySelector('#main > footer > div.block-compose > div.input-container > div.pluggable-input.pluggable-input-compose > div.pluggable-input-body.copyable-text.selectable-text');
var textToSend = "Me responde!";
//Contribuiço do @diego-rlima
if ( counter > 0 ) {
var lastMessage = document.querySelector('#main > .pane-body > .copyable-area > .pane-chat-msgs .msg:last-child > .message');
if ( lastMessage.classList.contains('message-in') ) {
textToSend = "Finalmente respondeu!";
clearInterval(i);
}
}
// Mensagem que será enviada
textbox.textContent = textToSend;
textbox.dispatchEvent(event);
document.querySelector("button.compose-btn-send").click();
counter++;
// Envia 100 mensagens, uma mensagem a cada segundo.
// Se quiser enviar sem limites da zueira (porque the zuera never ends), só remover essa condição hu3hu3.
if (counter === 100)
clearInterval(i);
console.log("Já enviei " + counter + ' mensagens.')
// 1000 = 1 segundo, tempo que será enviada cada mensagem.
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment