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

batmansay

v3.1.0

Published

batmansay is a configurable talking character from batman

Downloads

34

Readme

batmansay

BATMAN

❖ What is batmansay?

This project is an adaptation of cowsay which is a popular Unix program but instead, it randomly outputs ASCII art from the Batman universe and some of their famous quotes

What to expect?

The commands batmansay and batmanthink print a random character from the Batman universe in your SHELL. Each character has a weight depending on its rarity. The number of stars next to the character's name represents the rarity of the character. The more stars, the more rare the character is.

❖ Install

npm install -g batmansay

❖ Usage

To randomly select a character from the batman universe and one of their quotes batmansay

To list the available characters batmansay -l

To display a specific character batmansay -f joker

To let the character say the custom text after the command and the options if passed batmansay my custom text

OR you can simply generate the text with another tool and pipe it into batmansay like the following: echo "My random text" | batmansay

JOKER

or

replace batmansay of the above commands with batmanthink

The batmanthink command shows the characters as if they are thinking instead of saying something

You can also run batmansay -h for help

Feel free to add the command to your .bashrc or .zshrc files so you can have a character greeting when you first open your shell. Or perhaps your CI/CD pipeline to pipe the error logs into batmansay

OpenAI integration

If you want to use OpenAI integration to generate a random quote from ChatGPT for the randomly chosen character, you can follow these steps:

  1. Generate an API key from OpenAI by visiting the OpenAI Developer Dashboard.

  2. Set the environment variable TOKEN_OPENAI to your API key. You can do this by adding the following line to your shell configuration file (~/.bashrc for Bash, ~/.zshrc for Zsh, ~/.config/fish/config.fish for Fish):

    export TOKEN_OPENAI=YOUR_API_KEY

    Alternatively, if you're using Node.js for development purposes, you can create a .env file in the root directory of your project with the following content:

    TOKEN_OPENAI=YOUR_API_KEY

    This will allow you to access your OpenAI API key in your Node.js code through the process.env.TOKEN_OPENAI variable.

Once you have set the TOKEN_OPENAI environment variable, batmansay will use it to generate a random quote for the randomly chosen character.

❖ Contribution

Make sure to add a character file character_name.js in the characters directory. Replace character_name with the name of the character. Add the ascii image to the file and export it. Please see the other characters as examples.

Also, make sure to add a file with the same name in the quotes directory. The file of the quotes, exports an array of strings where each string is one of the quotes from your specific character.

Last but not least, you must add the character array in the file characters.js where the first entry in the array is the character's name and the second entry is the rarity where 0 is the rarest and 10 is the most abundant.

Please feel free to fork it and contribute. Whether by suggesting new features or simply adding characters from the batman universe with their quotes.