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

@sefinek/cleverbot-free

v2.1.5

Published

Simple and unofficial NPM module for interacting with the same API used by the Cleverbot website. Available for free!

Downloads

7

Readme

This module allows developers to interact with the Cleverbot API without needing an official API key, providing a convenient and cost-effective way to integrate Cleverbot chatbot features into their projects.

⚠️ Warning

Using this module could potentially lead to a permanent IP ban on cleverbot.com, although this is unlikely.

This module provides free access to Cleverbot's API, but it is crucial to use it responsibly, keeping in mind that Cleverbot.com may act against IP addresses that misuse their service. Therefore, consider the following guidelines:

  • Use Responsibly: Avoid excessive requests to Cleverbot in a short period. Adhere to their terms of service.
  • Testing and Development: Ideal for testing and development purposes. Not recommended for high-traffic or production applications to prevent IP bans.
  • Use at Your Own Risk: Users assume responsibility for any potential consequences, including IP bans or other actions by Cleverbot.com.
  • Consider Official API Key: For extensive and commercial use, consider obtaining an official API key from Cleverbot for reliable and uninterrupted access.

📥 Installation

Install this module using npm 🟥 or yarn 🐈:

npm install cleverbot-free
yarn add cleverbot-free

🔧 » Documentation

CleverBot.interact(message, context[], language)

A function for interacting with the Cleverbot API. It processes the provided message, context, and language, then returns a response from Cleverbot.

  • message (string, required): The message that the user wants to send to Cleverbot. This is the primary text to which Cleverbot will respond.
  • context[] (array, required): An array containing the history of previous messages in the conversation. Used to maintain the context of the conversation. Each element of the array represents one line of dialogue.
  • language (string, optional, default: en): The language in which the conversation is to be conducted.

CleverBot.config(configurationObject)

Configures the settings of the Cleverbot module. This function allows you to set various options that affect how the module interacts with the Cleverbot API.

  • configurationObject (object, required): An object containing configuration settings.

    | Property | Default value | Description | |----------------------------------------------------------------------------------------------|----------------------------|-----------------------------------------------------------------------------------------------------| | debug | false | Enables or disables debug mode. When enabled,the module provides detailed debug information. | | selectedLanguage | en | Sets the default language for the Cleverbot conversations. | | maxRetryAttempts | 3 | Specifies the maximum number of retry attempts forthe API call if it fails initially. | | retryBaseCooldown | 3000(3 seconds) | Determines the base cooldown period in millisecondsbefore retrying an API call after a failure. | | cookieExpirationTime | 15768000(4.38 hours) | Sets the time in milliseconds after which the cookieshould be refreshed. |

CleverBot.getData()

Retrieves the current session data and other relevant information.

CleverBot.newSession()

Allows for the deletion of the current session and the initiation of a new one. The conversation context should also be removed.

  • Returns: Nothing.

CleverBot.version

A property that represents the current version number of the cleverbot-free module, conforming to the Semantic Versioning (SemVer) standard.

  • Returns: A string that specifies the current version of the module.

💬 Example (see also example.js)

const CleverBot = require('@sefinek/cleverbot-free');

CleverBot.config({
    debug: false,
    defaultLanguage: 'en',
    maxRetryAttempts: 5,
    retryBaseCooldown: 4000,
    cookieExpirationTime: 15768000
});

const message = 'Do you like cats? >w<';
const context = [];

(async () => {
    const response = await CleverBot.interact(message, context); // `Input`, `conversation context`, `language` is not required if you are using `CleverBot.config` with `defaultLanguage`

    /*
     * Add the user's message first to the context followed by Cleverbot's
     * response to maintain the correct conversational order.
     */
    context.push(message); // User's message 
    context.push(response); // Cleverbot's response

    console.log(response);
})();

🤔 What can this module be used for?

  • Your Discord Bot
  • Do you have additional ideas for utilizing this module? Create a Pull Request and contribute them here!

💙 Thanks

If you require any assistance or have questions regarding this module, don't hesitate to open a new GitHub Issue. Your feedback and contributions are highly appreciated. If you find this module valuable and useful for your projects, we kindly invite you to show your support by giving it ⭐ a star on GitHub. Thank you for using cleverbot-free!

🔖 Credits

It is inspired by the IntriguingTiles/cleverbot-free project.

📝 MIT License

Copyright 2023-2024 © by Sefinek. All Rights Reserved.