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

@tinypudding/discord-firebase-async-server

v1.4.16

Published

System for synchronizing Discord Bots with the Firebase.

Downloads

14

Readme

Discord Firebase Async Server

This server is used to create sub-servers that will receive or send data to Firebase via a normal NodeJS server.

Example? Firebase's servers always have a small delay to load the script when the server goes without being called for a long time. You can use this server to send a response to Discord-Interactions more quickly and then send the final request to your Firebase server run the rest of the script to send the final response to the Interaction Request.

You can also use this server to access a bot monitoring panel.

Connecting a gateway bot will also allow you to send your interactions via the Discord.JS API.

JSON Config

You will need to create a JSON file to configure your server.

{
    "firebase": {
      "apiKey": "",
      "databaseURL": "",
      "projectId": "",
      "appId": ""
    },
    "cookieSession": {
      "keys": [
        "",
        ""
      ]
    },
    "discord": {
      "apps": {
        "test": {
          "client_id": "",
          "public_key": "",
          "waitMessage": "Loading your message..."
        }
      },
      "auth": {
        "client_id": "",
        "client_secret": ""
      }
    },
    "web": {
      "slashCommandListener": {
        "enabled": true,
        "function": "",
        "token": "",
        "id": "",
        "waitMessage": "Loading your message..."
      },
      "botChecker": true,
      "memoryChecker": {
        "interval": 5000,
        "historyLimit": 5000
      }
    },
    "localhost": "localhost:3000",
    "domain": "",
    "crypto": ""
  }

firebase (Object)

These are the Firebase definitions that will be loaded by the the firebase client module. The module name is "firebase". (This is not the "firebase-admin" module!)

cookieSession (Object)

Insert all the settings of the cookie-session module here.

discord (Object)

Authentication settings for your website monitoring your Discord Bots. For security reasons, it is recommended that you create an application in Discord exclusively for this function.

web (Object)

Choose which module features you want to activate.

homepageRedirect (String)

Choose a page where the user will be redirected when trying to access the domain. Changing this value, you will have to log in to the website using the path "/login".

slashCommandListener (Object)

Slash Commands server client settings.

slashCommandListener.function (String) - Name of the function you are hosting within Firebase via the module path "@tinypudding/firebase-discord-interactions/functionListener/firebaseCallback/server". This function will receive the request received by the URL of slashCommandListener.

slashCommandListener.objString (Boolean) - The data shown on the console will be a string instead of an Object.

slashCommandListener.enabled (Boolean) - Activate a special URL to receive your bot's interactions via your Firebase server.

slashCommandListener.id (string) - Special security ID of your URL that will be read by the Discord Interaction API Webhook.

slashCommandListener.waitMessage (string) - This message will be displayed while the server processes the rest of the script.

slashCommandListener.token (String) - Security token of your Firebase server that is receiving the interactions.

botChecker (Boolean)

Activate your bot's monitoring website.

memoryChecker (Object)

Memory analyzer settings.

memoryChecker.interval - Interval time to send the application's memory usage update. Setting a null value will disable the functionality.

memoryChecker.historyLimit - Limit of memory logging. Setting a null value will disable the functionality.

localhost (String)

Localhost domain that will be used in your server test.

domain (String)

Domain name of your server.

crypto (String)

Crypto Key. Enter a value that is at least 32 characters long.

Slash Command Listener

If you have activated the Slash Command Listener, your server will activate a URL to use in your Discord's Slash Command webhook. This URL will send a response to the Discord and allow your Firebase server to do the rest of the work.

ID

The value "slashCommandListener.id" used in your config file.

Domain

The domain from the value "domain".

Bot ID

This is the ID of your bot that you defined in the app settings. Example: The Bot ID of the object path of "cfg.discord.apps.test" is "test".

Your URL

https://{domain}/interactions/endpoint?id={ID}&bot={bot-id}

File Example

you can find a file in the path "/test/index.js". This file contains an example on how to write the code to use the module.