@pfearr/discordwebhook
Version:
Send Discord Webhooks Easily!
46 lines (29 loc) • 1.66 kB
Markdown
1. Open up discord and go to your server. Create your own Discord Webhook and copy it.
2. Setup your nodejs File and install
``npm install @pfearr/discordwebhook``
3. On your JS file require the module
``const webhook = require('@pfearr/discordwebhook');``
4. Create a new webhook clinet and enter your discord webhook URL
``const webhookClient = new webhook.Start("webhookURL")``
5. Now, to send it. Username is what you want your webhook's username to be, Text is the text you want your webhook to send. Avatar URL is the URL of your webhook's avatar. This is optional. Time is the amount of time before your webhook sends. This is optional. TTS is text to speech. This is optional.
``webhookClient.Send("username","text","avatar_URL (optional)","Time (optional)","TTS (optional)"); // Sends a normal webhook message.``
``webhookClient.SendEmbed(EmbedArray[],"username","text","avatar_URL (optional)","Time (optional)"); // Sends a Embed webhook message``
Find more on Embeds on their docs.
https://discord.com/developers/docs/resources/channel#embed-object.
Make an embed here: https://discohook.org.
You only need "embeds":[] part.
Example:
```
let embed = {
"embeds": [
{
"title": "Embed 1",
"color": null
}
]
}
```
If the operation fails, the webhook will be rejected and will not send. This will **NOT** error and just display a message telling you the error reason. This is to prevent your coding from stopping and erroing
Here are the setups to setup DiscordWebhooks.