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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@glowland/discord-framework

v4.0.4

Published

Small typed framework for loading and dispatching discord.js modules.

Readme

@glowland/discord-framework

A small, typed, file-driven framework for Discord bots built on discord.js.

It handles the repetitive runtime work so you can focus on your actual bot architecture.

  • Load modules from folders
  • Route Discord interactions and events
  • Inject application context
  • Handle permissions and errors
  • Reload components without restarting
  • Register application commands

No DI container. No decorators. No hidden lifecycle.


Features

  • Typed wrappers over discord.js
  • File-based module loading
  • Slash command manager
  • Context menu manager
  • Button manager
  • Select menu manager
  • Modal submit manager
  • Autocomplete manager
  • Message manager
  • Voice state update manager
  • Event manager
  • Shared application-command registration
  • Developer-only application commands
  • Built-in hot reload methods
  • Dynamic permission system
  • Duplicate module warnings in development
  • Minimal assumptions about project structure

Installation

npm i @glowland/discord-framework discord.js

Mental model

Put a module in the right folder, export the right class, load the folder, then listen.

That is the framework.

You keep your architecture. The framework only handles routing and runtime orchestration.


Suggested folder structure

components/
  commands/
  context-menus/
  buttons/
  select-menus/
  modals/
  autocompletes/
  messages/
  voice-state-updates/
  events/

Each manager loads one folder.


Quick start

import {
  SlashCommandManager,
  ContextMenuManager,
  ButtonManager,
  SelectMenuManager,
  ModalSubmitManager,
  AutocompleteManager,
  MessageManager,
  VoiceStateUpdateManager,
  EventManager,
  registerApplicationCommands,
} from "@glowland/discord-framework";

const createInteractionContext = async (interaction) => ({
  client,
  guildDB: await client.guildDB.get(interaction.guildId),
});

Permissions

Interaction-based modules support permission checks.

Discord permissions

permissionsRequired: ["ManageGuild"]

Dynamic permissions

permissionResolver: (context, interaction) => {
  const roles = context.guildDB.data.adminRoles;

  return interaction.member.roles.cache.some((role) =>
    roles.includes(role.id),
  );
}

Access rule

permissionResolver OR all required permissions

A user can access the module if:

  • permissionResolver returns true, or
  • they have every permission listed in permissionsRequired

If access fails, the framework replies automatically and the module is not triggered.


Modules

Slash command

export default new SlashCommandModule({
  name: "ping",
  description: "Replies with Pong.",

  async onTrigger(context, interaction) {
    await interaction.reply("Pong.");
  },
});

Button

export default new ButtonModule({
  customId: "example.confirm",

  async onTrigger(context, interaction) {
    await interaction.reply({
      flags: "Ephemeral",
      content: "Confirmed.",
    });
  },
});

Select menu

export default new SelectMenuModule({
  customId: "example.select",
  type: "String",

  async onTrigger(context, interaction) {
    await interaction.reply({
      flags: "Ephemeral",
      content: interaction.values.join(", "),
    });
  },
});

Modal

export default new ModalModule({
  customId: "example.modal",

  build() {
    return new ModalBuilder()
      .setCustomId("example.modal")
      .setTitle("Example");
  },

  async onTrigger(context, interaction) {
    await interaction.reply({
      flags: "Ephemeral",
      content: "Modal submitted.",
    });
  },
});

Autocomplete

export default new AutocompleteModule({
  commandName: "config",
  optionName: "module",

  choices: [
    { name: "Automod", value: "automod" },
    { name: "Suggestions", value: "suggestions" },
    { name: "Auto Voice", value: "auto_voice" },
  ],
});

Dynamic choices are also supported.

export default new AutocompleteModule({
  commandName: "warp",
  optionName: "target",

  async choices(context) {
    return context.guildDB.data.warps.map((warp) => ({
      name: warp.name,
      value: warp.id,
    }));
  },
});

The framework automatically:

  • filters choices using the focused value
  • limits responses to 25 choices
  • responds to the interaction

Message

export default new MessageModule({
  trigger: "!ping",

  async onTrigger(context, message) {
    await message.reply("pong");
  },
});

Voice state update

export default new VoiceStateUpdateModule({
  async onTrigger(context, oldState, newState) {
    console.log(`${newState.member?.user.tag} joined a voice channel.`);
  },
});

Event

export default new EventModule({
  name: "ready",
  once: true,

  onTrigger(client) {
    console.log(`Ready as ${client.user.tag}`);
  },
});

Context

Every manager receives a createContext function.

You decide what goes inside.

createContext: async (interaction) => ({
  client,
  guildDB: await client.guildDB.get(interaction.guildId),
})

Reloading

await buttons.reloadButtons();

Reloading works by:

  1. clearing the internal cache
  2. re-importing every module

No process restart required.


Design goals

  • explicit over implicit
  • strong typing without killing DX
  • framework, not template
  • minimal abstractions
  • predictable runtime behavior
  • no hidden lifecycle

License

MIT