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

sharding-stats

v2.4.0

Published

A cool Dashboard & Manager for showing Live Stats and managing your Discord Bot/Shards

Downloads

100

Readme

Discord Sharding Stats

An automated Sharding Stats Dashboard-Server Manager, with which you can host your Shard Stats externally!

  • Included Clustering Stats
  • Works with discord.js and discord.js sharding
  • Works with discord.js and discord-hybrid-sharding
  • Works with any other discord lib, via the customPoster Option

Download

npm i --save sharding-stats@latest

Getting started

First of all, you have to create a new File, which can be named server.js.

In the server.js File you will need to insert the Code below, and install the NPM Package express by using npm i express

Scroll down for Api References

File: server.js

const Stats = require('sharding-stats');
const express = require("express");
const app = express();

const StatsServer = new Stats.Server(app, {
    selfHost: false, // set it to true, to "self-host" the stats websites via your APP, by doing StatsServer.getStatsData(); | Data is sent via: "POST /stats" - that endpoint will be automatically assigned by the Server, if your app is a valid APP Server
    bannedUsers: [],
    bot: {
        name: "Your Bot Name",
        icon: "Your Discord Bot Avatar URL",
        website: "Your Website URL",
        client_id: "Discord Bot ID",
        client_secret: "Discord Bot Client_Secret (Not Token)"
    },
    stats_uri: "http://localhost:3000/", //Base URL. Can be IP:PORT or Domains behind a proxy or just a Domain.
                                         // https://domain.com | https://repository.username.repl.co | https://server.stats-of-me.xyz
    redirect_uri: "http://localhost:3000/login", //Landing Page
    owners: ["Bot_Owner1", "Bot_Owner2"],
    authorizationkey: "Your Password for verifying requests",
});

StatsServer.on('error', console.log)

app.listen(3000, () => {
  console.log("Application started, listening on port 3000!");
});

function receiveStatsDataManually() {
    return StatsServer.getStatsData(); // { raw, pretty }; // (raw|pretty).(shards|total);
}

You can start now start your Dashboard with node server.js.

Go to the Discord Developer Portal and to Authorization and insert your redirect_uri there

Now go to the stats_uri link or your choosen link and you should be redirected to the Dashboard with no Data.

Pushing Data of your Client on the Dashboard

Follow the upper step before doing this step.

Open your bot.js File, where you login in the Client and insert this:

File: bot.js

const Stats = require('sharding-stats');
// create ur client
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [ GatewayIntentBits.Guilds ] });

// send stats without cluster data
const Poster = new Stats.Client(client, {
    stats_uri: 'http://localhost:3000/',
    authorizationkey: "Your Password for verifying requests | Same as in Server.js",
})
/* YOUR BOT CODE STUFF */
client.login(`Your_Bot_Token`)

WAIT!

  • What if you want to post your own Shard Data with the opportunity to send MORE and CUSTOMICED Data?
  • Or what if you use a different client, than discord.js ?
  • you can do everything yourself, check out: customPoster

When you start your bot with or without Sharding, the Dashboard should show some information such as Status, Ram, Cpu, Ping, Guildcount and more data of each Shard and of all guilds in total.

API References:

new Server(EXPRESS_APP, config) && new Client(DISCORD_CLIENT, config)

| Config Options | Default | Description | | -------------- | ------------- |-------------- | | bot.name | 'required' | The Discord Bot Name | | bot.icon | 'required' | The icon url for the html page | | bot.website | 'required' | The Bot Website on the Footer | | bot.client_id | 'required' | The Discord Bot ID | | bot.client_secret | 'required' | The Discord Bot's Client Secret (Not Token) | | stats_uri | 'required' | The Base Dashboard Link | | bannedUsers | 'optional' | Array of User ids, which are banned from the API Server | | selfHost | 'false' | Boolean, if true, then only the post:/stats will be added to your app for the backend functionality | | redirect_uri | 'required' | The Discord Bot Redirect Url after authorization | | scope | ['indentify'] |Scopes, which should be used for authorization | | owners |'required' | Array of Bot Owners, which can access the Dashboard | | postinterval | 5000ms | The Post Interval of the new Client data | | login_path | '/' | The Path, where you can authorize yourself for accessing the Dashboard | | authorizationkey | 'required' | A random chosen Password/Key, which is used for verifying requests. | | markShardsDeadafter | 5000ms | How long to wait until the Shard is marked as dead on the Dashboard, when no new Data has been recieved |

Have fun! and feel free to contribute/suggest or contact me on my Discord Server or DM me TGA 3.5#8563

Bugs, Glitches and Issues

If you encounter any problems, feel free to open up an issue in our github repository or join our discord server!

Credits

Partial Credits goes to ADMIN LTE for a good Starter Template, CSS and the Plugins... Partial Credits goes to @meister03 for creating the first Version

Contributers

Thanks goes to @tomato6966 for contributing