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

@discordia/framework

v1.5.0

Published

The main discordia framework

Downloads

5

Readme

Note: Some of the links in this README file work better on the documentation site

Installation

# install the module using npm
npm install @discordia/framework

# install the module using yarn
yarn add @discordia/framework

Kitchen Sink Example

const DiscordiaFramework = require('@discordia/framework');
// actions is an array of DiscordiaAction objects
const actions = require('./actions');
const options = {
  name: 'myBot',
  caseSensitiveName: false,
  missingCommandMessage: 'The command you tried to send was not available',
  help: 'You should probably configure a useful help message or leave the default',
};

const myBot = new DiscordiaFramework('DISCORD_BOT_TOKEN', actions, options);

// Set up the event listeners and log the bot in using the provided token
myBot.start();

Usage

Every Discordia framework is made of three pieces: a token, an array of actions, and a set of optional options.

Token

String

Your private Discord bot token. The token for your bot should be located at https://discordapp.com/developers/applications/{client-id}/bot (replace {client-id} with the Client ID of your Discord application) in a hidden field that you can reveal by clicking "Click to Reveal Token". This guide will help you make a new Discord bot if you have not done so before.

⚠️This token is a sensitive piece of information. DO NOT commit it with your source code. Regenerate it if it ever becomes compromised.⚠️

Actions

Array[DiscordiaAction]

An array of DiscordiaAction objects. See our guide on how to use the @discordia/action module to create your own actions. You can also install them from third party modules.

Options

Object

The options object is prepopulated with overrideable defaults. More in-depth explanations of the available options are below. |Option|Default| |---|---| |name|undefined| |caseSensitiveName|false| |missingCommandMessage|"The command you typed is not available 🙁"| |help|@discordia/default-help|

name

String - Default = undefined

Your discord bot will see all messages sent in a server you invite it to. By default, it will only respond when you @ the bot. If name is set then the bot will instead respond to any message that begins with a string matching name. By default this is not case sensitive but you can set caseSensitiveName to true if you want the name to be case sensitive.

caseSensitiveName

Boolean - Default = false

Controls whether or not the bot name should be treated as if it is case sensitive. This field is ignored if name is not set.

missingCommandMessage

String|Function - Default = "The command you typed is not available 🙁"

The message to send if a server member tries to ask the bot to do an action it does not know how to handle. You can either customize the string or provide a function to give a more involved response.

help

String|Function - Default = @discordia/default-help

The message to send if a server member tries to ask the bot for help. By default it will use @discordia/default-help to read your actions and send a response based on their accessors and descriptions. You can provide null to disable the help message or provide a custom DiscordiaAction to control what the message responds to and what it says.

Testing

🚧 Coming Soon! 🚧