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 🙏

© 2024 – Pkg Stats / Ryan Hefner

webcord

v2.1.4

Published

A lightweight library for interacting with Discord webhooks.

Downloads

20

Readme

npm version npm contributions welcome Discord Shield

Webcord

Webcord is an easy to use, Discord compliant webhook module for Node.js, featuring a simplistic design inspired by Discord.js message embeds. It ships with Typescript support by default (no need to create those pesky typings), and requires zero dependencies!

Installation

Using npm:

npm install webcord		

Examples

The code below features every method built into Webcord. Think of it as the documentation. Highlighting over the code in Visual Studio Code also shows what the methods do.

Posting to a Webhook

const webcord = require("webcord")

new webcord({
   url: "https://discordapp.com/api/webhooks/712433174063349761/-YgMVHCyQlfxval8rwJYO79CuJjrIj1jwAqePLluBgfQseU0FFH1GhEeiJf8bxnmfWOQ", // Discord webhook url
   name: "Webcord v2.0.0", // Webhook display name
   avatar: "https://cdn.clipart.email/401241ecd4daff63d501b958f75a734b_discord-logo-icon-293532-free-icons-library_250-250.png" // Webhook display avatar
}) // Configures the webhook
.setTitle("Add titles like this") // Sets an embed title
.setDescription("Set some descriptions") // Sets an embed description
.addField('Add single fields:', "like me!", false) // Adds an embed field (max 25 fields)
.addFields({
   name: "Hate repeating yourself?",
   value: "set mutliple fields with the `.addFields()`!",
   inline: false
},
{
   name: "I'm another field",
   value: "Set with the `addFields()` method!",
   inline: false
}) // Adds multiple fields at once (max 25 fields)
.setAuthor({
   name: "Easily set an author field",
   icon: "https://discord.com/assets/2c21aeda16de354ba5334551a883b481.png",
   url: "https://www.npmjs.com/package/webcord"
}) // Sets an embed author
.setFooter({
   text: "I'm a footer",
   icon: "https://discord.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png"
}) // Sets an embed footer
.setURL("https://www.npmjs.com/package/webcord") // Adds a URL to the embeds title
.setImage("https://discord.com/assets/fc0b01fe10a0b8c602fb0106d8189d9b.png") // Sets the image of the embed
.setTimestamp() // Sets the timestamp of the embed
.setThumbnail("https://discord.com/assets/f72fbed55baa5642d5a0348bab7d7226.png")
.setColor("#7289DA") // Sets an embed color
.inc() // Creates another embed
.setTitle("This title is a part of the new embed!") // Creates a title on the new embed
.send("This is an optional plain text message").then((res) => {
   console.log(res) //Logs all request information to the console
}) 
/*
Every webcord message must use the .send() method at the end to fire the POST request.
It also supports a promise which returns request information after the POST request is sent out.
*/

The above code outputs this:

Contributing

Webcord Contributors can be found here! Want to contribute? Follow the Contributing Guide!