JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q17867F
  • License GNU GPLv3

Server statistics Dashboard builder for Discord BOT through WebSocket.

Package Exports

  • socketstats

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (socketstats) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SOCKET STATS | DASHBOARD for DISCORD BOT STATS

Server statistics Dashboard builder for Discord BOT through WebSocket.

dashboard

This dasboard base on Bootstrap and chart.js. then for the comunication we open a websocket using socket.io

installing this package and complete all requirement, ur project will automatically make websocket server and open new routing following http://localost:8080/gb-status. or <project_url>/gb-status

The following example attaches project to a plain Node.JS HTTP server listening on port 8080 .

Requirement

this project require following packages:

Installation

install the package using:

$ npm install socketstats

Basic routing

then use express and create express basic routing.

The following example attaches project to a plain Node.JS HTTP server listening on port 8080 .

const express = require("express");
const app = express();
const _PORT = process.env.PORT || 8080;

// routing
//.....
//.....
// routing end

// common case listening port given by express
app.listen(_PORT, () => {
    console.log("Listening to port: "+_PORT);
})

to make WebServer and WebSocket run in singgle server. You need to pass the Server to socketstats, and not the express application function. Also make sure to call .listen on the server, not the app.

then for gathering info from the bot we need authorize client fom discord. so we do listen to port after te bot is ready.

const express = require("express");
const app = express();
const _PORT = process.env.PORT || 8080;

// routing
//.....
//.....
// routing end

// common case listening port given by express
// app.listen(_PORT, () => {
//     console.log("Listening to port: "+_PORT);
// })

// basic discord,js BOT requirement
const Discord = require("discord.js");
const client = Discord.Client();

// some handler command
// .....
// .....

client.on('ready', () => {
    console.log('Ready..!')

    // socketStats Configuration
    const socketStats = require("socketstats");
    const server = new socketStats(app, client);

    // open / listen port using socketStats
    server.listen(_PORT, () => {
        console.log("Listening to port: "+_PORT);
    });

});

// basic discord.js BOT login method
client.login(Token)

License

GNU GPLv3