Skip to main content

latest

Zero dependency, TypeScript/JavaScript library for sending Discord webhooks. Useful for edge runtimes, Cloudflare Workers, Vercel, Deno, etc.

This package works with Bun, Cloudflare Workers, Node.js, Deno, Browsers
JSR Score
100%
Published
3 weeks ago (0.2.5)

EZ Hook - TypeScript/JavaScript

Zero dependency, TypeScript/JavaScript library for sending Discord webhooks.
Useful for edge runtimes, Cloudflare Workers, Vercel, Deno, etc.

Install

deno add @teever/ez-hook
npx jsr add @teever/ez-hook
yarn dlx jsr add @teever/ez-hook
pnpm dlx jsr add @teever/ez-hook
bunx jsr add @teever/ez-hook

Example

Basic Use

import { Webhook } from '@teever/ez-hook'

const hook = new Webhook('YOUR VALID DISCORD WEBHOOK')

hook
  .setUsername('Username')
  .setContent('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')

hook.send()

Custom Embeds (Rich Message)

import { Embed, Webhook } from '@teever/ez-hook'

const hook = new Webhook('YOUR VALID DISCORD WEBHOOK')

const embed = new Embed()
embed
  .setTitle('Embed Title')
  .setDescription('Embed Description')
  .setColor('#ffffff')
  .setThumbnail({
    url: 'https://assets-global.website-files.com/6257adef93867e50d84d30e2/636e0a6a49cf127bf92de1e2_icon_clyde_blurple_RGB.png',
  })
  .setAuthor({
    name: 'Author Name',
    icon_url:
      'https://assets-global.website-files.com/6257adef93867e50d84d30e2/636e0a6a49cf127bf92de1e2_icon_clyde_blurple_RGB.png',
    url: 'https://discord.com',
  })
  .setFooter({
    text: 'Footer Text',
    icon_url:
      'https://assets-global.website-files.com/6257adef93867e50d84d30e2/636e0a6a49cf127bf92de1e2_icon_clyde_blurple_RGB.png',
  })
  .setTimestamp()
  .addField({
    name: 'Field 1',
    value: 'Value 1',
    inline: true,
  })
  .addField({
    name: 'Field 2',
    value: 'Value 2',
    inline: true,
  })
  .addField({
    name: 'Field 3',
    value: 'Value 3',
    inline: false,
  })

const success = await hook.addEmbed(embed).send()

Add Package

deno add @teever/ez-hook

Import symbol

import * as mod from "@teever/ez-hook";

Add Package

npx jsr add @teever/ez-hook

Import symbol

import * as mod from "@teever/ez-hook";

Add Package

yarn dlx jsr add @teever/ez-hook

Import symbol

import * as mod from "@teever/ez-hook";

Add Package

pnpm dlx jsr add @teever/ez-hook

Import symbol

import * as mod from "@teever/ez-hook";

Add Package

bunx jsr add @teever/ez-hook

Import symbol

import * as mod from "@teever/ez-hook";