Created
February 2, 2018 16:42
-
-
Save jagrosh/14e9ea0e458fe240320ddebcb2641ae7 to your computer and use it in GitHub Desktop.
Sandbox cleverbot loop for https://cleverbot.io/sandbox
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 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