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

cloudlist.js

v1.2.5

Published

The official cloud-botlist.xyz API wrapper for Node.js

Downloads

29

Readme

CBL API

A very simple package to post stats / retrieve stats of bots from the Cloud Bots List API.

Usage

const cbl = require('cloudlist.js');

Getting stats

Params:

botID - The user ID of the bot whose stats and information are being retreived

cbl.getStats(botID);

Response:

Returns a Promise that resolves to:

{
  id: string, // The bot's user ID
  prefix: string, // The bot's prefix
  owner: Array<string>, // An array of the bot's owners' IDs, can sometimes be more than one ID
  library: string, // The library the bot uses
  description: string, // The bot's short description
  longDescription: string, // The bot's long description
  certified: boolean, // Is the bot certified?
  pageURL: string, // The bot's page on SBL
  website?: string // A URL leading to the bot's website
  support?: string // The code for the invite to the bot's support server
  github?: string // The bot's GitHub repository
  servers?: number, // The bot's server count, (sometimes doesn't exist)
  users?: number, // The bot's user count, (sometimes doesn't exist)
  votes: number // The amount of users that voted for the bot on the website, can be 0
}

Posting stats

Params:

client - discord.js / Eris Client - The bot whose stats are being posted

apiKey - String - The CBL API key

[Optional] log - Boolean - Wether to console.log after posting (defaults to true)

[Optional] serversOnly - Boolean - Wether to only post the server amount or also the user (default to false)

cbl.postStats(client, apiKey);

Response:

if log is true,

Logs:

[CBL] Server count was updated to newServerCount

and if serversOnly is false, also

[CBL] User count was updated to newUserCount

Returns a Promise that resolves to:

{
  servers: number // The newly-posted server count
  users?: number  // The newly-posted / already stored user count, if exists
}

Examples

// Get stats
cbl
  .getStats('bot_id')
  .then(console.log)
  .catch(console.error);
// Post stats
cbl
  .postStats(client, 'API_KEY') // Post server and user count
  .then(console.log)
  .catch(console.error);
cbl
  .postStats(client, 'API_KEY', null, true) // Post ONLY server count
  .then(console.log)
  .catch(console.error);

Notes

Uses node-fetch

Additional Resources

Cloud Bots List