Code Monkey home page Code Monkey logo

cleverbot-node's People

Contributors

avatarkava avatar bluesatin avatar brussell98 avatar coreparadox avatar deansheather avatar evandotpro avatar fojas avatar macdja38 avatar reactivepixel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cleverbot-node's Issues

404 Not Found?

{ message: '<html>', sessionid: '\n<head><title>404 Not Found</title></head>', logurl: '\n<body bgcolor="white">', vText8: '\n<center><h1>404 Not Found</h1></center>', vText7: '\n<hr><center>nginx/1.6.2 (Ubuntu)</center>', vText6: '\n</body>', vText5: '\n</html>', vText4: '\n' }

this.params = Cleverbot.default_params;

I noticed in the code there is:

this.params = Cleverbot.default_params;

The problem with doing this, is that in javascript, objects act somewhat like pointers. It won't create a new copy of that params object, which means that EVERY bot you create with your API will share the same params object, which makes it kind of pointless for this to be object oriented...

Unexpected token in JSON

Sometimes, it seems like the JSON can't be parsed correctly and it then outputs the error SyntaxError: Unexpected token � in JSON at position x where x can be any number. Seems to be in between 1500 and 1800, but not sure.

I thought at first that this was because I ran out of API calls, but later the same day it can work just fine.

Broken again

Hi everytime i try to talk now with the bot only < html > comes as output.

Error handling

At the comment I'm using the try and catch method. But it still errors and crashes. It's a JSON error... I'm guessing this is fixed in the newest release

Problems with special characters

In the german language, we have characters like ä, ö and ü. Cleverbot-node only returns some "random" characters for them.

Session is denied

Looks like Cleverbot has disabled access using this library (and others?), any time I try to use it I get no response and the sessionid is set to "DENIED".

<html> response in linux server

So as per example I integrated the cleverbot in my code as below:

var Cleverbot = require('cleverbot-node');
cleverbot = new Cleverbot;
cleverbot.configure({botapi: "KEY"});
cleverbot.write(cleverMessage, function (response) {
   console.log(response.message);
});

Running the above from my windows pc, works just fine, but from the linux server, responds as <html>

npm view cleverbot-node version -> 0.3.3

Returning 404

Looks like Cleverbot API has changed or something because I'm getting a 404 response

{ message: '<html>',
  sessionid: '\n<head><title>404 Not Found</title></head>',
  logurl: '\n<body bgcolor="white">',
  vText8: '\n<center><h1>404 Not Found</h1></center>',
  vText7: '\n<hr><center>nginx/1.6.2 (Ubuntu)</center>',
  vText6: '\n</body>',
  vText5: '\n</html>',
  vText4: '\n' }

Error handling

In cleverbot.js you have an issue on line 58 where the eval will error without catching it, halting the program.

This can be fixed by changing line 58 from:
eval("responseBody = " + body)
to:
try {eval("responseBody = " + body)} catch(e) {console.log(e)}

AND changing line 60-61 from:

responseBody.message = responseBody.output;
this.state = responseBody.cs;

to:

try {
responseBody.message = responseBody.output;
this.state = responseBody.cs;
} catch(e) {console.log(e)}

Thanks for the great package otherwise!

Getting <html> error, API down?

I have it on my bot in Discord but I haven't used it, let alone, touched the command for cleverbot. Now I just get as a output.

API requests are denied by cleverbot

Bob Loblaw :

{ message: '',
  sessionid: 'DENIED',
  logurl: '',
  vText8: '',
  vText7: '',
  vText6: '',
  vText5: '',
  vText4: '',
  vText3: '',
  vText2: '',
  prevref: '',
  '': '',
  emotionalhistory: '',
  ttsLocMP3: '',
  ttsLocTXT: '',
  ttsLocTXT3: '',
  ttsText: '',
  lineref: '',
  lineURL: '',
  linePOST: '',
  lineChoices: '',
  lineChoicesAbbrev: '',
  typingData: '',
  divert: '' }

