Skip to content

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

License

Notifications You must be signed in to change notification settings

iamtraction/cleverbot.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
Parameter Type Optional Default Description
options Object - The options for initializing cleverbot.js
options.APIKey String - The API key that you got from the cleverbot website
options.preserveState Boolean false Whether 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);
Parameter Type Optional Default Description
options Object - The options for initializing cleverbot.js
options.APIUser String - The API user that you got from the cleverbot website
options.APIKey String - 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.