2.0.0 • Published 6 years ago

cleverbot.js v2.0.0

Weekly downloads
5
License
GPL-3.0
Repository
github
Last release
6 years ago

cleverbot.js

A Node.js Cleverbot API wrapper library. Go make a chat bot in a flash!

It supports both cleverbot.com and cleverbot.io

GitHub release Dependencies Known Vulnerabilities license Say Thanks!

Table of Contents

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. I recommend installing the latest LTS version of Node.js.

Installation is done using the npm install command:

$ npm install cleverbot.js --save

Usage

Constructor

new Cleverbot.com(options);
ParameterTypeOptionalDefaultDescription
optionsObject-The options for initializing cleverbot.js
options.APIKeyString-The API key that you got from the cleverbot website
options.preserveStateBooleanfalseWhether to preserve the state of the conversations.

Example

const Cleverbot = require('cleverbot.js');
let options = {
  APIKey: 'CFDoi4234falFOFaSfwepxXhBRW',
  preserveState: true
};
cleverbot = new Cleverbot.com(options);

cleverbot.write('Hi how\'re you?').then(response => {
  console.log(response.output); // Fine, how're you?
}).catch(e => {
  console.error(e);
});

Constructor

new Cleverbot.io(options);
ParameterTypeOptionalDefaultDescription
optionsObject-The options for initializing cleverbot.js
options.APIUserString-The API user that you got from the cleverbot website
options.APIKeyString-The API key that you got from the cleverbot website

Example

const Cleverbot = require('cleverbot.js');
let options = {
  APIUser: 'FaSfwepxX34falFO',
  APIKey: 'CFDoi4234falFOFaSfwepxXhBRW'
};
cleverbot = new Cleverbot.io(options);

cleverbot.init().then(nick => {
  cleverbot.write('Hi how\'re you?', nick).then(response => {
    console.log(response.output); // Good, and you?
  }).catch(e => {
    console.error(e);
  });
}).catch(e => {
  console.error(e);
})

Contributors

List of all contributors

License

GPL-3.0

If you liked this project you can ⭐ Star it on GitHub to show your love and/or send a thank you note.