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

dblwrapper.js

v1.0.5

Published

A package where you can find everything to interact with discord botlists!

Downloads

9

Readme

Version Total Downloads

Table of Contents

About

Discord Bot List is a comprehensive library that simplifies interacting with major bot lists. It not only allows you to easily post your bot's statistics to multiple Discord bot lists but also provides various other useful functions. With this library, you can check who has voted for your bot, retrieve detailed information about bots and users, and much more. It supports popular bot listing platforms and is designed to be user-friendly.

Please note that while this library aims to support all major bot lists, some lists may not have been thoroughly tested yet.

Supported Bot Lists

| More will be added soon | | ---------------------------------------- |

Examples

Posting Bot Stats

const { BotList, BotListPoster } = require('dblwrapper.js');

const lists = [
    new BotList.TopGG('you-bot-id', 'your-top.gg-api-token')
];

const poster = new BotListPoster(lists, {
    shardCount: () =>  1,
    guildCount: () => 25,
    userCount: () => 45778,
    voiceConnectionCount: () => 3,
});
// It is adviable to use real values for the above functions

poster.postStatistics(); //Post stats once
poster.startAutoPosting(); //Post stats every 30 minutes
poster.startAutoPosting(5 * 60 * 1000); //Post stats every 5 minutes
poster.stopAutoPoster(); //Stop auto posting

Recieving Webhooks

  • This is a beta feature and is not fully tested yet
  • Webhook URL: https://example.com/receive/<list>/vote

const { BotList, Webhook } = require('dblwrapper.js');

const lists = [
    new BotList.TopGG('you-bot-id', 'your-top.gg-api-token', 'webhook-token') //Webhook URL: https://example.com/receive/topgg/vote
];

const poster = new Webhook(lists, {
port: 3000, // Port to listen on
handleAfterVote: (req, res) => {
    // Do something after a user votes
}, // This isnt required 

});
// If you don't give handleAfterVote function, it will send a 200 response to the webhook and inbuilt events will be emitted
webhook.on(Webhook.Events.Ready, () => {
    // This event is emitted when the webhook is ready
    console.log("Webhook is ready!")
})
webhook.on(Webhook.Events.NewVote, (botList, vote) => {
    // This event is emitted when a new vote is recieved
    console.log(`New vote on ${botList.key} from ${vote.userId}`)
})

Bot List Specific Functions

Top.gg

  • Importing
      const { BotList : TopGG } = require('dblwrapper.js');
  • Constructor
        const topgg = new TopGG('bot-id', 'api-token', 'webhook-password');
  • Methods
      // Get bot information from Top.gg
      topgg.getBot('bot-id').then(response => {
          console.log(response);
      }).catch(console.error);
      // Get user information from Top.gg
      topgg.getUser('user-id').then(response => {
          console.log(response);
      }).catch(console.error);
      // Check if user has voted for your bot
      topgg.hasVoted().then(response => {
          console.log(response);
      }).catch(console.error);
      /*
      true -> user voted in the last 24 hours
      false -> user didnt vote in the last 24 hours
      */