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

discord-webhook-maker

v1.0.6

Published

Einfacher und chainable Builder fuer Discord-Webhooks mit voller Embed-Unterstuetzung.

Downloads

688

Readme

discord-webhook-maker

Ein einfacher, chainable Builder für Discord-Webhooks mit voller Embed-Unterstützung. Null Dependencies, native fetch (Node 18+), TypeScript-Typen inklusive.

Installation

npm install discord-webhook-maker

Schnellstart

const { Webhook, Embed, Colors } = require("discord-webhook-maker");

const embed = new Embed()
    .setTitle("Server-Status")
    .setDescription("Alle Systeme laufen normal.")
    .setColor(Colors.GREEN)
    .addField("CPU", "12%", true)
    .addField("RAM", "1.4 GB / 8 GB", true)
    .setTimestamp();

await new Webhook("https://discord.com/api/webhooks/...")
    .setUsername("StatusBot")
    .setContent("Stündlicher Report")
    .addEmbed(embed)
    .send();

API

new Webhook(url)

| Methode | Beschreibung | | ------------------------- | ---------------------------------------------- | | .setContent(text) | Klartext-Nachricht (max. 2000 Zeichen) | | .setUsername(name) | Überschreibt den Webhook-Namen | | .setAvatar(url) | Überschreibt das Webhook-Avatar | | .setTTS(boolean) | Aktiviert Text-to-Speech | | .addEmbed(embed) | Hängt ein Embed an (max. 10 pro Nachricht) | | .addEmbeds([...]) | Mehrere Embeds auf einmal | | .clearEmbeds() | Entfernt alle Embeds | | .toJSON() | Gibt die rohe Payload zurück | | .send() | Sendet die Nachricht (Promise) |

new Embed()

| Methode | Beschreibung | | ------------------------------------------------ | ----------------------------------------- | | .setTitle(text) | Titel (max. 256 Zeichen) | | .setDescription(text) | Beschreibung (max. 4096 Zeichen) | | .setURL(url) | Link am Titel | | .setColor(color) | Hex-String, Zahl oder Colors.*-Konstante| | .setTimestamp(date?) | Default: new Date() | | .setAuthor({ name, iconURL?, url? }) | Author-Block | | .setFooter({ text, iconURL? }) | Footer-Block | | .setThumbnail(url) | Kleines Bild oben rechts | | .setImage(url) | Großes Bild unten | | .addField(name, value, inline?) | Einzelnes Feld (max. 25 pro Embed) | | .addFields([{ name, value, inline }]) | Mehrere Felder | | .clearFields() | Entfernt alle Felder | | .toJSON() | Gibt das rohe Embed-Objekt zurück |

Farben

const { Colors, hexToInt, rgbToInt } = require("discord-webhook-maker");

embed.setColor(Colors.BLURPLE);     // Vordefinierte Konstante
embed.setColor("#5865F2");          // Hex-String
embed.setColor(0x5865f2);           // Zahl
embed.setColor(rgbToInt(88, 101, 242));

Verfügbare Konstanten: DEFAULT, WHITE, AQUA, GREEN, BLUE, YELLOW, PURPLE, LUMINOUS_VIVID_PINK, GOLD, ORANGE, RED, GREY, NAVY, BLURPLE, sowie DARK_*-Varianten.

Fehlerbehandlung

const { Webhook, WebhookException, ValidationException } = require("discord-webhook-maker");

try {
    await hook.send();
} catch (err) {
    if (err instanceof ValidationException) {
        // Lokale Validierung schlug fehl (Limits, fehlende Felder, ...)
    } else if (err instanceof WebhookException) {
        // Discord antwortete mit einem Fehler
        console.log(err.status, err.body);
    }
}

Komplettes Beispiel

const { Webhook, Embed, Colors } = require("discord-webhook-maker");

const embed = new Embed()
    .setTitle("Neue Bestellung")
    .setURL("https://shop.example.com/orders/42")
    .setDescription("Eine neue Bestellung ist eingegangen.")
    .setColor(Colors.BLURPLE)
    .setAuthor({
        name: "Shop-System",
        iconURL: "https://i.imgur.com/AfFp7pu.png",
    })
    .setThumbnail("https://i.imgur.com/AfFp7pu.png")
    .addFields([
        { name: "Kunde",   value: "Max Mustermann", inline: true },
        { name: "Betrag",  value: "49,99 €",        inline: true },
        { name: "Artikel", value: "3"                                },
    ])
    .setFooter({ text: "Order #42" })
    .setTimestamp();

await new Webhook(process.env.DISCORD_WEBHOOK_URL)
    .setUsername("Shop")
    .addEmbed(embed)
    .send();

Limits (von Discord vorgegeben)

  • Embeds pro Nachricht: 10
  • Felder pro Embed: 25
  • Titel: 256 Zeichen, Beschreibung: 4096 Zeichen
  • Field-Name: 256, Field-Value: 1024
  • Footer-Text: 2048, Author-Name: 256
  • Klartext-Content: 2000 Zeichen

Der Builder validiert diese Limits clientseitig und wirft eine ValidationException, bevor die Anfrage an Discord rausgeht.

Lizenz

MIT