refactor: import timers, process, and Buffer from node: (#7157)

Co-authored-by: muchnameless <12682826+muchnameless@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
Antonio Román
2021-12-28 10:15:24 +01:00
committed by GitHub
parent d0c3961aef
commit 3c62bd2d47
46 changed files with 79 additions and 5 deletions

View File

@@ -2,6 +2,8 @@
const fs = require('node:fs');
const path = require('node:path');
const process = require('node:process');
const { setTimeout: sleep } = require('node:timers/promises');
const util = require('node:util');
const fetch = require('node-fetch');
const { owner, token } = require('./auth.js');
@@ -12,7 +14,6 @@ const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_
const buffer = l => fetch(l).then(res => res.buffer());
const read = util.promisify(fs.readFile);
const readStream = fs.createReadStream;
const wait = util.promisify(setTimeout);
const linkA = 'https://lolisafe.moe/iiDMtAXA.png';
const linkB = 'https://lolisafe.moe/9hSpedPh.png';
@@ -97,7 +98,7 @@ client.on('messageCreate', async message => {
for (const [i, test] of tests.entries()) {
await message.channel.send(`**#${i}**\n\`\`\`js\n${test.toString()}\`\`\``);
await test(message).catch(e => message.channel.send(`Error!\n\`\`\`\n${e}\`\`\``));
await wait(1_000);
await sleep(1_000);
}
/* eslint-enable no-await-in-loop */
} else if (match) {