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

@spraxium/webhook

v0.2.2

Published

Decorator-based Discord webhook management for Spraxium bots with a rich send API

Readme

@spraxium/webhook

@spraxium/webhook provides a decorator-based Discord webhook management layer for Spraxium bots. You register named webhook URLs once in spraxium.config.ts via defineWebhook, import WebhookModule in your app module, and inject WebhookService anywhere in your application. The service resolves named webhooks at runtime so your business logic never holds a raw URL or manages WebhookClient instances directly.

The package also provides @WebhookSender() and @Send(name) decorators for a declarative approach. Decorate a class with @WebhookSender() and any of its methods with @Send('webhookName'), and the framework automatically forwards the method's return value to the named webhook every time the method is called. String returns become content, EmbedBuilder returns become embeds, and any MessageCreateOptions object is forwarded as-is.

Installation

npm install @spraxium/webhook

Usage

// spraxium.config.ts
import { defineConfig } from '@spraxium/core';
import { defineWebhook } from '@spraxium/webhook';

export default defineConfig({
  plugins: [
    defineWebhook({
      webhooks: {
        alerts: process.env.WEBHOOK_ALERTS ?? '',
        logs: process.env.WEBHOOK_LOGS ?? '',
        reports: process.env.WEBHOOK_REPORTS ?? '',
      },
      globalUsername: 'MyBot',
    }),
  ],
});
// Using WebhookService directly
import { Injectable } from '@spraxium/common';
import { WebhookService } from '@spraxium/webhook';
import { EmbedBuilder } from 'discord.js';

@Injectable()
export class AlertsService {
  constructor(private readonly webhooks: WebhookService) {}

  async sendAlert(message: string): Promise<void> {
    await this.webhooks.send('alerts', message);
  }

  async sendReport(embed: EmbedBuilder): Promise<void> {
    await this.webhooks.sendEmbed('reports', embed);
  }

  async broadcastMaintenance(): Promise<void> {
    await this.webhooks.sendAll('Scheduled maintenance starting in 5 minutes.');
  }

  async sendFormatted(guildName: string, count: number): Promise<void> {
    await this.webhooks.formatAndSend(
      'logs',
      'Guild {{guild}} now has {{count}} members.',
      { guild: guildName, count: String(count) },
    );
  }
}
// Using @WebhookSender() + @Send() declarative approach
import { WebhookSender, Send } from '@spraxium/webhook';
import { EmbedBuilder } from 'discord.js';

@WebhookSender()
export class DailyReportsService {
  @Send('reports')
  async buildDailyReport(): Promise<EmbedBuilder> {
    return new EmbedBuilder()
      .setTitle('Daily Report')
      .setDescription(`Report for ${new Date().toDateString()}`)
      .setColor(0x5865f2);
  }
}

WebhookService API

| Method | Description | |---|---| | send(name, content, options?) | Send plain text to a named webhook | | sendEmbed(name, embed, options?) | Send a single EmbedBuilder | | sendEmbeds(name, embeds, options?) | Send multiple embeds in one message | | sendMessage(name, message, options?) | Send a full MessageCreateOptions payload | | sendMany(names, content, options?) | Send text to multiple webhooks in parallel | | sendAll(content, options?) | Broadcast text to all registered webhooks | | formatAndSend(name, template, vars, options?) | Interpolate {{var}} template and send | | format(template, vars) | Interpolate template without sending | | get(name) | Get the raw WebhookEntry with its WebhookClient | | isRegistered(name) | Check if a webhook alias is registered | | registered() | List all registered webhook aliases |

Links

npm · GitHub · Discord Webhooks · Documentation

License

Apache 2.0