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 🙏

© 2025 – Pkg Stats / Ryan Hefner

discord-bot-framework

v1.1.13

Published

A framework from a discord bot

Readme

discordjs-bot-framework

About

An easy to use framwork for Discord bots, using the discord.js library.

Installation:

npm install discordjs-bot-framework

GitHub

Use:

Your main bot file

const DFW = require("discordjs-bot-framework");

let TestBot = new DFW.Client({
	author: "your_discord_id_here", //this is used to check if the 	message was sent by the bot creator for ownerOnly commands
	name: "bot_name_here", //your bots username will be set to this when it logs in
	prefix: "$$", //this is used as the prefix for any command your bot will respond to.  The bot will also respont to @mentions followed by command triggers.
	cmddir: require('path').join(__dirname, 'commands'), //this is the directory of your command folder.
	token: "your_token_here", //this is your bots token.  It is used to log in as the client, and hence, should not be shared.
	MentionsTrigger: true //if this is true, @mentions followed by commands will trigger said command.
});

TestBot.login();

An example command file

const DBF = require('discordjs-bot-framework');

module.exports = class Hello extends DBF.Command{
    constructor(){
        super({
             name: "hello", //is pretty much just another trigger, but can be used filter commands.
             triggers: ["hi", "hello"], //any message (excluding prefix) that will trigger this command.
             group: "Misc", //this command will come under this group in the automatic help message.
             ownerOnly : true, //if this command is to be used by the bot creator only.
             description: "sends hello in the channel", //this will show in the help message
             guildOnly : true, //any command that refers to a guild with the discord.js library will crash if it triggered in a dm channel.  This prevents that
	     reqArgs: true, //if your command requires any args after the command, this will add them as msg parameters
	     reqUser: true //if your command requires an @mentioned user, this will find them add them as msg parameters
        });
    }

    run(params = {"msg": msg, "user": user, "args": args}){ //all the code for your command goes in here.
        message.channel.send("Hello" + params.args);
    }
}

Methods and Properties

(note: all of the methods/properties attatched to client can be called from anything that links to client in the discord.js library)

Client.getArgs(message) : gets any arguments after the command in a message note: if your bot is using MentionsTrigger, you'll definately want to use this

Client.findUser(message) : finds a user based on an @mention or a username note: if your bot is using MentionsTrigger, you'll definately want to use this

Client.Prefix: The bots prefix.

Client.Name : The bots name.

Client.Author[read only] : The authors discord ID, string.

Client.Token[read only] : The clients token used to log in, string.

Client.CommandsDir : The commands directory, string.

Client.getHelp(message) : gets a help message based on your command triggers and descriptions.

Client.Commands : gets an array of commands from the client, array of Commands.

Client.MentionsTrigger : if @mentioning the client, followed by a command will trigger the command. Boolean

Command.run(message) : runs the command (this is done automatically by the framework when one of the triggers is sent in a message.

Command.areYou(string) : check if the command's name or triggers match the string, returns a boolean.

Command.Name: name of the command.

Command.Triggers : an array of the commands triggers.

Command.OwnerOnly : if the command is OwnerOnly, returns boolean.

Command.GuildOnly : If the command is GuildOnly, returns boolean.

Command.Group : The group of the command, string.

Command.Description : The commands description.

Command.Run(message): Execute the command.

Credits:

Discord.js Discord.js is the node.js library used by this framework that allows interaction with the Discord API

Smooth discord.js - This similar bot framework was used as a reference for some things I was unsure of how to do (like all the module.exports stuff and some "path" and "fs" stuff)