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 🙏

© 2025 – Pkg Stats / Ryan Hefner

discord-hookr

v1.0.0

Published

A simple yet powerful TypeScript library for working with Discord webhooks

Downloads

10

Readme

Discord Hooker

A simple yet powerful TypeScript library for working with Discord webhooks. This library provides a fluent interface for creating and managing Discord webhook messages with support for all Discord webhook features.

Features

  • Send, edit, fetch, and delete webhook messages
  • Support for embeds, components, and message flags
  • Rich builder classes for embeds, buttons, select menus, and more
  • Support for thread messages
  • Modern TypeScript API with full type support

Installation

npm install discord-hooker

Basic Usage

import { Webhook } from 'discord-hooker';

// Create a webhook instance
const webhook = new Webhook(
  new URL('https://discord.com/api/webhooks/your-webhook-id/your-webhook-token')
);

// Send a simple message
await webhook.send({
  content: 'Hello, Discord!',
});

// Send a message with an embed
await webhook.send({
  content: 'Check out this embed:',
  embeds: [
    {
      title: 'My Embed',
      description: 'This is an embedded message',
      color: 0x00ff00,
    },
  ],
});

Using Message Flags

Discord webhooks support message flags that can modify how messages are displayed. This library provides a MessageFlags enum and a MessageFlagsBitField builder for working with message flags.

Available Message Flags

  • SuppressEmbeds: Prevents links from creating embeds
  • SuppressNotifications: Prevents notifications from being sent
  • Ephemeral: Makes the message only visible to the user who triggered the interaction
  • And more...

Using Message Flags Directly

import { MessageFlags, Webhook } from 'discord-hooker';

const webhook = new Webhook(new URL('your-webhook-url'));

// Send a message with the SuppressEmbeds flag
await webhook.send({
  content: 'This message has suppressed embeds',
  flags: MessageFlags.SuppressEmbeds,
});

Using the MessageFlagsBitField Builder

The MessageFlagsBitField builder provides a fluent interface for combining multiple message flags:

import { MessageFlags, MessageFlagsBitField, Webhook } from 'discord-hooker';

const webhook = new Webhook(new URL('your-webhook-url'));

// Create a message flags bitfield
const flags = new MessageFlagsBitField()
  .add(MessageFlags.SuppressEmbeds)
  .add(MessageFlags.SuppressNotifications);

// Send a message with multiple flags
await webhook.send({
  content: 'This message has multiple flags',
  flags: flags.valueOf(), // Convert to a number
});

Using Builders

The library provides builders for creating complex message components:

import {
  ActionRowBuilder,
  ButtonBuilder,
  ButtonStyle,
  EmbedBuilder,
  Webhook,
} from 'discord-hooker';

const webhook = new Webhook(new URL('your-webhook-url'));

// Create an embed
const embed = new EmbedBuilder()
  .setTitle('Interactive Message')
  .setDescription('Click the buttons below')
  .setColor(0x3498db);

// Create buttons
const actionRow = new ActionRowBuilder().addComponents(
  new ButtonBuilder().setCustomId('button_1').setLabel('Click Me').setStyle(ButtonStyle.Primary),
  new ButtonBuilder()
    .setURL('https://discord.com')
    .setLabel('Visit Discord')
    .setStyle(ButtonStyle.Link)
);

// Send the message
await webhook.send({
  embeds: [embed.toJSON()],
  components: [actionRow.toJSON()],
});

License

MIT