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-folders

v0.0.95

Published

A simple and lightweight discord bot framework using based on your filesystem

Readme

Discord-Folders

Discord-folders is a lightweight, simple to setup, simple to use, scalable framework for discod bots. It uses your file system to determine how it should function, making it super simple to visualize how your bot will function.

Setup

Install

First things first, install discord-folders in a already-set-up npm project via npm i discord-folders. This also installs discord.js, however to reconize it as a main dependincy in your project, npm i discord.js is also recomened.

Note:

Becuase discord-folders uses your filesystem to determine bot behavior, it is very important that your project is set up exactly as it is in this tutorial. This could be the source of many hard to find bugs.

Creating the structure

Inside of your root directory, you'll need at least 1 file (index.js) and one folder (src). index.js will be the entry point of the bot, and contain all the bot code. src will contain all the information that the bot will process. Inside of src we need two more folders, commands and listeners. commands will store all the accessable commands that you bot might provide (!kick @user, !play https://www.youtube.com/watch?v=dQw4w9WgXcQ, etc...), and listeners will store all the "global" event listeners for your bot, which can be used for tasks such as blocking certian words or sending a greeting message once a user joins.

Note:

discord-folders is set up to take advantade of both commonjs (module.exports and require()) and es6 (import and export) modules. Make sure you are using the correct system or nothing will work. As a quick tip, inside of discord folders, import { x } from "discord-folders" is the same as const { x } = require("discord-folders"), and export default is the same as module.exports =

Editing index.js

Now that the project is set up, we can create the bot. Edit index.js to contain this code:

import { Bot } from "discord-folders";

const myBot = new Bot(__dirname + "/src");

bot.login("Your Toekn Here");

Now, if you are using require(), and have edited this code using the note above, it should run fine, and you should see a green terminal. However, those using es6 will probably have an error similar to this:

__dirname is not defined error

This happens because __dirname is not defined when using es6 modules. The cleanest way is to manualy create a __dirname varible, so editing index.js to look like this should work:

import { Bot } from "discord-folders";
import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));

const myBot = new Bot(__dirname + "/src");

bot.login("Your Toekn Here");

You should now see these messages:

All greens logs showing everything went well