New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

discordchan

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discordchan

Lightweight utility for posting messages or JSON payloads to a Discord channel via webhook, with optional dry-run mode for testing.

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

discordchan

Canonical URL:
https://alexstevovich.com/a/discordchan-nodejs

Software URL:
https://midnightcitylights.com/software/discordchan-nodejs

A lightweight utility for sending messages or JSON payloads to Discord channels through webhook URLs.
Includes a dry-run mode for local testing without sending any real requests.

Installation

npm install discordchan

Example

import DiscordChan from 'discordchan';

const chan = new DiscordChan('https://discord.com/api/webhooks/...');

// Send a simple message
await chan.send('Hello from DiscordChan!');

// Send a JSON object (auto-formatted as code block)
await chan.send({ status: 'OK', uptime: 4823 });

// Use dry-run mode to simulate messages without posting
chan.dryRunMode(true);
await chan.send('This will only log locally.');

API

new DiscordChan(webhook, options?)

ParameterTypeDescription
webhookstringDiscord webhook URL.
optionsobjectOptional settings.
options.dryRunbooleanIf true, logs messages instead of sending.

dryRunMode(enable = true)

Enables or disables dry-run simulation.

send(content)

Sends either a string or an object as a message.
If the content is an object, it is automatically formatted as a JSON code block.

verify()

Returns true if a valid webhook URL is set.

ensure()

Throws an error if the webhook URL is invalid.

Notes

  • No external dependencies — works natively with Node 18+, Deno, or Bun.
  • Automatically formats JSON payloads for Discord readability.
  • Useful for build notifications, error reporting, or application logs.
  • Fully compatible with asynchronous workflows.

License

Licensed under the Apache License 2.0.

Keywords

discord

FAQs

Package last updated on 12 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts