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

@stambha/gates

v0.3.5

Published

Built-in Stambha gates — cooldown, permissions, NSFW, and RunIn (Sapphire preconditions parity)

Readme

@stambha/gates

Built-in gates — cooldown, permissions, NSFW, and channel-type checks. Sapphire @sapphire/plugin-subcommands preconditions parity without discord.js.

Part of the @stambha monorepo · GitHub · Gates guide


Install

npm install @stambha/gates @stambha/core

Requires Node.js 20+.


Quick start

Attach to a command

import { Command, ok, type CommandContext, type Registry } from "@stambha/core";
import { cooldownGate, guildOnlyGate } from "@stambha/gates";

export class PingCommand extends Command {
  constructor(registry: Registry<Command>) {
    super(registry, {
      name: "ping",
      description: "Pong!",
      kinds: ["slash"],
      gates: [
        guildOnlyGate(),
        cooldownGate({ limit: 1, delay: 3_000, scope: "user" }),
      ],
    });
  }

  async execute(ctx: CommandContext) {
    await ctx.reply("Pong!");
    return ok(undefined);
  }
}

Auto-reply when a gate denies

import { attachGateDeniedReply } from "@stambha/gates";

attachGateDeniedReply(client);

Available gates

| Gate | Description | |------|-------------| | cooldownGate | Per-user/channel/global cooldown | | permissionsGate | Member permission flags | | userPermissionsGate / clientPermissionsGate | Shorthand permission checks | | nsfwGate | NSFW channel requirement | | guildOnlyGate / dmOnlyGate | Channel type restriction | | runInGate / RunIn | Run in specific channel types |

Combine custom gates in @stambha/core with gateAnd() / gateOr().


Key exports

| Export | Purpose | |--------|---------| | cooldownGate, MemoryCooldownStore | Rate-limit commands | | permissionsGate, Permission | Discord permission math | | nsfwGate | Age-restricted channels | | guildOnlyGate, dmOnlyGate, runInGate | Where commands may run | | attachGateDeniedReply | User-facing denial messages |


Related packages

| Package | Role | |---------|------| | @stambha/core | Gate, defineGate, pipeline | | @stambha/loader | Load custom gates from src/gates/ |


Development

pnpm --filter @stambha/gates build
pnpm --filter @stambha/gates test