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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ifunnychatbotapi

v0.4.0

Published

API for an iFunny chat bot

Readme

How to setup

You need a file or JSON format to pass into the function returned from require. for example:

const api = require('ifunnychatbotapi')(require('./config.json'));

The JSON should have this structure:

{
    "apiUrl": "https://api.ifunny.mobi/v4/",
    "appId": "AFB3A55B-8275-4C1E-AEA8-309842798187",
    "userAgent": "User-Agent: iFunny/5.8(8082) Android/8.0.0 (samsung; samsung; SM-G955U)",
    "bearerToken": "...",
}

Feel free to change apiUrl, appId, or userAgent if needed. You will need to gather the bearerToken.

The way to gather this parameter is by monitoring the requests coming out of iFunny using a tool such as Fiddler, Burp Suite, or Charles Proxy

  • bearerToken is the request sent in the Authorization header on each request to the /v4/ endpoint. Do not include the 'Bearer ' part.

Note: In the future the module should have authentication with only your email and password. Currently you will have to write your own library for generating bearer tokens. However, I have a library of mine and just have to implement it.

Now that you have the token set up, you can start writing code. The Api class inherits EventEmitter. This means that you can ask the API when stuff is ready or when it happens. Here's an example for a bot that echos back to a user.

// Require the API
const api = require('ifunnychatapi')(require('./config.json'));
// Start listening for messages once the bot has connected
api.once('ready', () => {
    // When the bot receives a message
    api.on('message', message => {
        // Send @username {text}
        message.reply(message.text);
    });
});

Here's an example that automatically joins chats when invited.

// Require the API
const api = require('ifunnychatapi')(require('./config.json'));
// Start listening for messages once the bot has connected
api.once('ready', () => {
    // When the bot receives a invite
    api.on('invited', chatUrl => {
        // Joins the channel with the chatUrl that was given from the invite
        api.joinChannel(chatUrl);
    });
});

Here's an example that sends a file to the chat.

// Require the API
const api = require('ifunnychatapi')(require('./config.json'));
// Start listening for messages once the bot has connected
api.once('ready', () => {
    // When the bot recieves a message
    api.on('message', message => {
        // Creating a new command: .image
        // Checks if the message sent is .image
        if (message == '.image') {
            // Sends the image
            api.sendFile('https://pbs.twimg.com/profile_images/865062880168759297/yualzpn3.jpg', message.channelUrl, 'jpeg');
        }
    });
});

There are some other features that are currently undocumented.