Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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