Forked from callmeloureiro/comoSerChatoNoWhatsapp.js
Created
October 18, 2017 16:17
-
-
Save AndersonFirmino/407962745ebdf1f93ab0b0cd8eb057bf to your computer and use it in GitHub Desktop.
Como fazer alguém te responder no whatsapp
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
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 | |
// O envio para quando a pessoa responde, caso queira remover, basta apagar essa condiço. | |
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