Skip to content

Instantly share code, notes, and snippets.

@jagrosh
Created February 2, 2018 16:42
Show Gist options
  • Save jagrosh/14e9ea0e458fe240320ddebcb2641ae7 to your computer and use it in GitHub Desktop.
Save jagrosh/14e9ea0e458fe240320ddebcb2641ae7 to your computer and use it in GitHub Desktop.
Sandbox cleverbot loop for https://cleverbot.io/sandbox
var bot = new cleverbot("", ""); // Set up keys
var bot2 = new cleverbot("", ""); // Set up keys
var firstword = "Hello.";
bot.setNick("Bill"); // Set a nickname
bot2.setNick("Fred")
bot.create(function (err, session) { // Initialize Cleverbot
bot2.create(function(err, session) {
document.write(bot.nick+": "+firstword);
askloop(bot, bot2, firstword);
});
});
var askloop = function(thisbot, otherbot, query) {
thisbot.ask(query, function(err,response) {
document.write("<br>"+otherbot.nick+": "+response);
askloop(otherbot, thisbot, response);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment