cleverbot-node
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -72,2 +72,17 @@ var crypto = require('crypto') | ||
configure: function (options){ | ||
options = options || {}; | ||
this.botapi = options.botapi; | ||
}, | ||
path: function(){ | ||
var path = '/webservicemin?uc=3210&'; | ||
if(this.botapi) { | ||
path += ['botapi',this.botapi].join("="); | ||
} else { | ||
path += 'botapi=CHANGEME' | ||
} | ||
return path; | ||
}, | ||
write: function (message, callback) { | ||
@@ -92,3 +107,3 @@ var clever = this; | ||
port: 80, | ||
path: '/webservicemin?uc=321&', | ||
path: this.path(), | ||
method: 'POST', | ||
@@ -95,0 +110,0 @@ headers: { |
@@ -5,3 +5,3 @@ { | ||
"description": "Cleverbot client for node.js", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"contributors": [ | ||
@@ -8,0 +8,0 @@ { |
@@ -20,2 +20,19 @@ # Cleverbot-node | ||
With API Key: | ||
The unofficial cleverbot api requests can optionally contain an API key. Information can be found here: http://www.cleverbot.com/apis | ||
In order to add your key to your bot, you can use the `configure` method. | ||
``` | ||
var Cleverbot = require('cleverbot-node'); | ||
cleverbot = new Cleverbot; | ||
cleverbot.configure({botapi: "IAMKEY"}); | ||
Cleverbot.prepare(function(){ | ||
cleverbot.write(cleverMessage, function (response) { | ||
alert(response.message); | ||
}); | ||
}); | ||
``` | ||
See 'examples' for more usage. |
6900
132
38