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

dbd.express

v1.0.1

Published

DBD.JS - Dashboard Package

Downloads

21

Readme

DBD.JS Express

A Website Package dependent for DBD.JS Dashboard

Example Usage

const dbdExpress = require("dbd.express")
const dbdjs = require("dbd.js")

const bot = new dbdjs.Bot({
  //Options
})

const Dashboard = new dbdExpress(bot)
Dashboard.API({
  port:3000,
  useSecureProtocol:true,
  authorizationKey:"Bearer root@1234"
})

Methods

Package

  • Package( DBDJSClient ) - The constructor of Package

Constrcutor

  • < Package Constrcutor >.API({ API Options }) - A method to create the API for people to be able to Access the Bot from any Website (Dashboard Purpose)
  • < Package Constrcutor >.UI() - A method to create a UI, allow people to be able to modify from Website with Accounts

NOTE

  • Adding Accounts can be seen in documentation
  • Added an extra property Express in client of $djsEval and Bot.client

Options

API

  • port [ Number ] - The port for Express to Listen
  • useSecureProtocol [ Boolean ] - An option for Request to be redirected to https if request is using http
  • authorizationKey [ String ] - A key that should be provided in Request Headers before Accessed the API
  • debug [ Boolean ] - A mode to get API Activity

Access the API

You will need to provide a Header Authorization Key to access the API and also Content-Type as application/json to Send Body

headers:{
  'Authorization': "Bearer root@1234",
  'Content-Type': "application/json
}

API Methods

We only accept JSON for POST, PATCH, DELETE Request

GET

  • /api/client - Returns a Discord Client
  • /api/commands - Returns an Array of Client Commands
  • /api/variables - Returns an Array of Client Variables
  • /api/accounts = Returns an Array of Created Accounts

POST

  • /api/commands - Send a POST Request with body to make a new Command Required:
  • Body - The Body of Request
  • Body.command - The Command Data (typeof data == object) Example Request:
body:JSON.stringify({
  command:{
    name:"ping",
    callback:"command",
    code:"Pong!"
  }
})

Response:

status:"SAVED",
received_body:{
  command:{
    name:"ping",
    code:"Pong!"
  }
}
  • /api/variables - Send a POST Request with body to modify Variables Required:
  • Body - The Body of Request
  • Body.variables - The Variables data (typeof data == object) Example Request:
body:JSON.stringify({
  variables:{
    money:0,
    bank:0,
    myname:"Matthew"
  }
})

Response:

status:"SAVED",
received_body:{
  variables:{
    money:0,
    bank:0,
    myname:"Matthew"
  }
}

PATCH / UPDATE

  • /api/commands - Send a PATCH Request with body to modify a command Required:
  • Body - The Body of Request
  • Body.target - Command Target that will be modified (typeof data == object) Example Body.target:
{
  id:"ID of Command (Number)"
}
TARGET DATA MUST BE EXACTLY AS THE COMMAND THAT EXIST IN CLIENT COMMANDS
  • Body.update - The Command data that will modify Targetted Command (typeof data == object) Example Request:
body:JSON.stringify({
  target:{
    id:"12345"
  },
  update:{
    name:"ping",
    callback:"command",
    code:`Pong! My Ping is $botPing Miliseconds`
  }
})

Response:

status:"UPDATED",
received_body:{
  target:{
    id:"12345"
  },
  update:{
    name:"ping",
    callback:"command",
    code:`Pong! My Ping is $botPing Miliseconds`
  }
},
target:{command} // Found command by ID

DELETE

  • /api/commands - Send a DELETE Request with Body to delete an existing command Required:
  • Body - The Body of Request
  • Body.target - The Target to delete the Command
TARGET DATA MUST BE EXACTLY AS THE COMMAND THAT EXIST IN CLIENT COMMANDS

Example Request:

body:JSON.stringify({
  target:{
    ID:"ID of Command (Number)"
  }
})

Response:

status:"DELETED",
received_body:{
  target:{
    ID:"12345"
  }
}
  • /api/restart - Restart the API and Client Required: None Response:
{
message:"ACCEPTED, SHUTDOWN IN 3 SECONDS"
}

Programmatic

You can access with client.Express in $djsEval or Bot.client

Available Options

  • addAccounts(data) - Add accounts for UI
  • updateAccount(target (ID of an Account), newData, callback) - Edit an Account to the new Data
  • deleteAccount(target (ID of an Account), callback) - Deletes an Account
  • addCommands(data) - Add commands to Bot
  • loadBotCommands() - Load all bot Commands to store in Database, later use for UI
  • editCommand(target (ID of command), newData, callback) - Edit a Command
  • deleteCommand(target (ID of command), callback) - Delete a command
  • restartProject() - Restarts the Project after 3 seconds
  • Variables - Return Bot Variables
  • Commands - Return Bot Commands
  • ACCOUNTS - Return an array of UI Accounts
  • refreshBotCommands() - Reload UI Commands