docs: update docs and examples for #4879 (#5323)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Carter
2021-03-28 21:51:42 -06:00
committed by GitHub
parent 624a4464ca
commit 685b2604e4
18 changed files with 56 additions and 58 deletions

View File

@@ -5,11 +5,9 @@ const path = require('path');
const util = require('util');
const fetch = require('node-fetch');
const { owner, token, webhookChannel, webhookToken } = require('./auth.js');
const Discord = require('../src');
const { Client, Intents, MessageAttachment, MessageEmbed, WebhookClient } = require('../src');
const client = new Discord.Client({
intents: Discord.Intents.NON_PRIVILEGED,
});
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const fill = c => Array(4).fill(c.repeat(1000));
const buffer = l => fetch(l).then(res => res.buffer());
@@ -21,8 +19,8 @@ const linkA = 'https://lolisafe.moe/iiDMtAXA.png';
const linkB = 'https://lolisafe.moe/9hSpedPh.png';
const fileA = path.join(__dirname, 'blobReach.png');
const embed = () => new Discord.MessageEmbed();
const attach = (attachment, name) => new Discord.MessageAttachment(attachment, name);
const embed = () => new MessageEmbed();
const attach = (attachment, name) => new MessageAttachment(attachment, name);
const tests = [
(m, hook) => hook.send('x'),
@@ -121,7 +119,7 @@ client.on('message', async message => {
if (message.author.id !== owner) return;
const match = message.content.match(/^do (.+)$/);
const hooks = [
{ type: 'WebhookClient', hook: new Discord.WebhookClient(webhookChannel, webhookToken) },
{ type: 'WebhookClient', hook: new WebhookClient(webhookChannel, webhookToken) },
{ type: 'TextChannel#fetchWebhooks', hook: await message.channel.fetchWebhooks().then(x => x.first()) },
{ type: 'Guild#fetchWebhooks', hook: await message.guild.fetchWebhooks().then(x => x.first()) },
];