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

discordapilink

v1.1.2

Published

discordapilink: Seamlessly connect your Discord bot to its dashboard using a simplified API. Effortlessly establish secure communication in just a few lines of code and under 5 seconds.

Downloads

44

Readme

Version Forks Stargazers Issues MIT License Discord Support

Discord Api Client

Managing the interaction between Discord bots and their dashboards can be a complex task, often involving tedious API connections and data synchronization. Enter discordapilink – a revolutionary package designed to empower Discord bot developers with effortless dashboard integration.

Why?

  • Simplified Integration: Eliminate the need for intricate API connections. discordapilink provides a straightforward way to establish secure communication between your bot and its dashboard.

  • Effortless Data Exchange: Sending and receiving data between your bot and its dashboard is a breeze. Enjoy a smooth and intuitive process that enhances the overall user experience.

  • Rapid Setup: With minimal code, you can set up your bot's connection to the dashboard. Spend less time on setup and more time refining your bot's features.

  • Comprehensive Documentation: Our extensive documentation guides you through every step of the integration process. Whether you're a seasoned developer or just starting, you'll find the resources you need to succeed.

  • Don't let dashboard integration slow down your Discord bot's development. Experience the power of discordapilink and revolutionize the way your bot interacts with its dashboard.

How does it work?

discordapilink uses a packages like express, next etc.. as engines to form connection to establish a secure, real-time connection between your bot and its dashboard. This connection allows you to send and receive data between your bot and its dashboard with ease.

See below for guides on how to use discordapilink with your bot.

Download

npm i discordapilink
------ or ---------------------
yarn add discordapilink

Setting Up

first of all, you would need to create a build process for sending and receiving data between your bot and its dashboard. While using Api

Building the Server

const { Build } = require('discordapilink');
const i = await new Build() // Start the build process by calling the build class and store it for later use
        i.setApis(["/api1","/api2"]); // you can add as many apis as you want 
        i.setWebsockets(["/ws"]) // you can add as many websockets as you want
        i.setEngine("express"); // Select a engine
        i.setPort(3000) // set a port where u wanna start the server
        i.build() // build the server **!Important** 

Build Options

  • setApis - set the apis for the server
  • setWebsockets - set the websockets for the server
  • setEngine - set the engine for the server
  • setPort - set the port for the server
  • build - build the server !Important - build should be called at the end of the build process

Extra Options - Should not be used while building the server

  • getApis - get the apis currently loaded in the server
  • getWebsockets - get the websockets currently loaded in the server
  • getlength - get the length of apis loaded
  • getlogs - get the logs of the server runtime Or Error
  • clearlogs - clear the logs of the server runtime Or Error

Sending Data through Api

const { Api } = require('discordapilink');
const a : Api = await new Api();
        const testData = {
            apiName : "api1",
            guild: message.guild?.name,
            channel: message.channel.id,
            user: message.author.id
        } // Example Data<Object>. can be anything
        
    a.setData({test: testData}) // set the data to be sent can be anything
    a.setMessage("This is a test message Check Status 200 OK") // set the message to be sent can be anything
    a.setStatus(200) // set the status code to be sent can be anything but sucess codes are recommended
    a.send("api1"); // send the data to the api

Api Options

  • setData - set the data to be sent
  • setMessage - set the message to be sent
  • setStatus - set the status code to be sent
  • send - send the data to the api

Receiving Data through Api

const { Api } = require('discordapilink');
const a : Api = await new Api();
    a.receive("api1") // receive the data from the api where data was sent

Sending Data through Websocket

const { Websocket } = require('discordapilink');
const ws : Websocket = await new Websocket();
        const testData = {
            WebsocketName : "ws",
            guild: message.guild?.name,
            channel: message.channel.id,
            user: message.author.id
        } // Example Data<Object>. can be anything
        
    ws.setData({test: testData}) // set the data to be sent can be anything
    ws.send("/ws"); // send the data to the api or ws.send("ws")

Websocket Options

  • setData - set the data to be sent
  • send - send the data to the websocket

Infomative operations

const { Build } = require('discordapilink');
/**
 * The Build class is used to build the server 
 * Important - Informative options should be used after the build process is completed
 */
//assuming that the build process is completed and is stored in a variable called i
i.getApis() // get the apis currently loaded in the server
i.getWebsockets() // get the websockets currently loaded in the server
i.getlength() // get the length of apis loaded
i.getlogs() // get the logs of the server runtime Or Error
i.clearlogs() // clear the logs of the server runtime Or Error

Examples