New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord-hook

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-hook

Allows you to send webhooks

  • 3.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-11.11%
Maintainers
1
Weekly downloads
 
Created
Source

Instructions

Info

Things with [] next to them means an array of that thing.

const Webhook = require("discord-hook"),
      webhook = new Webhook("https://discord.com/api/webhooks/.....", { 
          username: "The username of the webhook", 
          avatar_url: "The avatar/icon of the webhook" 
    });
      webhook
      .embeds(EMBED_DATA[])
      .embed(EMBED_DATA) // Look below for the EMBED_DATA information
      .content(`The content of the message`)
      .mention(`<@USERID>`) // or <@&ROLEID>
      .avatar(`The username of the webhook`, `The avatar/icon of the webhook`)
      .send(); // This returns the message object from the webhook being sent
Edit webhook messages
const webhook = new (require("discord-hook"))("https://discord.com/api/webhooks/....");

    webhook
      .embeds(EMBED_DATA[])
      .embed(EMBED_DATA) // Look below for the EMBED_DATA information
      .content(`The content of the message`)
      .mention(`<@USERID>`) // or <@&ROLEID>
      .avatar(`The username of the webhook`, `The avatar/icon of the webhook`)
      .edit(`MESSAGE_ID`);
    // This edits the webhook message in the channel, 
    // NOTE: The webhook url needs to be the webhook that created the message. 
Helper Method(s)
Method: .helpers.blank
Description: That provides a blank character "\u200b"

Method: .field(name, value, inline)
Description: Returns the {name: "", value: "", inline: false} object

Embed Data

{
    "title": "",
    "description": "",
    "color": "",
    "timestamp": new Date(),
    "url": "",
    "author": {
        "name": "",
        "icon_url": "",
        "url": ""
    },
    "footer": {
        "text": "",
        "icon_url": ""
    },
    "fields": [
        {
            "name": "",
            "value": "",
            "inline": true // or false
        }
    ]
}

Keywords

FAQs

Package last updated on 01 Aug 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc