mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
adds new WebhookClient and allows you to fetch channel webhooks and such without being "over the top" (#768)
* start blocking out client * proto webhookclient * wee working webhooks * it's all working * run docs * fix jsdoc issues * add example for webhookClient * add example in the examples place * fix docs
This commit is contained in:
12
docs/custom/examples/webhook.js
Normal file
12
docs/custom/examples/webhook.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Send a message using a webhook
|
||||
*/
|
||||
|
||||
// import the discord.js module
|
||||
const Discord = require('discord.js');
|
||||
|
||||
// create a new webhook
|
||||
const hook = new Discord.WebhookClient('webhook id', 'webhook token');
|
||||
|
||||
// send a message using the webhook
|
||||
hook.sendMessage('I am now alive!');
|
||||
10
docs/custom/webhook.js
Normal file
10
docs/custom/webhook.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
category: 'Examples',
|
||||
name: 'Webhooks',
|
||||
data:
|
||||
`\`\`\`js
|
||||
${fs.readFileSync('./docs/custom/examples/webhook.js').toString('utf-8')}
|
||||
\`\`\``,
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user