npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clevertype

v2.0.4

Published

An extensive Javascript/Typescript API wrapper for Cleverbot

Downloads

96

Readme

Clevertype

An extensive Javascript/Typescript wrapper for the cleverbot API

Get your Cleverbot API key here

Note: Only the first 5000 requests are free, you will be required to purchase a subscription or extra API calls later.

Example

Get started in just a few lines

npm install --save clevertype

With typescript

import {Cleverbot} from "clevertype"

const cleverbot: Cleverbot = new Cleverbot('api-key');

cleverbot.say('come crawling faster').then((response : string) => {
    console.log(response); // => 'obey your master!'
});

With javascript

const Cleverbot = require('clevertype').Cleverbot;

let cleverbot = new Cleverbot('api-key');

cleverbot.say('you should have known').then(response => {
    console.log(response); // => 'the price of evil'
});

Coordinate multiple conversations between users without losing context

cleverbot.say('hey there', 'john'); 
// new user = new conversation
cleverbot.say('hi friend', 'alexa');  
// new user = new conversation
cleverbot.say('how are you', 'john');
// john speaking again

Important:

If you're using a version before 1.1.3 make sure to update it as a dependency was updated to prevent random crashes.

Change cleverbot's mood:

  • Emotion: Controls how random cleverbot's responses are going to be, 0 = relevant, 100 = wtf

  • Engagement: Controls the shyness of the responses, 0 = super shy, 100 = outgoing

  • Regard: Controls how self centered her responses are going to be. Usually makes her ruder and ends up not caring about the input as much. 0 = total asshole, 100 = nice boi

// all take in a number from 0 to 100
cleverbot.setEmotion(100); 
cleverbot.setEngagement(100);
cleverbot.setRegard(0);

console.log(cleverbot.mood); // => {emotion: 100, engagement: 100, regard: 0}

You can pass in mood settings directly from the constructor as well

import {Cleverbot, Config} from 'clevertype'

const config : Config = {
    apiKey: 'your-api-key-here',
    mood: {
        emotion: 10,
        engagement: 40,
        regard: 100,
    }
};
const cleverbot = new Cleverbot(config);

Clevertype also logs the number of calls you make per session

let calls : number = cleverbot.callAmount;

Full Documentation

Read the Wiki

Changes

2.0.0 - Now supporting multi user mode which lets you coordinate conversations among multiple users with just an id.

Breaking changes

2.0.0

cleverbot.mood is now cleverbot.getMood()

TODO

  • [x] Save conversation history, this should also take into account the mood that the call was made with as well as the time and CleverbotState.
  • [x] Option to start clevertype with a multi-user mode, saving a different CleverbotState for every unique id to allow coordinating multiple conversations at once without confusing contexts for different users.

Note

As useful as it would be, currently cleverbot does not return and information on the remaining API calls for your account, to track that you would have to implement some sort of persistent database yourself.

Made for Alexa