feat(discord.js): partial transition to undici (#7482)

This commit is contained in:
Khafra
2022-02-23 02:40:00 -05:00
committed by GitHub
parent cf669301c7
commit 51583320d3
6 changed files with 22 additions and 9 deletions

View File

@@ -5,13 +5,16 @@ const path = require('node:path');
const { setTimeout: sleep } = require('node:timers/promises');
const util = require('node:util');
const { GatewayIntentBits } = require('discord-api-types/v9');
const fetch = require('node-fetch');
const { fetch } = require('undici');
const { owner, token, webhookChannel, webhookToken } = require('./auth.js');
const { Client, MessageAttachment, Embed, WebhookClient } = require('../src');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });
const buffer = l => fetch(l).then(res => res.buffer());
const buffer = l =>
fetch(l)
.then(res => res.arrayBuffer())
.then(Buffer.from);
const read = util.promisify(fs.readFile);
const readStream = fs.createReadStream;