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

discord-botlists

v1.0.8

Published

Multi-Discord-Botlist Management Package with 40+ Botlist Supported with Events and Stats Update Methods

Downloads

12

Readme

Multi-Discord-Botlist Management Package with 40+ Botlist Supported with Events and Stats Update Methods and More to Add if you want

Installation

Install discord-botlists

$ npm install --save discord-botlists

Documentation

Bot-List Notices

Features

  • Upvote/Vote Events Support 🚗
  • Stats Posting Feature for Discord Bots to Multiple Botlists
  • Better Event Handlers and Request Handlers
  • Better Body Parsing for Incomplete request ( HTTP Post Request )

Scheme :

// Discord Bot Lists Data from the Client Side to the Official package

/**
 * "authorizationToken" -> Example Value -> "EyTYRbGciOiJIUasdIFAnR5cCI6IasApXVCJ9.eyJsaLPOsadadw423zMTQzMTM5NTc0NTk4HJKSIsImJvdCI6dad" -> Very Secret Botlist Token and Bot Specific and unique and need to hide for security
 * "authorizationValue" -> Example Value -> "Discord_Bot_1234OP" -> Self Made jsut to check for vote Webhooks
 **/

var discordBotlistData = {
  bladebotlist: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  topgg: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  boatspace: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  botlistme: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  botrix: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  discordlabs: {
    authorizationToken: "xxx-secrettokenhere-xxx",
    authorizationValue: "xxx-selfmade-AuthorizationValue-xxx",
  },
  //... "authorizationToken" is something secret and important where you had to "regen" in botlist's webhook page . and its quite long like larger than 25 characters at size
  //... many other botlist data just like above and where "authorizationValue"'s value should be value for "Authorization in HTTP POST request"
};

// Webhook Scheme
var webhookEndpoint = "discord-botlists";
// It will start accepting get and post request to -> "http://localhost:8080/discord-botlists" , where you can change listener port and ip address for pterodactyl users

Point to be Noted :

discordBotlistData Example from : discordBotlistData Structured Data | Where Object-Inner Values get changed with "authorizationToken" and "authorizationValue" Values | Only the name of the main key of the botlist is request like First one was "bladebotlist"

Example Code :

const { BotLists } = require("discord-botlists");

// webhookEndpoint and discordBotlistData is from above scheme
const Botlist = new BotLists(
  "discord-botlists",
  discordBotlistData,
  8080,
  "127.0.0.1"
);

// Starting Botlists Vote Event webhook listening

new Promise(async (resolve) => {
  resolve(
    await Botlist.start(
      "discord-botlists",
      "https://github.com/SidisLiveYT/discord-botlists"
    )
  );
});
// Start Accepting vote Events , even the test votes from every Botlists where your webhook url has been saved in their Webhook manage page

Botlist.on("vote", (websiteName, jsonBody, timestamp) => {
  console.log("Website Name : " + websiteName);
  console.log("Vote Json Data : " + jsonBody);
  console.log("Date/Time : " + timestamp);

  // ... call back function work here ...
});

// Botlists to send Bot Stats to multiple botlist at the same time

new Promise(async (resolve) => {
  resolve(
    await Botlist.poststats(
      {
        bot_id: undefined,
        server_count: undefined,
        shards: undefined,
        shard_id: undefined,
        shard_count: undefined,
      },
      false,
      undefined,
      true,
      true
    )
  );
});
// Above Data should replaced with undefined with appropiate data for post request

// OR Post using AutoPoster on every 2 * 60 * 1000 Milli-Seconds

var Interval_Id = Botlist.autoPoster(
  {
    bot_id: undefined,
    server_count: undefined,
    shards: undefined,
    shard_id: undefined,
    shard_count: undefined,
  },
  undefined,
  10 * 60 * 1000,
  false,
  true
);

// Posted Event for acknowledment of the Data Stats has been Posted successfully
Botlist.on("posted", (formatedResponse, timestamp) => {
  console.log("SuccessRate or Failure Rate : " + formatedResponse);
  console.log("Date/Time : " + timestamp);
  // ... call back function work here ...
});

// Handle Error Event to Ignore Un-Handled Error on Console and avoid Application Crash
Botlist.on("error", (message, extraData, timestamp) => {
  console.log("Error Message : " + message);
  console.log("Related Data with Error : " + extraData);
  console.log("Date/Time : " + timestamp);
  // ... call back function work here ...
});

Links