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/core

v0.3.5

Published

Transport-agnostic Discord bot core — client, pipeline, registries, sequences, chron, and tier split (no discord.js or Discordeno)

Downloads

1,301

Readme

@stambha/core

Transport-agnostic Discord bot framework — client, command pipeline, registries, sequences, and tier split. No discord.js or Discordeno required.

Part of the @stambha monorepo · GitHub · Docs


Install

npm install @stambha/core
# or
pnpm add @stambha/core

Requires Node.js 20+.

Pair with @stambha/rest, @stambha/gateway, and @stambha/transform for a full native stack.

Works from ESM (import) and CommonJS (require) — the package ships dual builds (dist/index.js + dist/index.cjs).

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

CommandContext, Outcome, and other types should use import type when verbatimModuleSyntax is enabled.


Quick start

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

class PingCommand extends Command {
  constructor(registry: Registry<Command>) {
    super(registry, { name: "ping", description: "Pong!", kinds: ["prefix"] });
  }

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

const client = createStambhaBot({ prefix: "!" });
client.register(new PingCommand(client.registries.commands));
await client.start();

For production wiring (REST + gateway), see examples/bot.


Command pipeline

Inbound events flow through pieces in order:

Conduit → Barrier → Gate → Command → Epilogue

| Piece | Folder | Role | |-------|--------|------| | Command | commands/ | Slash, prefix, context menu handlers | | Hook | listeners/ | Gateway event listeners | | Scout | scouts/ | Passive message watchers | | Barrier | barriers/ | Global command blockers | | Gate | gates/ | Per-command checks (Sapphire preconditions) | | Conduit | conduits/ | Middleware before gates | | Epilogue | epilogues/ | Post-command hooks | | Signal | signals/ | Buttons, selects, modals (stambha: ids) | | Chron | tasks/ | Cron scheduled jobs |

Auto-load folders with @stambha/loader.


Key exports

| Export | Purpose | |--------|---------| | createStambhaBot, StambhaClient | Bot client and lifecycle | | Command, Hook, Gate, Scout, … | Piece base classes | | ExecutionPipeline | Run conduit → command flow | | InboundRouter, SignalRouter | Dispatch commands and components | | sequence, SequenceBuilder | Multi-step UI flows | | RestPort, HttpRestPort | Outbound API (tier split) | | MockBridge | Testing without Discord | | ok, err, Outcome | Typed command results | | Binder | Lightweight DI | | resolveCommandGates | Validate gateNames after loadPieces |

Directive is a deprecated alias for Command.

Registry iteration

Registry is not iterable. List pieces with:

const commands = client.registries.commands.toArray();
// or: [...client.registries.commands.values()]
const ping = client.registries.commands.get("ping");

Related packages

| Package | Use when | |---------|----------| | @stambha/rest | Native REST client and worker | | @stambha/gateway | Shard hub and event routing | | @stambha/loader | Auto-load src/commands/, etc. | | @stambha/gates | Built-in permission/cooldown gates | | @stambha/plugins | Plugin lifecycle hooks |


Development

# from repo root
pnpm --filter @stambha/core build
pnpm --filter @stambha/core test

Report issues · CHANGELOG