Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit 7b4bca1

Browse files
bonniciEfreak
authored andcommitted
Fixed cleverbot
Conflicts: lib/triggers/cleverbotTrigger.js package.json Conflicts: package.json
1 parent 4367422 commit 7b4bca1

File tree

3 files changed

+13
-136
lines changed

3 files changed

+13
-136
lines changed

lib/triggers/cleverbotTrigger.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ CleverbotTrigger.prototype._respond = function(toId, message) {
5454
this.winston.info("Sending cleverbot request with params:");
5555
this.winston.info(this.cleverbot.params);
5656
var that = this;
57-
this.cleverbot.write(message, function(response) {
58-
that.winston.info("Cleverbot responded with params:");
59-
that.winston.info(that.cleverbot.params);
60-
if (response.message === "<html>") {
61-
that.cleverbot.params.sessionid = "";
62-
}
63-
else {
64-
that._sendMessageAfterDelay(toId, response.message);
65-
}
57+
58+
Cleverbot.prepare(function() {
59+
that.cleverbot.write(message, function(response) {
60+
that.winston.info("Cleverbot responded with params:");
61+
that.winston.info(that.cleverbot.params);
62+
if (response.message != '<html>' && response.message.trim() != '' && response.message.indexOf("Error:") != 0) {
63+
that._sendMessageAfterDelay(toId, response.message.trim());
64+
}
65+
});
6666
});
6767

6868
return true;

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@
114114
},
115115
"optionalDependencies": {
116116
"accounting": "^0.4.1",
117-
"cleverbot-node": "0.1.x",
117+
"body-parser": "^1.13.2",
118+
"cleverbot-node": "0.2.x",
118119
"dotenv": "^1.1.0",
120+
"express-session": "^1.11.3",
121+
"filendir": "0.0.1",
119122
"firebase": "^2.2.6",
120123
"fireproof": "^2.5.2",
121124
"github-webhook-handler": "^0.4.0",

spec/wolframAlphaTriggerSpec.js

Lines changed: 0 additions & 126 deletions
This file was deleted.

0 commit comments

Comments
 (0)