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

blist.js

v1.1.1

Published

JS library for the blist bot list API.

Downloads

8

Readme

blist.js

Getting Started

This is the documentation for the javascript wrapper for the Blist API. This documentation includes all information about installing and using the wrapper. This API requires your bot to be using discord.js.

Installing

To install the API wrapper follow these steps:

  1. Open a command prompt in your bot's directory, or create a new directory and run npm init
  2. Run npm i --save blist.js. This will install the dependency and add it to your dependency list. (Or run npm i blist.js, not recommended)
  3. Blist.js should now be succesfuly installed.

Creating a new instance

To create a new instance for the wrapper, we must first import the module. Once we imported our module, we can create a new instance by doing this

// Common JS import
const blist = require("blist.js");

// ES6 Import
import blist from "blist.js";

//Create a new blist instance
const client = new blist(bot, apikey)

Listen for votes using a webhook

If you want to handle your bot votes, you can do so by starting a webhook.

//Create a new blist instance
const client = new blist(bot, apikey)
const bot = new discordjs.Client()

bot.on("ready" => {
  // Start a new webhook on port 4000, default port is 8000
  client.startWebhook(4000)
  
  // Stop your webhook
  client.stopWebhook()
})

// Detects when someone votes for your bot
bot.on("bot_vote", (vote) => {
    console.log(vote)
})

//Login your bot
bot.login(token)

Fetch user and bot stats

To fetch information and statistics about a user or a bot, you can use the following functions.

// Fetch bot stats
client.fetchBot(id).then((bot) => {
 console.log(bot)
})

// Fetch user stats
client.fetchUser(id).then((user) => {
 console.log(user)
})

Fetch bot votes

Fetch the votes for your bot, this requires an instance started with a bot instance and API key

// Fetch bot votes, id not required if discord.js bot client is provided on client creation
client.fetchVotes(id).then((votes) => {
  console.log(votes)
})

Post bot stats

Posting bot stats requires you to provide a discord.js client instance and an api key on client creation.

// Post bot stats
client.postStats().then(() => {
  console.log("Posted stats succesfully!")
})

Autposting bot stats

Automaticaly post bot stats, requires you to provide a discord.js client instance and an api key on client creation.

// Start autposting, interval is in minutes
client.startAutopost(15).then(() => {
  console.log("Now posting stats")
})

client.stopAutpost().then(() => {
  console.log("Stopped autoposting stats")
})