npm ERR! cb() never called!

I get this error when installing this package using: npm install cleverbot-node:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-04-26T22_13_42_127Z-debug.log

npm log:

Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install', 'cleverbot-node' ]
2 info using [email protected]
3 info using [email protected]
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 silly fetchPackageMetaData cleverbot-node
7 silly fetchNamedPackageData cleverbot-node
8 silly mapToRegistry name cleverbot-node
9 silly mapToRegistry using default registry
10 silly mapToRegistry registry https://registry.npmjs.org/
11 silly mapToRegistry data Result {
11 silly mapToRegistry   raw: 'cleverbot-node',
11 silly mapToRegistry   scope: null,
11 silly mapToRegistry   escapedName: 'cleverbot-node',
11 silly mapToRegistry   name: 'cleverbot-node',
11 silly mapToRegistry   rawSpec: '',
11 silly mapToRegistry   spec: 'latest',
11 silly mapToRegistry   type: 'tag' }
12 silly mapToRegistry uri https://registry.npmjs.org/cleverbot-node
13 verbose request uri https://registry.npmjs.org/cleverbot-node
14 verbose request no auth needed
15 info attempt registry request try #1 at 10:13:41 PM
16 verbose request id 3141ed3954628a58
17 verbose etag W/"5900ae82-78ba"
18 verbose lastModified Wed, 26 Apr 2017 14:28:18 GMT
19 http request GET https://registry.npmjs.org/cleverbot-node
20 http 304 https://registry.npmjs.org/cleverbot-node
21 verbose headers { date: 'Wed, 26 Apr 2017 22:13:41 GMT',
21 verbose headers   via: '1.1 varnish',
21 verbose headers   'cache-control': 'max-age=300',
21 verbose headers   etag: 'W/"5900ae82-78ba"',
21 verbose headers   age: '0',
21 verbose headers   connection: 'keep-alive',
21 verbose headers   'x-served-by': 'cache-sin18020-SIN',
21 verbose headers   'x-cache': 'HIT',
21 verbose headers   'x-cache-hits': '1',
21 verbose headers   'x-timer': 'S1493244821.301937,VS0,VE106',
21 verbose headers   vary: 'Accept-Encoding' }
22 silly get cb [ 304,
22 silly get   { date: 'Wed, 26 Apr 2017 22:13:41 GMT',
22 silly get     via: '1.1 varnish',
22 silly get     'cache-control': 'max-age=300',
22 silly get     etag: 'W/"5900ae82-78ba"',
22 silly get     age: '0',
22 silly get     connection: 'keep-alive',
22 silly get     'x-served-by': 'cache-sin18020-SIN',
22 silly get     'x-cache': 'HIT',
22 silly get     'x-cache-hits': '1',
22 silly get     'x-timer': 'S1493244821.301937,VS0,VE106',
22 silly get     vary: 'Accept-Encoding' } ]
23 verbose etag https://registry.npmjs.org/cleverbot-node from cache
24 verbose get saving cleverbot-node to /root/.npm/registry.npmjs.org/cleverbot-                                                                                        node/.cache.json
25 verbose correctMkdir /root/.npm correctMkdir not in flight; initializing
26 silly install normalizeTree
27 silly install loadIdealTree
28 silly install cloneCurrentTreeToIdealTree
29 silly install loadShrinkwrap
30 silly install loadAllDepsIntoIdealTree
31 silly resolveWithNewModule [email protected] checking installable status
32 silly cache add args [ 'cleverbot-node', null ]
33 verbose cache add spec cleverbot-node
34 silly cache add parsed spec Result {
34 silly cache add   raw: 'cleverbot-node',
34 silly cache add   scope: null,
34 silly cache add   escapedName: 'cleverbot-node',
34 silly cache add   name: 'cleverbot-node',
34 silly cache add   rawSpec: '',
34 silly cache add   spec: 'latest',
34 silly cache add   type: 'tag' }
35 silly addNamed cleverbot-node@latest
36 verbose addNamed "latest" is being treated as a dist-tag for cleverbot-node
37 info addNameTag [ 'cleverbot-node', 'latest' ]
38 silly mapToRegistry name cleverbot-node
39 silly mapToRegistry using default registry
40 silly mapToRegistry registry https://registry.npmjs.org/
41 silly mapToRegistry data Result {
41 silly mapToRegistry   raw: 'cleverbot-node',
41 silly mapToRegistry   scope: null,
41 silly mapToRegistry   escapedName: 'cleverbot-node',
41 silly mapToRegistry   name: 'cleverbot-node',
41 silly mapToRegistry   rawSpec: '',
41 silly mapToRegistry   spec: 'latest',
41 silly mapToRegistry   type: 'tag' }
42 silly mapToRegistry uri https://registry.npmjs.org/cleverbot-node
43 verbose addNameTag registry:https://registry.npmjs.org/cleverbot-node not in                                                                                         flight; fetching
44 verbose get https://registry.npmjs.org/cleverbot-node not expired, no request
45 silly addNameTag next cb for cleverbot-node with tag latest
46 silly addNamed [email protected]
47 verbose addNamed "0.3.8" is a plain semver version for cleverbot-node
48 silly cache afterAdd [email protected]
49 verbose afterAdd /root/.npm/cleverbot-node/0.3.8/package/package.json not in                                                                                         flight; writing
50 verbose correctMkdir /root/.npm correctMkdir not in flight; initializing
51 verbose afterAdd /root/.npm/cleverbot-node/0.3.8/package/package.json written
52 error cb() never called!
53 error This is an error with npm itself. Please report this error at:
54 error <https://github.com/npm/npm/issues>

