Skip to content

Instantly share code, notes, and snippets.

@StephanStanisic
Created June 6, 2016 06:40
Show Gist options
  • Save StephanStanisic/2e21a7d67d037d42cbc2b2149c25aea7 to your computer and use it in GitHub Desktop.
Save StephanStanisic/2e21a7d67d037d42cbc2b2149c25aea7 to your computer and use it in GitHub Desktop.
Cleverbot omegle intergration
// ==UserScript==
// @name Omegle
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.omegle.com/
// @grant none
// @run-at document-idle
// ==/UserScript==
/* jshint -W097 */
'use strict';
// Put your email here so you can save the logs:
var email = ¨somone@example.com¨;
// Starting message
var strmsg = ¨Hi, Stephan here¨;
// Your code here...
var timer, lastSave = "", newj = true, seconds = 0;
function send(txt){
document.getElementsByClassName("chatmsg ")[0].value = txt;
setTimeout(function(){
document.getElementsByClassName("sendbtn")[0].click();
}, 500);
}
function get(){
var logs = document.getElementsByClassName("logitem");
var last = logs[ logs.length - 1 ];
var classn = last.childNodes[0].className;
if(classn == "strangermsg") {
var text = last.childNodes[0].getElementsByTagName("span")[0].innerText;
return text;
} else {
return "exit00";
}
}
function letago(){
timer = setInterval(function(){
if(newj) {
setTimeout(function(){
send(strmsg);
}, 1200);
newj = false;
}
var t = get();
if(t != "exit00" && t != lastSave){
lastSave = t;
seconds = 0;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
send(JSON.parse(xhttp.responseText).response);
newj = false;
}
};
xhttp.open("POST", "https://cleverbot.io/1.0/ask", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("Accept", "*/*");
xhttp.send("user=u7sZxJSTuXk1wN5f&key=M9I1bX6Tv3Qi5Egg9bUiEJ9SlcLl8JfY&nick=Stephan&text=" + t);
}
var btn = document.getElementsByClassName("disconnectbtn")[0];
if(seconds > 20000){
btn.click();
btn.click();
}
document.getElementById("countingup").innerHTML = Math.floor(seconds / 1000);
if(btn.innerText.replace(/\s/g, "") == "NewEsc") {
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "https://formspree.io/" + email, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.setRequestHeader("Accept", "*/*");
xhttp.send("log_html=" + encodeURIComponent(document.getElementsByClassName("logbox")[0].innerHTML) + "&log_text=" + encodeURIComponent(document.getElementsByClassName("logbox")[0].innerText));
btn.click();
newj = true;
seconds = 0;
}
seconds += 500;
}, 500);
}
var div = document.createElement("div");
div.id = "lolz";
div.style.zIndex = "5000";
div.style.position = "fixed";
div.style.bottom = "8px";
div.style.right = "8px";
div.style.padding = "8px";
div.style.textAlign = "center";
div.style.background = "white";
div.style.border = "2px solid black";
div.style.borderRadius = "2px";
div.innerHTML = "<b>Omegle bot</b> <i id='countingup'></i><br />";
document.body.appendChild(div);
var btn = document.createElement("button");
btn.innerHTML = "GET";
btn.onclick = function() {
prompt(get(),get());
};
document.getElementById("lolz").appendChild(btn);
var btn2 = document.createElement("button");
btn2.innerHTML = "GO!";
btn2.onclick = function() {
letago();
};
document.getElementById("lolz").appendChild(btn2);
var btn3 = document.createElement("button");
btn3.innerHTML = "Stop";
btn3.onclick = function() {
clearInterval(timer);
};
document.getElementById("lolz").appendChild(btn3);
document.getElementById("chattypetextcell").addEventLisener("click", letago);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment