cleverbot-node
Advanced tools
Comparing version 0.3.1 to 0.3.2
var http = require('https') | ||
, qs = require('querystring') | ||
, Cleverbot = function () { | ||
@@ -18,10 +19,12 @@ }; | ||
path: function(message){ | ||
var path = '/getreply?'; | ||
if(this.botapi) { | ||
path += ['key',this.botapi].join("="); | ||
} else { | ||
path += 'botapi=CHANGEME' | ||
var path = '/getreply'; | ||
, query = { | ||
input: message, | ||
key: this.botapi || "CHANGEME" | ||
}; | ||
if(this.state) { | ||
query.cs = this.state; | ||
} | ||
path += ['&input',encodeURIComponent(message)].join("=") | ||
return path; | ||
return [path, qs.stringify(query)].join("?"); | ||
}, | ||
@@ -50,5 +53,6 @@ | ||
responseBody.message = responseBody.output; //for backwards compatibility | ||
this.state = responseBody.cs; | ||
cb(responseBody); | ||
}); | ||
}); | ||
}.bind(this)); | ||
}.bind(this)); | ||
@@ -55,0 +59,0 @@ req.end(); |
@@ -5,3 +5,3 @@ { | ||
"description": "Cleverbot client for node.js", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"contributors": [ | ||
@@ -8,0 +8,0 @@ { |
@@ -7,3 +7,3 @@ # Cleverbot-node | ||
In order to add your key to your bot, you can use the `configure` method. | ||
In order to add your key to your bot, you can use the `configure` method. API keys can be obtained from the [Cleverbot API Sign Up Page](http://cleverbot.com/api). | ||
@@ -10,0 +10,0 @@ ``` |
4157
65