params is not defined

Hello,

I need help, this I am creating a bot for discordapp but i have one erreur :
- u.push(params(a1[x])); params is not defined.

I present my code to test :

var fs = require('fs'); var Cleverbot = require('cleverbot-node'); const clever = new Cleverbot('API','KEY'); client.on('message', function(message){ if(message.content.startsWith('bonjour')){ console.log('Received message: ' + message); Cleverbot.prepare(function(){ clever.write(message, function (response) { client.sendMessage(message.channel, response.message); console.log('Retourned response: ' + response.message); }); }); } });

I am sorry but I am bad in english, because i speak French. I am used Google Translate, sorry.
Thank you for your answers in advance.

Authentication required

After few days of working, now I can't do any requests, even with API key.
Any idea why this happens?
Logs:

{ message: '<html>', sessionid: '\n<head><title>401 Authorization Required</title></head>', logurl: '\n<body bgcolor="white">', vText8: '\n<center><h1>401 Authorization Required</h1></center>', vText7: '\n<hr><center>nginx/1.6.2 (Ubuntu)</center>', vText6: '\n</body>', vText5: '\n</html>', vText4: '\n' }

All Requests 404 (Again)

Pretty sure they changed their (unofficial) api again.

Response:

{ message: '<html>',
  sessionid: '\n<head><title>404 Not Found</title></head>',
  logurl: '\n<body bgcolor="white">',
  vText8: '\n<center><h1>404 Not Found</h1></center>',
  vText7: '\n<hr><center>nginx/1.6.2 (Ubuntu)</center>',
  vText6: '\n</body>',
  vText5: '\n</html>',
  vText4: '\n' }

Unexpected end of JSON input

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Object.<anonymous> (../node_modules/cleverbot-node/lib/cleverbot.js:55:35)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)

I have the latest celeverbot version
and I call the cleverbot simply by using the example code

const Cleverbot = require('cleverbot-node');
var cleverbot = new Cleverbot;

cleverbot.configure({botapi: "..."});
cleverbot.write(msg == '' ? 'hi' : msg, function (response) {
  msg.reply(response.message);
});

Before I get this error I have noticed cleverbot takes more time to answer progressively and eventually leading to this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.