Skip to content

Instantly share code, notes, and snippets.

@goto-dev-null
Created October 13, 2018 00:56
Show Gist options
  • Save goto-dev-null/38da96f2b8191535bb960679040d23cf to your computer and use it in GitHub Desktop.
Save goto-dev-null/38da96f2b8191535bb960679040d23cf to your computer and use it in GitHub Desktop.
Javascript to auto-reroll the text chat on Omegle
var secondsToWait = 7;
var secondsWaited = 0;
var introMsg = "Hey";
function check() {
console.log('checking ' + secondsWaited);
var btn = document.getElementsByClassName('disconnectbtn')[0];
if(btn.textContent.includes('New')) {
btn.click();
setTimeout(() => restart(), 1000);
} else {
if(document.getElementsByClassName('logbox')[0].innerText
==
"You're now chatting with a random stranger. Say hi!\nYou: " + introMsg + "\n") {
secondsWaited +=1;
if(secondsWaited>=secondsToWait) {
secondsWaited = 0;
setTimeout(() => { btn.click(); }, 500);
setTimeout(() => { btn.click(); }, 500 * 2);
setTimeout(() => { btn.click(); }, 500 * 3);
setTimeout(() => restart(), 500 * 3 + 1000);
}
}
else {
secondsWaited = 0;
}
}
}
function restart() {
console.log('restarting');
document.getElementsByClassName('chatmsg')[0].value = introMsg;
document.getElementsByClassName('sendbtn')[0].click();
}
var timerId = null
function start() {
console.log('starting');
timerId = setInterval(check, 1000);
}
function stop() {
console.log('stopping');
clearInterval(timerId);
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment