From ae2ebe0337ae06ff9d3bd35b808024c250f73887 Mon Sep 17 00:00:00 2001 From: Essem Date: Thu, 19 Aug 2021 09:19:14 -0500 Subject: [PATCH] Port to ESM modules (haha funny), removed cache request, many other changes that I forgot about --- .eslintrc.json | 3 +- api/index.js | 25 +- app.js | 28 +- classes/command.js | 2 +- classes/imageCommand.js | 29 +- classes/musicCommand.js | 8 +- commands/fun/8ball.js | 6 +- commands/fun/ancient.js | 6 +- commands/fun/bird.js | 6 +- commands/fun/cat.js | 6 +- commands/fun/cowsay.js | 12 +- commands/fun/dice.js | 4 +- commands/fun/dog.js | 6 +- commands/fun/fullwidth.js | 4 +- commands/fun/homebrew.js | 4 +- commands/fun/mc.js | 6 +- commands/fun/retro.js | 6 +- commands/fun/rps.js | 8 +- commands/fun/sonic.js | 6 +- commands/fun/wikihow.js | 6 +- commands/fun/xkcd.js | 6 +- commands/general/avatar.js | 4 +- commands/general/broadcast.js | 4 +- commands/general/channel.js | 6 +- commands/general/command.js | 8 +- commands/general/count.js | 8 +- commands/general/decode.js | 6 +- commands/general/donate.js | 6 +- commands/general/emote.js | 6 +- commands/general/encode.js | 4 +- commands/general/eval.js | 6 +- commands/general/evalraw.js | 6 +- commands/general/exec.js | 11 +- commands/general/help.js | 18 +- commands/general/image.js | 13 +- commands/general/imagereload.js | 4 +- commands/general/imagestats.js | 4 +- commands/general/info.js | 7 +- commands/general/invite.js | 4 +- commands/general/lengthen.js | 8 +- commands/general/ping.js | 4 +- commands/general/prefix.js | 6 +- commands/general/qrcreate.js | 10 +- commands/general/qrread.js | 15 +- commands/general/raw.js | 6 +- commands/general/reload.js | 4 +- commands/general/restart.js | 9 +- commands/general/serverinfo.js | 4 +- commands/general/snowflake.js | 4 +- commands/general/soundreload.js | 4 +- commands/general/stats.js | 12 +- commands/general/userinfo.js | 4 +- commands/general/youtube.js | 13 +- commands/image-editing/9gag.js | 4 +- commands/image-editing/bandicam.js | 4 +- commands/image-editing/blur.js | 4 +- commands/image-editing/blurple.js | 4 +- commands/image-editing/caption.js | 4 +- commands/image-editing/caption2.js | 4 +- commands/image-editing/circle.js | 4 +- commands/image-editing/crop.js | 4 +- commands/image-editing/deepfry.js | 4 +- commands/image-editing/deviantart.js | 4 +- commands/image-editing/explode.js | 4 +- commands/image-editing/flag.js | 10 +- commands/image-editing/flip.js | 4 +- commands/image-editing/flop.js | 4 +- commands/image-editing/freeze.js | 4 +- commands/image-editing/funky.js | 4 +- commands/image-editing/gamexplain.js | 4 +- commands/image-editing/globe.js | 4 +- commands/image-editing/haah.js | 4 +- commands/image-editing/hooh.js | 4 +- commands/image-editing/hypercam.js | 4 +- commands/image-editing/ifunny.js | 4 +- commands/image-editing/implode.js | 4 +- commands/image-editing/invert.js | 4 +- commands/image-editing/jpeg.js | 4 +- commands/image-editing/kinemaster.js | 4 +- commands/image-editing/leak.js | 4 +- commands/image-editing/magik.js | 4 +- commands/image-editing/meme.js | 4 +- commands/image-editing/memecenter.js | 4 +- commands/image-editing/motivate.js | 4 +- commands/image-editing/pixelate.js | 4 +- commands/image-editing/reddit.js | 6 +- commands/image-editing/reverse.js | 4 +- commands/image-editing/scott.js | 4 +- commands/image-editing/sharpen.js | 4 +- commands/image-editing/shutterstock.js | 4 +- commands/image-editing/slow.js | 4 +- commands/image-editing/snapchat.js | 4 +- commands/image-editing/soos.js | 4 +- commands/image-editing/speed.js | 4 +- commands/image-editing/spin.js | 4 +- commands/image-editing/stretch.js | 4 +- commands/image-editing/swirl.js | 4 +- commands/image-editing/tile.js | 4 +- commands/image-editing/trump.js | 4 +- commands/image-editing/uncaption.js | 4 +- commands/image-editing/unfreeze.js | 4 +- commands/image-editing/waaw.js | 4 +- commands/image-editing/wall.js | 4 +- commands/image-editing/wdt.js | 4 +- commands/image-editing/whisper.js | 4 +- commands/image-editing/wide.js | 4 +- commands/image-editing/woow.js | 4 +- commands/music/loop.js | 8 +- commands/music/nowplaying.js | 8 +- commands/music/pause.js | 4 +- commands/music/play.js | 8 +- commands/music/queue.js | 14 +- commands/music/skip.js | 12 +- commands/music/stop.js | 12 +- commands/soundboard/boi.js | 8 +- commands/soundboard/boom.js | 8 +- commands/soundboard/bruh.js | 8 +- commands/soundboard/explosion.js | 8 +- commands/soundboard/fakeping.js | 8 +- commands/soundboard/fart.js | 8 +- commands/soundboard/fbi.js | 8 +- commands/soundboard/mail.js | 8 +- commands/soundboard/oof.js | 8 +- commands/soundboard/winxp.js | 8 +- commands/tags/tags.js | 10 +- events/guildCreate.js | 8 +- events/guildDelete.js | 6 +- events/messageCreate.js | 49 +- events/rawWS.js | 12 +- events/voiceChannelLeave.js | 32 +- events/voiceChannelSwitch.js | 4 +- package-lock.json | 987 +++++++++++++++++++++---- package.json | 6 +- shard.js | 73 +- utils/awaitrejoin.js | 4 +- utils/collections.js | 16 +- utils/convertpg.js | 5 +- utils/database.js | 2 +- utils/database/dummy.js | 45 +- utils/database/postgresql.js | 94 +-- utils/database/sqlite.js | 74 +- utils/handler.js | 67 +- utils/help.js | 38 +- utils/image-runner.js | 16 +- utils/image.js | 16 +- utils/imagedetect.js | 10 +- utils/logger.js | 8 +- utils/misc.js | 34 +- utils/pagination/awaitinteractions.js | 4 +- utils/pagination/awaitmessages.js | 4 +- utils/pagination/pagination.js | 8 +- utils/parseCommand.js | 4 +- utils/services/image.js | 21 +- utils/services/prometheus.js | 14 +- utils/soundplayer.js | 98 +-- utils/urlcheck.js | 2 +- utils/wrap.js | 2 +- 157 files changed, 1661 insertions(+), 897 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8f3739d..3c89880 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,7 +15,7 @@ ] } }, - "plugins": ["@babel"], + "plugins": ["@babel", "unicorn"], "rules": { "no-console": "off", "indent": [ @@ -29,6 +29,7 @@ "error", "unix" ], + "unicorn/prefer-module": "error", "quotes": [ "warn", "double" diff --git a/api/index.js b/api/index.js index 24a192d..0d25c13 100644 --- a/api/index.js +++ b/api/index.js @@ -1,9 +1,12 @@ -require("dotenv").config(); -const os = require("os"); -const { Worker } = require("worker_threads"); -const path = require("path"); -const http = require("http"); -const WebSocket = require("ws"); +import { config } from "dotenv"; +config(); +import { cpus } from "os"; +import { Worker } from "worker_threads"; +import { join } from "path"; +import { createServer } from "http"; +import ws from "ws"; +import { fileURLToPath } from "url"; +import { dirname } from "path"; const start = process.hrtime(); const log = (msg, jobNum) => { @@ -24,9 +27,9 @@ const jobs = new JobCache(); const queue = []; // Array of UUIDs -const { v4: uuidv4 } = require("uuid"); +import { v4 as uuidv4 } from "uuid"; -const MAX_JOBS = process.env.JOBS !== "" && process.env.JOBS !== undefined ? parseInt(process.env.JOBS) : os.cpus().length * 4; // Completely arbitrary, should usually be some multiple of your amount of cores +const MAX_JOBS = process.env.JOBS !== "" && process.env.JOBS !== undefined ? parseInt(process.env.JOBS) : cpus().length * 4; // Completely arbitrary, should usually be some multiple of your amount of cores const PASS = process.env.PASS !== "" && process.env.PASS !== undefined ? process.env.PASS : undefined; let jobAmount = 0; @@ -52,7 +55,7 @@ const acceptJob = (uuid, sock) => { }); }; -const wss = new WebSocket.Server({ clientTracking: true, noServer: true }); +const wss = new ws.Server({ clientTracking: true, noServer: true }); wss.on("connection", (ws, request) => { log(`WS client ${request.socket.remoteAddress}:${request.socket.remotePort} has connected`); @@ -102,7 +105,7 @@ wss.on("error", (err) => { console.error("A WS error occurred: ", err); }); -const httpServer = http.createServer(); +const httpServer = createServer(); httpServer.on("request", async (req, res) => { if (req.method !== "GET") { @@ -192,7 +195,7 @@ const runJob = (job, sock) => { reject(new TypeError("Unknown image type")); } - const worker = new Worker(path.join(__dirname, "../utils/image-runner.js"), { + const worker = new Worker(join(dirname(fileURLToPath(import.meta.url)), "../utils/image-runner.js"), { workerData: object }); const timeout = setTimeout(() => { diff --git a/app.js b/app.js index 4c08227..af20030 100644 --- a/app.js +++ b/app.js @@ -3,19 +3,24 @@ Although there's a (very) slim chance of it working, multiple aspects of the bot The bot will continue to run past this message, but keep in mind that it could break at any time. Continue running at your own risk; alternatively, stop the bot using Ctrl+C and install WSL.` + "\x1b[0m"); // load config from .env file -require("dotenv").config(); +import { config } from "dotenv"; +config(); // main sharding manager -const { Fleet } = require("eris-fleet"); -const { isMaster } = require("cluster"); +import { Fleet } from "eris-fleet"; +import { isMaster } from "cluster"; // some utils -const path = require("path"); -const winston = require("winston"); +import { join, dirname } from "path"; +import { fileURLToPath } from "url"; +import { readFileSync } from "fs"; +import winston from "winston"; // dbl posting -const TopGG = require("@top-gg/sdk"); -const dbl = process.env.NODE_ENV === "production" && process.env.DBL !== "" ? new TopGG.Api(process.env.DBL) : null; +import { Api } from "@top-gg/sdk"; +const dbl = process.env.NODE_ENV === "production" && process.env.DBL !== "" ? new Api(process.env.DBL) : null; if (isMaster) { + const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version; + const erisFleetVersion = JSON.parse(readFileSync(new URL("./node_modules/eris-fleet/package.json", import.meta.url))).version; // a bit of a hacky way to get the eris-fleet version console.log(` ,*\`$ z\`"v F zBw\`% A ,W "W @@ -37,13 +42,12 @@ k = 25MB)! Try using a smaller image."; } else if (image.type === "tenorlimit") { - collections.runningCommands.delete(this.message.author.id); + runningCommands.delete(this.message.author.id); return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere."; } magickParams.path = image.path; @@ -68,7 +69,7 @@ class ImageCommand extends Command { magickParams.delay = image.delay ? image.delay : 0; if (this.constructor.requiresGIF) magickParams.onlyGIF = true; } catch (e) { - collections.runningCommands.delete(this.message.author.id); + runningCommands.delete(this.message.author.id); throw e; } @@ -76,7 +77,7 @@ class ImageCommand extends Command { if (this.constructor.requiresText) { if (this.args.length === 0 || !await this.criteria(this.args)) { - collections.runningCommands.delete(this.message.author.id); + runningCommands.delete(this.message.author.id); return this.constructor.noText; } } @@ -112,7 +113,7 @@ class ImageCommand extends Command { throw e; } finally { if (status && await this.client.getMessage(status.channel.id, status.id).catch(() => undefined)) await status.delete(); - collections.runningCommands.delete(this.message.author.id); + runningCommands.delete(this.message.author.id); } } @@ -129,4 +130,4 @@ class ImageCommand extends Command { static command = ""; } -module.exports = ImageCommand; \ No newline at end of file +export default ImageCommand; \ No newline at end of file diff --git a/classes/musicCommand.js b/classes/musicCommand.js index a7a1a04..6253acf 100644 --- a/classes/musicCommand.js +++ b/classes/musicCommand.js @@ -1,13 +1,13 @@ -const Command = require("./command.js"); -const soundPlayer = require("../utils/soundplayer.js"); +import Command from "./command.js"; +import { players } from "../utils/soundplayer.js"; class MusicCommand extends Command { constructor(client, cluster, worker, ipc, message, args, content, specialArgs) { super(client, cluster, worker, ipc, message, args, content, specialArgs); - this.connection = soundPlayer.players.get(message.channel.guild.id); + this.connection = players.get(message.channel.guild.id); } static requires = ["sound"]; } -module.exports = MusicCommand; \ No newline at end of file +export default MusicCommand; \ No newline at end of file diff --git a/commands/fun/8ball.js b/commands/fun/8ball.js index 223dea4..d84594d 100644 --- a/commands/fun/8ball.js +++ b/commands/fun/8ball.js @@ -1,5 +1,5 @@ -const Command = require("../../classes/command.js"); -const { random } = require("../../utils/misc.js"); +import Command from "../../classes/command.js"; +import { random } from "../../utils/misc.js"; class EightBallCommand extends Command { static responses = [ @@ -34,4 +34,4 @@ class EightBallCommand extends Command { static arguments = ["{text}"]; } -module.exports = EightBallCommand; \ No newline at end of file +export default EightBallCommand; \ No newline at end of file diff --git a/commands/fun/ancient.js b/commands/fun/ancient.js index f75074c..9b18efc 100644 --- a/commands/fun/ancient.js +++ b/commands/fun/ancient.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class AncientCommand extends Command { async run() { @@ -30,4 +30,4 @@ class AncientCommand extends Command { static aliases = ["old", "oldmeme", "badmeme"]; } -module.exports = AncientCommand; \ No newline at end of file +export default AncientCommand; \ No newline at end of file diff --git a/commands/fun/bird.js b/commands/fun/bird.js index 0f24127..ff5ab43 100644 --- a/commands/fun/bird.js +++ b/commands/fun/bird.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class BirdCommand extends Command { async run() { @@ -20,4 +20,4 @@ class BirdCommand extends Command { static aliases = ["birb", "birds", "birbs"]; } -module.exports = BirdCommand; \ No newline at end of file +export default BirdCommand; \ No newline at end of file diff --git a/commands/fun/cat.js b/commands/fun/cat.js index d9e1046..57f5caa 100644 --- a/commands/fun/cat.js +++ b/commands/fun/cat.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class CatCommand extends Command { async run() { @@ -31,4 +31,4 @@ class CatCommand extends Command { static aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats", "cta"]; } -module.exports = CatCommand; \ No newline at end of file +export default CatCommand; \ No newline at end of file diff --git a/commands/fun/cowsay.js b/commands/fun/cowsay.js index d5dd3b3..026a9cd 100644 --- a/commands/fun/cowsay.js +++ b/commands/fun/cowsay.js @@ -1,6 +1,6 @@ -const cowsay = require("cowsay2"); -const cows = require("cowsay2/cows"); -const Command = require("../../classes/command.js"); +import { say } from "cowsay2"; +import cows from "cowsay2/cows/index.js"; +import Command from "../../classes/command.js"; class CowsayCommand extends Command { async run() { @@ -8,9 +8,9 @@ class CowsayCommand extends Command { return "You need to provide some text for the cow to say!"; } else if (cows[this.args[0].toLowerCase()] != undefined) { const cow = cows[this.args.shift().toLowerCase()]; - return `\`\`\`\n${cowsay.say(this.args.join(" "), { cow })}\n\`\`\``; + return `\`\`\`\n${say(this.args.join(" "), { cow })}\n\`\`\``; } else { - return `\`\`\`\n${cowsay.say(this.args.join(" "))}\n\`\`\``; + return `\`\`\`\n${say(this.args.join(" "))}\n\`\`\``; } } @@ -19,4 +19,4 @@ class CowsayCommand extends Command { static arguments = ["{cow}", "[text]"]; } -module.exports = CowsayCommand; \ No newline at end of file +export default CowsayCommand; \ No newline at end of file diff --git a/commands/fun/dice.js b/commands/fun/dice.js index efa8be4..41cdc85 100644 --- a/commands/fun/dice.js +++ b/commands/fun/dice.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class DiceCommand extends Command { async run() { @@ -14,4 +14,4 @@ class DiceCommand extends Command { static arguments = ["{number}"]; } -module.exports = DiceCommand; \ No newline at end of file +export default DiceCommand; \ No newline at end of file diff --git a/commands/fun/dog.js b/commands/fun/dog.js index 1afafd0..0d5452d 100644 --- a/commands/fun/dog.js +++ b/commands/fun/dog.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class DogCommand extends Command { async run() { @@ -20,4 +20,4 @@ class DogCommand extends Command { static aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"]; } -module.exports = DogCommand; \ No newline at end of file +export default DogCommand; \ No newline at end of file diff --git a/commands/fun/fullwidth.js b/commands/fun/fullwidth.js index 50298f3..ea63a07 100644 --- a/commands/fun/fullwidth.js +++ b/commands/fun/fullwidth.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class FullwidthCommand extends Command { async run() { @@ -11,4 +11,4 @@ class FullwidthCommand extends Command { static arguments = ["[text]"]; } -module.exports = FullwidthCommand; \ No newline at end of file +export default FullwidthCommand; \ No newline at end of file diff --git a/commands/fun/homebrew.js b/commands/fun/homebrew.js index 3df8c9c..0c34185 100644 --- a/commands/fun/homebrew.js +++ b/commands/fun/homebrew.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class HomebrewCommand extends ImageCommand { params() { @@ -17,4 +17,4 @@ class HomebrewCommand extends ImageCommand { static command = "homebrew"; } -module.exports = HomebrewCommand; \ No newline at end of file +export default HomebrewCommand; \ No newline at end of file diff --git a/commands/fun/mc.js b/commands/fun/mc.js index 0951105..2144157 100644 --- a/commands/fun/mc.js +++ b/commands/fun/mc.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class MCCommand extends Command { async run() { @@ -17,4 +17,4 @@ class MCCommand extends Command { static arguments = ["[text]"]; } -module.exports = MCCommand; \ No newline at end of file +export default MCCommand; \ No newline at end of file diff --git a/commands/fun/retro.js b/commands/fun/retro.js index 73fdd81..91e103c 100644 --- a/commands/fun/retro.js +++ b/commands/fun/retro.js @@ -1,5 +1,5 @@ -const wrap = require("../../utils/wrap.js"); -const ImageCommand = require("../../classes/imageCommand.js"); +import wrap from "../../utils/wrap.js"; +import ImageCommand from "../../classes/imageCommand.js"; class RetroCommand extends ImageCommand { params() { @@ -29,4 +29,4 @@ class RetroCommand extends ImageCommand { static command = "retro"; } -module.exports = RetroCommand; \ No newline at end of file +export default RetroCommand; \ No newline at end of file diff --git a/commands/fun/rps.js b/commands/fun/rps.js index 355e26a..cd56f01 100644 --- a/commands/fun/rps.js +++ b/commands/fun/rps.js @@ -1,12 +1,12 @@ -const misc = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import { random } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; class RPSCommand extends Command { async run() { if (this.args.length === 0 || (this.args[0] !== "rock" && this.args[0] !== "paper" && this.args[0] !== "scissors")) return "You need to choose whether you want to be rock, paper, or scissors!"; let emoji; let winOrLose; - const result = misc.random(["rock", "paper", "scissors"]); + const result = random(["rock", "paper", "scissors"]); switch (result) { case "rock": emoji = "✊"; @@ -31,4 +31,4 @@ class RPSCommand extends Command { static arguments = ["[rock/paper/scissors]"]; } -module.exports = RPSCommand; \ No newline at end of file +export default RPSCommand; \ No newline at end of file diff --git a/commands/fun/sonic.js b/commands/fun/sonic.js index e633c0d..024b325 100644 --- a/commands/fun/sonic.js +++ b/commands/fun/sonic.js @@ -1,5 +1,5 @@ -const wrap = require("../../utils/wrap.js"); -const ImageCommand = require("../../classes/imageCommand.js"); +import wrap from "../../utils/wrap.js"; +import ImageCommand from "../../classes/imageCommand.js"; class SonicCommand extends ImageCommand { params() { @@ -18,4 +18,4 @@ class SonicCommand extends ImageCommand { static command = "sonic"; } -module.exports = SonicCommand; \ No newline at end of file +export default SonicCommand; \ No newline at end of file diff --git a/commands/fun/wikihow.js b/commands/fun/wikihow.js index 80e039a..cac6644 100644 --- a/commands/fun/wikihow.js +++ b/commands/fun/wikihow.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class WikihowCommand extends Command { async run() { @@ -25,4 +25,4 @@ class WikihowCommand extends Command { static requires = ["mashape"]; } -module.exports = WikihowCommand; \ No newline at end of file +export default WikihowCommand; \ No newline at end of file diff --git a/commands/fun/xkcd.js b/commands/fun/xkcd.js index c09e9d7..8e320b0 100644 --- a/commands/fun/xkcd.js +++ b/commands/fun/xkcd.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class XKCDCommand extends Command { async run() { @@ -28,4 +28,4 @@ class XKCDCommand extends Command { static arguments = ["{id}"]; } -module.exports = XKCDCommand; \ No newline at end of file +export default XKCDCommand; \ No newline at end of file diff --git a/commands/general/avatar.js b/commands/general/avatar.js index 1520bf0..ddaba9e 100644 --- a/commands/general/avatar.js +++ b/commands/general/avatar.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class AvatarCommand extends Command { async run() { @@ -23,4 +23,4 @@ class AvatarCommand extends Command { static arguments = ["{mention/id}"]; } -module.exports = AvatarCommand; \ No newline at end of file +export default AvatarCommand; \ No newline at end of file diff --git a/commands/general/broadcast.js b/commands/general/broadcast.js index 6a37ce2..923c2c8 100644 --- a/commands/general/broadcast.js +++ b/commands/general/broadcast.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class BroadcastCommand extends Command { // yet another very hacky command @@ -24,4 +24,4 @@ class BroadcastCommand extends Command { static description = "Broadcasts a playing message until the command is run again or the bot restarts"; } -module.exports = BroadcastCommand; \ No newline at end of file +export default BroadcastCommand; \ No newline at end of file diff --git a/commands/general/channel.js b/commands/general/channel.js index a44924d..ee8d108 100644 --- a/commands/general/channel.js +++ b/commands/general/channel.js @@ -1,5 +1,5 @@ -const db = require("../../utils/database.js"); -const Command = require("../../classes/command.js"); +import db from "../../utils/database.js"; +import Command from "../../classes/command.js"; class ChannelCommand extends Command { async run() { @@ -43,4 +43,4 @@ class ChannelCommand extends Command { static arguments = ["[enable/disable]", "{id}"]; } -module.exports = ChannelCommand; \ No newline at end of file +export default ChannelCommand; \ No newline at end of file diff --git a/commands/general/command.js b/commands/general/command.js index 702a466..a927303 100644 --- a/commands/general/command.js +++ b/commands/general/command.js @@ -1,6 +1,6 @@ -const db = require("../../utils/database.js"); -const Command = require("../../classes/command.js"); -const collections = require("../../utils/collections.js"); +import db from "../../utils/database.js"; +import Command from "../../classes/command.js"; +import * as collections from "../../utils/collections.js"; class CommandCommand extends Command { async run() { @@ -35,4 +35,4 @@ class CommandCommand extends Command { static arguments = ["[enable/disable]", "[command]"]; } -module.exports = CommandCommand; \ No newline at end of file +export default CommandCommand; \ No newline at end of file diff --git a/commands/general/count.js b/commands/general/count.js index 0b93a78..2945c10 100644 --- a/commands/general/count.js +++ b/commands/general/count.js @@ -1,6 +1,6 @@ -const paginator = require("../../utils/pagination/pagination.js"); -const database = require("../../utils/database.js"); -const Command = require("../../classes/command.js"); +import paginator from "../../utils/pagination/pagination.js"; +import database from "../../utils/database.js"; +import Command from "../../classes/command.js"; class CountCommand extends Command { async run() { @@ -46,4 +46,4 @@ class CountCommand extends Command { static arguments = ["{mention/id}"]; } -module.exports = CountCommand; \ No newline at end of file +export default CountCommand; \ No newline at end of file diff --git a/commands/general/decode.js b/commands/general/decode.js index 23f93af..046bb8f 100644 --- a/commands/general/decode.js +++ b/commands/general/decode.js @@ -1,5 +1,5 @@ -const { clean } = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import { clean } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; class DecodeCommand extends Command { async run() { @@ -13,4 +13,4 @@ class DecodeCommand extends Command { static arguments = ["[text]"]; } -module.exports = DecodeCommand; \ No newline at end of file +export default DecodeCommand; \ No newline at end of file diff --git a/commands/general/donate.js b/commands/general/donate.js index bfbe362..d5e2bf6 100644 --- a/commands/general/donate.js +++ b/commands/general/donate.js @@ -1,5 +1,5 @@ -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class DonateCommand extends Command { async run() { @@ -27,4 +27,4 @@ class DonateCommand extends Command { static aliases = ["support", "patreon", "patrons"]; } -module.exports = DonateCommand; \ No newline at end of file +export default DonateCommand; \ No newline at end of file diff --git a/commands/general/emote.js b/commands/general/emote.js index 0442c70..8ab6af6 100644 --- a/commands/general/emote.js +++ b/commands/general/emote.js @@ -1,5 +1,5 @@ -const emojiRegex = require("emoji-regex"); -const Command = require("../../classes/command.js"); +import emojiRegex from "emoji-regex"; +import Command from "../../classes/command.js"; class EmoteCommand extends Command { async run() { @@ -22,4 +22,4 @@ class EmoteCommand extends Command { static arguments = ["[emote]"]; } -module.exports = EmoteCommand; \ No newline at end of file +export default EmoteCommand; \ No newline at end of file diff --git a/commands/general/encode.js b/commands/general/encode.js index 594f0fb..4bb8a5b 100644 --- a/commands/general/encode.js +++ b/commands/general/encode.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class EncodeCommand extends Command { async run() { @@ -12,4 +12,4 @@ class EncodeCommand extends Command { static arguments = ["[text]"]; } -module.exports = EncodeCommand; \ No newline at end of file +export default EncodeCommand; \ No newline at end of file diff --git a/commands/general/eval.js b/commands/general/eval.js index 3ecd4a3..437835e 100644 --- a/commands/general/eval.js +++ b/commands/general/eval.js @@ -1,5 +1,5 @@ -const { clean } = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import { clean } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; class EvalCommand extends Command { async run() { @@ -28,4 +28,4 @@ class EvalCommand extends Command { static arguments = ["[code]"]; } -module.exports = EvalCommand; \ No newline at end of file +export default EvalCommand; \ No newline at end of file diff --git a/commands/general/evalraw.js b/commands/general/evalraw.js index 9dbb531..12e4566 100644 --- a/commands/general/evalraw.js +++ b/commands/general/evalraw.js @@ -1,5 +1,5 @@ -const { clean } = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import { clean } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; class EvalRawCommand extends Command { async run() { @@ -26,4 +26,4 @@ class EvalRawCommand extends Command { static arguments = ["[code]"]; } -module.exports = EvalRawCommand; \ No newline at end of file +export default EvalRawCommand; \ No newline at end of file diff --git a/commands/general/exec.js b/commands/general/exec.js index 23540e9..490a108 100644 --- a/commands/general/exec.js +++ b/commands/general/exec.js @@ -1,7 +1,8 @@ -const { clean } = require("../../utils/misc.js"); -const util = require("util"); -const exec = util.promisify(require("child_process").exec); -const Command = require("../../classes/command.js"); +import { clean } from "../../utils/misc.js"; +import * as util from "util"; +import { exec as baseExec } from "child_process"; +const exec = util.promisify(baseExec); +import Command from "../../classes/command.js"; class ExecCommand extends Command { async run() { @@ -31,4 +32,4 @@ class ExecCommand extends Command { static arguments = ["[command]"]; } -module.exports = ExecCommand; \ No newline at end of file +export default ExecCommand; \ No newline at end of file diff --git a/commands/general/help.js b/commands/general/help.js index 75f787f..ba4f0cc 100644 --- a/commands/general/help.js +++ b/commands/general/help.js @@ -1,10 +1,10 @@ -const database = require("../../utils/database.js"); -const collections = require("../../utils/collections.js"); -const misc = require("../../utils/misc.js"); -const paginator = require("../../utils/pagination/pagination.js"); -const help = require("../../utils/help.js"); -const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem"]; -const Command = require("../../classes/command.js"); +import database from "../../utils/database.js"; +import * as collections from "../../utils/collections.js"; +import { random } from "../../utils/misc.js"; +import paginator from "../../utils/pagination/pagination.js"; +import * as help from "../../utils/help.js"; +import Command from "../../classes/command.js"; +const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://projectlounge.pw/esmBot/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem", "You can run commands in DMs as well, just message the bot with your command - no prefix needed!"]; class HelpCommand extends Command { async run() { @@ -89,7 +89,7 @@ class HelpCommand extends Command { "value": this.message.channel.guild ? prefix : "N/A" }, { "name": "Tip", - "value": misc.random(tips) + "value": random(tips) }] } }); @@ -103,4 +103,4 @@ class HelpCommand extends Command { static arguments = ["{command}"]; } -module.exports = HelpCommand; \ No newline at end of file +export default HelpCommand; \ No newline at end of file diff --git a/commands/general/image.js b/commands/general/image.js index 8fda098..d37bf0e 100644 --- a/commands/general/image.js +++ b/commands/general/image.js @@ -1,8 +1,9 @@ -const paginator = require("../../utils/pagination/pagination.js"); -const { searx } = require("../../servers.json"); -const { random } = require("../../utils/misc.js"); -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import paginator from "../../utils/pagination/pagination.js"; +import { readFileSync } from "fs"; +const { searx } = JSON.parse(readFileSync(new URL("../../servers.json", import.meta.url))); +import { random } from "../../utils/misc.js"; +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class ImageSearchCommand extends Command { async run() { @@ -40,4 +41,4 @@ class ImageSearchCommand extends Command { static arguments = ["[query]"]; } -module.exports = ImageSearchCommand; \ No newline at end of file +export default ImageSearchCommand; \ No newline at end of file diff --git a/commands/general/imagereload.js b/commands/general/imagereload.js index df8f3e1..55264dc 100644 --- a/commands/general/imagereload.js +++ b/commands/general/imagereload.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class ImageReloadCommand extends Command { async run() { @@ -15,4 +15,4 @@ class ImageReloadCommand extends Command { static aliases = ["magickconnect", "magick"]; } -module.exports = ImageReloadCommand; \ No newline at end of file +export default ImageReloadCommand; \ No newline at end of file diff --git a/commands/general/imagestats.js b/commands/general/imagestats.js index b09d91c..ff99714 100644 --- a/commands/general/imagestats.js +++ b/commands/general/imagestats.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class ImageStatsCommand extends Command { async run() { @@ -28,4 +28,4 @@ class ImageStatsCommand extends Command { static aliases = ["imgstat", "imstats", "imgstats", "imstat"]; } -module.exports = ImageStatsCommand; \ No newline at end of file +export default ImageStatsCommand; \ No newline at end of file diff --git a/commands/general/info.js b/commands/general/info.js index 580e595..af26f93 100644 --- a/commands/general/info.js +++ b/commands/general/info.js @@ -1,5 +1,6 @@ -const { version } = require("../../package.json"); -const Command = require("../../classes/command.js"); +import { readFileSync } from "fs"; +const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url))); +import Command from "../../classes/command.js"; class InfoCommand extends Command { async run() { @@ -46,4 +47,4 @@ class InfoCommand extends Command { static aliases = ["botinfo", "credits"]; } -module.exports = InfoCommand; \ No newline at end of file +export default InfoCommand; \ No newline at end of file diff --git a/commands/general/invite.js b/commands/general/invite.js index de8fb25..b7479de 100644 --- a/commands/general/invite.js +++ b/commands/general/invite.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class InviteCommand extends Command { async run() { @@ -9,4 +9,4 @@ class InviteCommand extends Command { static aliases = ["botinfo", "credits"]; } -module.exports = InviteCommand; \ No newline at end of file +export default InviteCommand; \ No newline at end of file diff --git a/commands/general/lengthen.js b/commands/general/lengthen.js index 6fdee67..ebe6e99 100644 --- a/commands/general/lengthen.js +++ b/commands/general/lengthen.js @@ -1,6 +1,6 @@ -const urlCheck = require("../../utils/urlcheck.js"); -const fetch = require("node-fetch"); -const Command = require("../../classes/command.js"); +import urlCheck from "../../utils/urlcheck.js"; +import fetch from "node-fetch"; +import Command from "../../classes/command.js"; class LengthenCommand extends Command { async run() { @@ -19,4 +19,4 @@ class LengthenCommand extends Command { static arguments = ["[url]"]; } -module.exports = LengthenCommand; \ No newline at end of file +export default LengthenCommand; \ No newline at end of file diff --git a/commands/general/ping.js b/commands/general/ping.js index 3878b43..19f033a 100644 --- a/commands/general/ping.js +++ b/commands/general/ping.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class PingCommand extends Command { async run() { @@ -12,4 +12,4 @@ class PingCommand extends Command { static aliases = ["pong"]; } -module.exports = PingCommand; \ No newline at end of file +export default PingCommand; \ No newline at end of file diff --git a/commands/general/prefix.js b/commands/general/prefix.js index 19b29c4..89c7620 100644 --- a/commands/general/prefix.js +++ b/commands/general/prefix.js @@ -1,5 +1,5 @@ -const database = require("../../utils/database.js"); -const Command = require("../../classes/command.js"); +import database from "../../utils/database.js"; +import Command from "../../classes/command.js"; class PrefixCommand extends Command { async run() { @@ -19,4 +19,4 @@ class PrefixCommand extends Command { static arguments = ["{prefix}"]; } -module.exports = PrefixCommand; \ No newline at end of file +export default PrefixCommand; \ No newline at end of file diff --git a/commands/general/qrcreate.js b/commands/general/qrcreate.js index e4f1931..20ee181 100644 --- a/commands/general/qrcreate.js +++ b/commands/general/qrcreate.js @@ -1,12 +1,12 @@ -const qrcode = require("qrcode"); -const stream = require("stream"); -const Command = require("../../classes/command.js"); +import qrcode from "qrcode"; +import { PassThrough } from "stream"; +import Command from "../../classes/command.js"; class QrCreateCommand extends Command { async run() { if (this.args.length === 0) return "You need to provide some text to generate a QR code!"; this.client.sendChannelTyping(this.message.channel.id); - const writable = new stream.PassThrough(); + const writable = new PassThrough(); qrcode.toFileStream(writable, this.content, { margin: 1 }); const file = await this.streamToBuf(writable); return { @@ -34,4 +34,4 @@ class QrCreateCommand extends Command { static arguments = ["[text]"]; } -module.exports = QrCreateCommand; \ No newline at end of file +export default QrCreateCommand; \ No newline at end of file diff --git a/commands/general/qrread.js b/commands/general/qrread.js index 7b0530d..1ed49a6 100644 --- a/commands/general/qrread.js +++ b/commands/general/qrread.js @@ -1,12 +1,13 @@ -const jsqr = require("jsqr"); -const fetch = require("node-fetch"); -const sharp = require("sharp"); -const { clean } = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import jsqr from "jsqr"; +import fetch from "node-fetch"; +import sharp from "sharp"; +import { clean } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; +import imageDetect from "../../utils/imagedetect.js"; class QrReadCommand extends Command { async run() { - const image = await require("../../utils/imagedetect.js")(this.client, this.message); + const image = await imageDetect(this.client, this.message); if (image === undefined) return "You need to provide an image with a QR code to read!"; this.client.sendChannelTyping(this.message.channel.id); const data = await (await fetch(image.path)).buffer(); @@ -19,4 +20,4 @@ class QrReadCommand extends Command { static description = "Reads a QR code"; } -module.exports = QrReadCommand; \ No newline at end of file +export default QrReadCommand; \ No newline at end of file diff --git a/commands/general/raw.js b/commands/general/raw.js index 46089a9..3af79bf 100644 --- a/commands/general/raw.js +++ b/commands/general/raw.js @@ -1,5 +1,5 @@ -const Command = require("../../classes/command.js"); -const imageDetect = require("../../utils/imagedetect.js"); +import Command from "../../classes/command.js"; +import imageDetect from "../../utils/imagedetect.js"; class RawCommand extends Command { async run() { @@ -13,4 +13,4 @@ class RawCommand extends Command { static aliases = ["gif", "getgif", "giflink", "imglink", "getimg", "rawgif", "rawimg"]; } -module.exports = RawCommand; \ No newline at end of file +export default RawCommand; \ No newline at end of file diff --git a/commands/general/reload.js b/commands/general/reload.js index 9276243..4b80916 100644 --- a/commands/general/reload.js +++ b/commands/general/reload.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class ReloadCommand extends Command { // quite possibly one of the hackiest commands in the bot @@ -24,4 +24,4 @@ class ReloadCommand extends Command { static arguments = ["[command]"]; } -module.exports = ReloadCommand; \ No newline at end of file +export default ReloadCommand; \ No newline at end of file diff --git a/commands/general/restart.js b/commands/general/restart.js index 1bf7836..3992aff 100644 --- a/commands/general/restart.js +++ b/commands/general/restart.js @@ -1,6 +1,4 @@ -const handler = require("../../utils/handler.js"); -const collections = require("../../utils/collections.js"); -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class RestartCommand extends Command { async run() { @@ -8,9 +6,6 @@ class RestartCommand extends Command { await this.client.createMessage(this.message.channel.id, Object.assign({ content: "esmBot is restarting." }, this.reference)); - for (const command of collections.commands) { - await handler.unload(command); - } this.ipc.restartAllClusters(true); //this.ipc.broadcast("restart"); } @@ -19,4 +14,4 @@ class RestartCommand extends Command { static aliases = ["reboot"]; } -module.exports = RestartCommand; \ No newline at end of file +export default RestartCommand; \ No newline at end of file diff --git a/commands/general/serverinfo.js b/commands/general/serverinfo.js index 8e85318..8b07696 100644 --- a/commands/general/serverinfo.js +++ b/commands/general/serverinfo.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class ServerInfoCommand extends Command { async run() { @@ -49,4 +49,4 @@ class ServerInfoCommand extends Command { static aliases = ["server"]; } -module.exports = ServerInfoCommand; \ No newline at end of file +export default ServerInfoCommand; \ No newline at end of file diff --git a/commands/general/snowflake.js b/commands/general/snowflake.js index e4c60f5..b08f5d2 100644 --- a/commands/general/snowflake.js +++ b/commands/general/snowflake.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class SnowflakeCommand extends Command { async run() { @@ -12,4 +12,4 @@ class SnowflakeCommand extends Command { static arguments = ["[id]"]; } -module.exports = SnowflakeCommand; \ No newline at end of file +export default SnowflakeCommand; \ No newline at end of file diff --git a/commands/general/soundreload.js b/commands/general/soundreload.js index ac8b37a..f1bcfe5 100644 --- a/commands/general/soundreload.js +++ b/commands/general/soundreload.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class SoundReloadCommand extends Command { // another very hacky command @@ -24,4 +24,4 @@ class SoundReloadCommand extends Command { static aliases = ["lava", "lavalink", "lavaconnect", "soundconnect"]; } -module.exports = SoundReloadCommand; \ No newline at end of file +export default SoundReloadCommand; \ No newline at end of file diff --git a/commands/general/stats.js b/commands/general/stats.js index 65fad23..3ba3f91 100644 --- a/commands/general/stats.js +++ b/commands/general/stats.js @@ -1,6 +1,8 @@ -const { version } = require("../../package.json"); -const os = require("os"); -const Command = require("../../classes/command.js"); +import { readFileSync } from "fs"; +const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url))); +import os from "os"; +import Command from "../../classes/command.js"; +import { VERSION } from "eris"; class StatsCommand extends Command { async run() { @@ -44,7 +46,7 @@ class StatsCommand extends Command { }, { "name": "Library", - "value": `Eris ${require("eris").VERSION}`, + "value": `Eris ${VERSION}`, "inline": true }, { @@ -81,4 +83,4 @@ class StatsCommand extends Command { static aliases = ["status", "stat"]; } -module.exports = StatsCommand; \ No newline at end of file +export default StatsCommand; \ No newline at end of file diff --git a/commands/general/userinfo.js b/commands/general/userinfo.js index f3fc5a1..a8d87a3 100644 --- a/commands/general/userinfo.js +++ b/commands/general/userinfo.js @@ -1,4 +1,4 @@ -const Command = require("../../classes/command.js"); +import Command from "../../classes/command.js"; class UserInfoCommand extends Command { async run() { @@ -54,4 +54,4 @@ class UserInfoCommand extends Command { static arguments = ["[mention/id]"]; } -module.exports = UserInfoCommand; \ No newline at end of file +export default UserInfoCommand; \ No newline at end of file diff --git a/commands/general/youtube.js b/commands/general/youtube.js index 7ec4984..1a79989 100644 --- a/commands/general/youtube.js +++ b/commands/general/youtube.js @@ -1,8 +1,9 @@ -const fetch = require("node-fetch"); -const { searx } = require("../../servers.json"); -const { random } = require("../../utils/misc.js"); -const paginator = require("../../utils/pagination/pagination.js"); -const Command = require("../../classes/command.js"); +import fetch from "node-fetch"; +import { readFileSync } from "fs"; +const { searx } = JSON.parse(readFileSync(new URL("../../servers.json", import.meta.url))); +import { random } from "../../utils/misc.js"; +import paginator from "../../utils/pagination/pagination.js"; +import Command from "../../classes/command.js"; class YouTubeCommand extends Command { async run() { @@ -22,4 +23,4 @@ class YouTubeCommand extends Command { static arguments = ["[query]"]; } -module.exports = YouTubeCommand; \ No newline at end of file +export default YouTubeCommand; \ No newline at end of file diff --git a/commands/image-editing/9gag.js b/commands/image-editing/9gag.js index 15b0509..bcf4be4 100644 --- a/commands/image-editing/9gag.js +++ b/commands/image-editing/9gag.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class NineGagCommand extends ImageCommand { params = { @@ -13,4 +13,4 @@ class NineGagCommand extends ImageCommand { static command = "watermark"; } -module.exports = NineGagCommand; \ No newline at end of file +export default NineGagCommand; \ No newline at end of file diff --git a/commands/image-editing/bandicam.js b/commands/image-editing/bandicam.js index 6328bd0..46e4169 100644 --- a/commands/image-editing/bandicam.js +++ b/commands/image-editing/bandicam.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class BandicamCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class BandicamCommand extends ImageCommand { static command = "watermark"; } -module.exports = BandicamCommand; \ No newline at end of file +export default BandicamCommand; \ No newline at end of file diff --git a/commands/image-editing/blur.js b/commands/image-editing/blur.js index e63470f..f0899b9 100644 --- a/commands/image-editing/blur.js +++ b/commands/image-editing/blur.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class BlurCommand extends ImageCommand { params = { @@ -11,4 +11,4 @@ class BlurCommand extends ImageCommand { static command = "blur"; } -module.exports = BlurCommand; \ No newline at end of file +export default BlurCommand; \ No newline at end of file diff --git a/commands/image-editing/blurple.js b/commands/image-editing/blurple.js index 5e0f2fa..6dcef80 100644 --- a/commands/image-editing/blurple.js +++ b/commands/image-editing/blurple.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class BlurpleCommand extends ImageCommand { params() { @@ -18,4 +18,4 @@ class BlurpleCommand extends ImageCommand { static aliases = ["blurp"]; } -module.exports = BlurpleCommand; \ No newline at end of file +export default BlurpleCommand; \ No newline at end of file diff --git a/commands/image-editing/caption.js b/commands/image-editing/caption.js index c97699d..755907c 100644 --- a/commands/image-editing/caption.js +++ b/commands/image-editing/caption.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; const allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto"]; class CaptionCommand extends ImageCommand { @@ -30,4 +30,4 @@ class CaptionCommand extends ImageCommand { static command = "caption"; } -module.exports = CaptionCommand; \ No newline at end of file +export default CaptionCommand; \ No newline at end of file diff --git a/commands/image-editing/caption2.js b/commands/image-editing/caption2.js index d22318b..bf08302 100644 --- a/commands/image-editing/caption2.js +++ b/commands/image-editing/caption2.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"]; class CaptionTwoCommand extends ImageCommand { @@ -23,4 +23,4 @@ class CaptionTwoCommand extends ImageCommand { static command = "captionTwo"; } -module.exports = CaptionTwoCommand; +export default CaptionTwoCommand; diff --git a/commands/image-editing/circle.js b/commands/image-editing/circle.js index 00124ca..a825d08 100644 --- a/commands/image-editing/circle.js +++ b/commands/image-editing/circle.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class CircleCommand extends ImageCommand { static description = "Applies a radial blur effect on an image"; @@ -8,4 +8,4 @@ class CircleCommand extends ImageCommand { static command = "circle"; } -module.exports = CircleCommand; \ No newline at end of file +export default CircleCommand; \ No newline at end of file diff --git a/commands/image-editing/crop.js b/commands/image-editing/crop.js index 320859e..903f44e 100644 --- a/commands/image-editing/crop.js +++ b/commands/image-editing/crop.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class CropCommand extends ImageCommand { static description = "Crops an image to 1:1"; @@ -7,4 +7,4 @@ class CropCommand extends ImageCommand { static command = "crop"; } -module.exports = CropCommand; \ No newline at end of file +export default CropCommand; \ No newline at end of file diff --git a/commands/image-editing/deepfry.js b/commands/image-editing/deepfry.js index 369cedf..baa453d 100644 --- a/commands/image-editing/deepfry.js +++ b/commands/image-editing/deepfry.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class DeepfryCommand extends ImageCommand { static description = "Deep-fries an image"; @@ -8,4 +8,4 @@ class DeepfryCommand extends ImageCommand { static command = "deepfry"; } -module.exports = DeepfryCommand; \ No newline at end of file +export default DeepfryCommand; \ No newline at end of file diff --git a/commands/image-editing/deviantart.js b/commands/image-editing/deviantart.js index 1d0b40a..2aa68f1 100644 --- a/commands/image-editing/deviantart.js +++ b/commands/image-editing/deviantart.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class DeviantArtCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class DeviantArtCommand extends ImageCommand { static command = "watermark"; } -module.exports = DeviantArtCommand; \ No newline at end of file +export default DeviantArtCommand; \ No newline at end of file diff --git a/commands/image-editing/explode.js b/commands/image-editing/explode.js index 8a7b13d..5c0eb93 100644 --- a/commands/image-editing/explode.js +++ b/commands/image-editing/explode.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class ExplodeCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class ExplodeCommand extends ImageCommand { static command = "explode"; } -module.exports = ExplodeCommand; \ No newline at end of file +export default ExplodeCommand; \ No newline at end of file diff --git a/commands/image-editing/flag.js b/commands/image-editing/flag.js index 03a3cef..eb55a9a 100644 --- a/commands/image-editing/flag.js +++ b/commands/image-editing/flag.js @@ -1,7 +1,7 @@ -const fs = require("fs"); -const emojiRegex = require("emoji-regex"); -const emoji = require("node-emoji"); -const ImageCommand = require("../../classes/imageCommand.js"); +import fs from "fs"; +import emojiRegex from "emoji-regex"; +import emoji from "node-emoji"; +import ImageCommand from "../../classes/imageCommand.js"; class FlagCommand extends ImageCommand { flagPath = ""; @@ -38,4 +38,4 @@ class FlagCommand extends ImageCommand { static command = "flag"; } -module.exports = FlagCommand; \ No newline at end of file +export default FlagCommand; \ No newline at end of file diff --git a/commands/image-editing/flip.js b/commands/image-editing/flip.js index 7e5887d..3076b5a 100644 --- a/commands/image-editing/flip.js +++ b/commands/image-editing/flip.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class FlipCommand extends ImageCommand { static description = "Flips an image"; @@ -7,4 +7,4 @@ class FlipCommand extends ImageCommand { static command = "flip"; } -module.exports = FlipCommand; \ No newline at end of file +export default FlipCommand; \ No newline at end of file diff --git a/commands/image-editing/flop.js b/commands/image-editing/flop.js index 0f5b6be..26fdb0e 100644 --- a/commands/image-editing/flop.js +++ b/commands/image-editing/flop.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class FlopCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class FlopCommand extends ImageCommand { static command = "flip"; } -module.exports = FlopCommand; \ No newline at end of file +export default FlopCommand; \ No newline at end of file diff --git a/commands/image-editing/freeze.js b/commands/image-editing/freeze.js index cc7b794..5a5f46e 100644 --- a/commands/image-editing/freeze.js +++ b/commands/image-editing/freeze.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class FreezeCommand extends ImageCommand { params() { @@ -18,4 +18,4 @@ class FreezeCommand extends ImageCommand { static command = "freeze"; } -module.exports = FreezeCommand; \ No newline at end of file +export default FreezeCommand; \ No newline at end of file diff --git a/commands/image-editing/funky.js b/commands/image-editing/funky.js index d5934ac..211cb85 100644 --- a/commands/image-editing/funky.js +++ b/commands/image-editing/funky.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class FunkyCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class FunkyCommand extends ImageCommand { static command = "watermark"; } -module.exports = FunkyCommand; \ No newline at end of file +export default FunkyCommand; \ No newline at end of file diff --git a/commands/image-editing/gamexplain.js b/commands/image-editing/gamexplain.js index b780734..1cd85f3 100644 --- a/commands/image-editing/gamexplain.js +++ b/commands/image-editing/gamexplain.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class GameXplainCommand extends ImageCommand { static description = "Makes a GameXplain thumbnail from an image"; @@ -8,4 +8,4 @@ class GameXplainCommand extends ImageCommand { static command = "gamexplain"; } -module.exports = GameXplainCommand; \ No newline at end of file +export default GameXplainCommand; \ No newline at end of file diff --git a/commands/image-editing/globe.js b/commands/image-editing/globe.js index 5237d81..b535c77 100644 --- a/commands/image-editing/globe.js +++ b/commands/image-editing/globe.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class GlobeCommand extends ImageCommand { static description = "Spins an image"; @@ -8,4 +8,4 @@ class GlobeCommand extends ImageCommand { static command = "globe"; } -module.exports = GlobeCommand; \ No newline at end of file +export default GlobeCommand; \ No newline at end of file diff --git a/commands/image-editing/haah.js b/commands/image-editing/haah.js index a14da2a..33b916e 100644 --- a/commands/image-editing/haah.js +++ b/commands/image-editing/haah.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class HaaHCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class HaaHCommand extends ImageCommand { static command = "mirror"; } -module.exports = HaaHCommand; \ No newline at end of file +export default HaaHCommand; \ No newline at end of file diff --git a/commands/image-editing/hooh.js b/commands/image-editing/hooh.js index f84d1f5..c3a048e 100644 --- a/commands/image-editing/hooh.js +++ b/commands/image-editing/hooh.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class HooHCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class HooHCommand extends ImageCommand { static command = "mirror"; } -module.exports = HooHCommand; \ No newline at end of file +export default HooHCommand; \ No newline at end of file diff --git a/commands/image-editing/hypercam.js b/commands/image-editing/hypercam.js index 39633f7..ba30076 100644 --- a/commands/image-editing/hypercam.js +++ b/commands/image-editing/hypercam.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class HypercamCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class HypercamCommand extends ImageCommand { static command = "watermark"; } -module.exports = HypercamCommand; \ No newline at end of file +export default HypercamCommand; \ No newline at end of file diff --git a/commands/image-editing/ifunny.js b/commands/image-editing/ifunny.js index e475f4d..7af7393 100644 --- a/commands/image-editing/ifunny.js +++ b/commands/image-editing/ifunny.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class iFunnyCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class iFunnyCommand extends ImageCommand { static command = "watermark"; } -module.exports = iFunnyCommand; \ No newline at end of file +export default iFunnyCommand; \ No newline at end of file diff --git a/commands/image-editing/implode.js b/commands/image-editing/implode.js index f5953cb..c1fbc2f 100644 --- a/commands/image-editing/implode.js +++ b/commands/image-editing/implode.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class ImplodeCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class ImplodeCommand extends ImageCommand { static command = "explode"; } -module.exports = ImplodeCommand; \ No newline at end of file +export default ImplodeCommand; \ No newline at end of file diff --git a/commands/image-editing/invert.js b/commands/image-editing/invert.js index bb42e11..1be32a3 100644 --- a/commands/image-editing/invert.js +++ b/commands/image-editing/invert.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class InvertCommand extends ImageCommand { static description = "Inverts an image"; @@ -8,4 +8,4 @@ class InvertCommand extends ImageCommand { static command = "invert"; } -module.exports = InvertCommand; \ No newline at end of file +export default InvertCommand; \ No newline at end of file diff --git a/commands/image-editing/jpeg.js b/commands/image-editing/jpeg.js index b8e7b5f..7d683fa 100644 --- a/commands/image-editing/jpeg.js +++ b/commands/image-editing/jpeg.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class JPEGCommand extends ImageCommand { static description = "Adds max JPEG compression to an image"; @@ -8,4 +8,4 @@ class JPEGCommand extends ImageCommand { static command = "jpeg"; } -module.exports = JPEGCommand; \ No newline at end of file +export default JPEGCommand; \ No newline at end of file diff --git a/commands/image-editing/kinemaster.js b/commands/image-editing/kinemaster.js index 8fe6726..9ff2938 100644 --- a/commands/image-editing/kinemaster.js +++ b/commands/image-editing/kinemaster.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class KineMasterCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class KineMasterCommand extends ImageCommand { static command = "watermark"; } -module.exports = KineMasterCommand; \ No newline at end of file +export default KineMasterCommand; \ No newline at end of file diff --git a/commands/image-editing/leak.js b/commands/image-editing/leak.js index c90a5e3..7763c80 100644 --- a/commands/image-editing/leak.js +++ b/commands/image-editing/leak.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class LeakCommand extends ImageCommand { static description = "Creates a fake Smash leak thumbnail"; @@ -8,4 +8,4 @@ class LeakCommand extends ImageCommand { static command = "leak"; } -module.exports = LeakCommand; \ No newline at end of file +export default LeakCommand; \ No newline at end of file diff --git a/commands/image-editing/magik.js b/commands/image-editing/magik.js index 31f8896..6ce389b 100644 --- a/commands/image-editing/magik.js +++ b/commands/image-editing/magik.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class MagikCommand extends ImageCommand { static description = "Adds a content aware scale effect to an image"; @@ -8,4 +8,4 @@ class MagikCommand extends ImageCommand { static command = "magik"; } -module.exports = MagikCommand; \ No newline at end of file +export default MagikCommand; \ No newline at end of file diff --git a/commands/image-editing/meme.js b/commands/image-editing/meme.js index 1c0f662..282e0c9 100644 --- a/commands/image-editing/meme.js +++ b/commands/image-editing/meme.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class MemeCommand extends ImageCommand { params(url) { @@ -19,4 +19,4 @@ class MemeCommand extends ImageCommand { static command = "meme"; } -module.exports = MemeCommand; \ No newline at end of file +export default MemeCommand; \ No newline at end of file diff --git a/commands/image-editing/memecenter.js b/commands/image-editing/memecenter.js index 12bdc7e..2c65628 100644 --- a/commands/image-editing/memecenter.js +++ b/commands/image-editing/memecenter.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class MemeCenterCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class MemeCenterCommand extends ImageCommand { static command = "watermark"; } -module.exports = MemeCenterCommand; \ No newline at end of file +export default MemeCenterCommand; \ No newline at end of file diff --git a/commands/image-editing/motivate.js b/commands/image-editing/motivate.js index 37cfb0f..ab39dce 100644 --- a/commands/image-editing/motivate.js +++ b/commands/image-editing/motivate.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class MotivateCommand extends ImageCommand { params(url) { @@ -20,4 +20,4 @@ class MotivateCommand extends ImageCommand { static command = "motivate"; } -module.exports = MotivateCommand; \ No newline at end of file +export default MotivateCommand; \ No newline at end of file diff --git a/commands/image-editing/pixelate.js b/commands/image-editing/pixelate.js index 6b96df2..fd97616 100644 --- a/commands/image-editing/pixelate.js +++ b/commands/image-editing/pixelate.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class PixelateCommand extends ImageCommand { static description = "Pixelates an image"; @@ -8,4 +8,4 @@ class PixelateCommand extends ImageCommand { static command = "resize"; } -module.exports = PixelateCommand; \ No newline at end of file +export default PixelateCommand; \ No newline at end of file diff --git a/commands/image-editing/reddit.js b/commands/image-editing/reddit.js index 37274e5..18b3173 100644 --- a/commands/image-editing/reddit.js +++ b/commands/image-editing/reddit.js @@ -1,5 +1,5 @@ -const ImageCommand = require("../../classes/imageCommand.js"); -const { random } = require("../../utils/misc.js"); +import ImageCommand from "../../classes/imageCommand.js"; +import { random } from "../../utils/misc.js"; const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "pcmasterrace", "bellybros"]; class RedditCommand extends ImageCommand { @@ -16,4 +16,4 @@ class RedditCommand extends ImageCommand { static command = "reddit"; } -module.exports = RedditCommand; \ No newline at end of file +export default RedditCommand; \ No newline at end of file diff --git a/commands/image-editing/reverse.js b/commands/image-editing/reverse.js index f76e51a..05ff549 100644 --- a/commands/image-editing/reverse.js +++ b/commands/image-editing/reverse.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class ReverseCommand extends ImageCommand { params(url, delay) { @@ -15,4 +15,4 @@ class ReverseCommand extends ImageCommand { static command = "reverse"; } -module.exports = ReverseCommand; \ No newline at end of file +export default ReverseCommand; \ No newline at end of file diff --git a/commands/image-editing/scott.js b/commands/image-editing/scott.js index d6cad71..4fe2f69 100644 --- a/commands/image-editing/scott.js +++ b/commands/image-editing/scott.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class ScottCommand extends ImageCommand { static description = "Makes Scott the Woz show off an image"; @@ -8,4 +8,4 @@ class ScottCommand extends ImageCommand { static command = "scott"; } -module.exports = ScottCommand; \ No newline at end of file +export default ScottCommand; \ No newline at end of file diff --git a/commands/image-editing/sharpen.js b/commands/image-editing/sharpen.js index 460ed5f..fa8dad4 100644 --- a/commands/image-editing/sharpen.js +++ b/commands/image-editing/sharpen.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SharpenCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class SharpenCommand extends ImageCommand { static command = "blur"; } -module.exports = SharpenCommand; \ No newline at end of file +export default SharpenCommand; \ No newline at end of file diff --git a/commands/image-editing/shutterstock.js b/commands/image-editing/shutterstock.js index dd62abb..46b345b 100644 --- a/commands/image-editing/shutterstock.js +++ b/commands/image-editing/shutterstock.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class ShutterstockCommand extends ImageCommand { params = { @@ -14,4 +14,4 @@ class ShutterstockCommand extends ImageCommand { static command = "watermark"; } -module.exports = ShutterstockCommand; \ No newline at end of file +export default ShutterstockCommand; \ No newline at end of file diff --git a/commands/image-editing/slow.js b/commands/image-editing/slow.js index d04ea7e..af74935 100644 --- a/commands/image-editing/slow.js +++ b/commands/image-editing/slow.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SlowCommand extends ImageCommand { params() { @@ -18,4 +18,4 @@ class SlowCommand extends ImageCommand { static command = "speed"; } -module.exports = SlowCommand; \ No newline at end of file +export default SlowCommand; \ No newline at end of file diff --git a/commands/image-editing/snapchat.js b/commands/image-editing/snapchat.js index 9577e49..07e8ce6 100644 --- a/commands/image-editing/snapchat.js +++ b/commands/image-editing/snapchat.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SnapchatCommand extends ImageCommand { params(url) { @@ -25,4 +25,4 @@ class SnapchatCommand extends ImageCommand { static command = "snapchat"; } -module.exports = SnapchatCommand; \ No newline at end of file +export default SnapchatCommand; \ No newline at end of file diff --git a/commands/image-editing/soos.js b/commands/image-editing/soos.js index 3366205..5ae263d 100644 --- a/commands/image-editing/soos.js +++ b/commands/image-editing/soos.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SooSCommand extends ImageCommand { params(url, delay) { @@ -16,4 +16,4 @@ class SooSCommand extends ImageCommand { static command = "reverse"; } -module.exports = SooSCommand; \ No newline at end of file +export default SooSCommand; \ No newline at end of file diff --git a/commands/image-editing/speed.js b/commands/image-editing/speed.js index 0000404..c5e6e5b 100644 --- a/commands/image-editing/speed.js +++ b/commands/image-editing/speed.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SpeedCommand extends ImageCommand { params() { @@ -17,4 +17,4 @@ class SpeedCommand extends ImageCommand { static command = "speed"; } -module.exports = SpeedCommand; \ No newline at end of file +export default SpeedCommand; \ No newline at end of file diff --git a/commands/image-editing/spin.js b/commands/image-editing/spin.js index 0f1f55b..cad6dc1 100644 --- a/commands/image-editing/spin.js +++ b/commands/image-editing/spin.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SpinCommand extends ImageCommand { static description = "Spins an image"; @@ -8,4 +8,4 @@ class SpinCommand extends ImageCommand { static command = "spin"; } -module.exports = SpinCommand; \ No newline at end of file +export default SpinCommand; \ No newline at end of file diff --git a/commands/image-editing/stretch.js b/commands/image-editing/stretch.js index fd6a6f3..e1215dc 100644 --- a/commands/image-editing/stretch.js +++ b/commands/image-editing/stretch.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class StretchCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class StretchCommand extends ImageCommand { static command = "resize"; } -module.exports = StretchCommand; \ No newline at end of file +export default StretchCommand; \ No newline at end of file diff --git a/commands/image-editing/swirl.js b/commands/image-editing/swirl.js index d49c179..6cd82d9 100644 --- a/commands/image-editing/swirl.js +++ b/commands/image-editing/swirl.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class SwirlCommand extends ImageCommand { static description = "Swirls an image"; @@ -8,4 +8,4 @@ class SwirlCommand extends ImageCommand { static command = "swirl"; } -module.exports = SwirlCommand; \ No newline at end of file +export default SwirlCommand; \ No newline at end of file diff --git a/commands/image-editing/tile.js b/commands/image-editing/tile.js index ef4de54..7d3378c 100644 --- a/commands/image-editing/tile.js +++ b/commands/image-editing/tile.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class TileCommand extends ImageCommand { static description = "Creates a tile pattern from an image"; @@ -8,4 +8,4 @@ class TileCommand extends ImageCommand { static command = "tile"; } -module.exports = TileCommand; \ No newline at end of file +export default TileCommand; \ No newline at end of file diff --git a/commands/image-editing/trump.js b/commands/image-editing/trump.js index e8d6400..4764efa 100644 --- a/commands/image-editing/trump.js +++ b/commands/image-editing/trump.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class TrumpCommand extends ImageCommand { static description = "Makes Trump display an image"; @@ -7,4 +7,4 @@ class TrumpCommand extends ImageCommand { static command = "trump"; } -module.exports = TrumpCommand; \ No newline at end of file +export default TrumpCommand; \ No newline at end of file diff --git a/commands/image-editing/uncaption.js b/commands/image-editing/uncaption.js index 08e623f..22a4f04 100644 --- a/commands/image-editing/uncaption.js +++ b/commands/image-editing/uncaption.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class UncaptionCommand extends ImageCommand { static description = "Removes the caption from an image"; @@ -7,4 +7,4 @@ class UncaptionCommand extends ImageCommand { static command = "uncaption"; } -module.exports = UncaptionCommand; \ No newline at end of file +export default UncaptionCommand; \ No newline at end of file diff --git a/commands/image-editing/unfreeze.js b/commands/image-editing/unfreeze.js index 229b59f..44a232c 100644 --- a/commands/image-editing/unfreeze.js +++ b/commands/image-editing/unfreeze.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class UnfreezeCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class UnfreezeCommand extends ImageCommand { static command = "freeze"; } -module.exports = UnfreezeCommand; \ No newline at end of file +export default UnfreezeCommand; \ No newline at end of file diff --git a/commands/image-editing/waaw.js b/commands/image-editing/waaw.js index 92ce1d4..81f0e25 100644 --- a/commands/image-editing/waaw.js +++ b/commands/image-editing/waaw.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WaaWCommand extends ImageCommand { static description = "Mirrors the right side of an image onto the left"; @@ -8,4 +8,4 @@ class WaaWCommand extends ImageCommand { static command = "mirror"; } -module.exports = WaaWCommand; \ No newline at end of file +export default WaaWCommand; \ No newline at end of file diff --git a/commands/image-editing/wall.js b/commands/image-editing/wall.js index af96c8b..e1d535c 100644 --- a/commands/image-editing/wall.js +++ b/commands/image-editing/wall.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WallCommand extends ImageCommand { static description = "Creates a wall from an image"; @@ -7,4 +7,4 @@ class WallCommand extends ImageCommand { static command = "wall"; } -module.exports = WallCommand; \ No newline at end of file +export default WallCommand; \ No newline at end of file diff --git a/commands/image-editing/wdt.js b/commands/image-editing/wdt.js index 23462f9..26b8935 100644 --- a/commands/image-editing/wdt.js +++ b/commands/image-editing/wdt.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WhoDidThisCommand extends ImageCommand { static description = "Creates a \"WHO DID THIS\" meme from an image"; @@ -8,4 +8,4 @@ class WhoDidThisCommand extends ImageCommand { static command = "wdt"; } -module.exports = WhoDidThisCommand; \ No newline at end of file +export default WhoDidThisCommand; \ No newline at end of file diff --git a/commands/image-editing/whisper.js b/commands/image-editing/whisper.js index a542f6d..a1d67d7 100644 --- a/commands/image-editing/whisper.js +++ b/commands/image-editing/whisper.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WhisperCommand extends ImageCommand { params(url) { @@ -18,4 +18,4 @@ class WhisperCommand extends ImageCommand { static command = "whisper"; } -module.exports = WhisperCommand; \ No newline at end of file +export default WhisperCommand; \ No newline at end of file diff --git a/commands/image-editing/wide.js b/commands/image-editing/wide.js index e0101ed..cb555af 100644 --- a/commands/image-editing/wide.js +++ b/commands/image-editing/wide.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WideCommand extends ImageCommand { params = { @@ -12,4 +12,4 @@ class WideCommand extends ImageCommand { static command = "resize"; } -module.exports = WideCommand; \ No newline at end of file +export default WideCommand; \ No newline at end of file diff --git a/commands/image-editing/woow.js b/commands/image-editing/woow.js index b5d0abc..04031dc 100644 --- a/commands/image-editing/woow.js +++ b/commands/image-editing/woow.js @@ -1,4 +1,4 @@ -const ImageCommand = require("../../classes/imageCommand.js"); +import ImageCommand from "../../classes/imageCommand.js"; class WooWCommand extends ImageCommand { params = { @@ -13,4 +13,4 @@ class WooWCommand extends ImageCommand { static command = "mirror"; } -module.exports = WooWCommand; \ No newline at end of file +export default WooWCommand; \ No newline at end of file diff --git a/commands/music/loop.js b/commands/music/loop.js index 451cdd2..2482d2e 100644 --- a/commands/music/loop.js +++ b/commands/music/loop.js @@ -1,5 +1,5 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { players } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class LoopCommand extends MusicCommand { async run() { @@ -11,7 +11,7 @@ class LoopCommand extends MusicCommand { if (this.connection.host !== this.message.author.id) return "Only the current voice session host can loop the music!"; const object = this.connection; object.loop = !object.loop; - soundPlayer.players.set(this.message.channel.guild.id, object); + players.set(this.message.channel.guild.id, object); return object.loop ? "🔊 The player is now looping." : "🔊 The player is no longer looping."; } @@ -19,4 +19,4 @@ class LoopCommand extends MusicCommand { static aliases = ["toggleloop", "repeat"]; } -module.exports = LoopCommand; \ No newline at end of file +export default LoopCommand; \ No newline at end of file diff --git a/commands/music/nowplaying.js b/commands/music/nowplaying.js index d143feb..b949c52 100644 --- a/commands/music/nowplaying.js +++ b/commands/music/nowplaying.js @@ -1,6 +1,6 @@ -const fetch = require("node-fetch"); -const format = require("format-duration"); -const MusicCommand = require("../../classes/musicCommand.js"); +import fetch from "node-fetch"; +import format from "format-duration"; +import MusicCommand from "../../classes/musicCommand.js"; class NowPlayingCommand extends MusicCommand { async run() { @@ -44,4 +44,4 @@ class NowPlayingCommand extends MusicCommand { static aliases = ["playing", "np"]; } -module.exports = NowPlayingCommand; \ No newline at end of file +export default NowPlayingCommand; \ No newline at end of file diff --git a/commands/music/pause.js b/commands/music/pause.js index 5e4e080..3119c27 100644 --- a/commands/music/pause.js +++ b/commands/music/pause.js @@ -1,4 +1,4 @@ -const MusicCommand = require("../../classes/musicCommand.js"); +import MusicCommand from "../../classes/musicCommand.js"; class PauseCommand extends MusicCommand { async run() { @@ -17,4 +17,4 @@ class PauseCommand extends MusicCommand { static aliases = ["resume"]; } -module.exports = PauseCommand; \ No newline at end of file +export default PauseCommand; \ No newline at end of file diff --git a/commands/music/play.js b/commands/music/play.js index 715e3f1..bbc4f8a 100644 --- a/commands/music/play.js +++ b/commands/music/play.js @@ -1,5 +1,5 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; const urlRegex = /(?:\w+:)?\/\/(\S+)/; const searchRegex = /^ytsearch:/; @@ -10,7 +10,7 @@ class PlayCommand extends MusicCommand { if (!this.args[0]) return "You need to provide what you want to play!"; const query = this.args.join(" ").trim(); const search = urlRegex.test(query) ? query : (searchRegex.test(query) ? query : `ytsearch:${query}`); - return await soundPlayer.play(this.client, encodeURIComponent(search), this.message, true); + return await play(this.client, encodeURIComponent(search), this.message, true); } static description = "Plays a song or adds it to the queue"; @@ -18,4 +18,4 @@ class PlayCommand extends MusicCommand { static arguments = ["[url]"]; } -module.exports = PlayCommand; \ No newline at end of file +export default PlayCommand; \ No newline at end of file diff --git a/commands/music/queue.js b/commands/music/queue.js index be3b07b..7e503e5 100644 --- a/commands/music/queue.js +++ b/commands/music/queue.js @@ -1,8 +1,8 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const fetch = require("node-fetch"); -const format = require("format-duration"); -const paginator = require("../../utils/pagination/pagination.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { queues } from "../../utils/soundplayer.js"; +import fetch from "node-fetch"; +import format from "format-duration"; +import paginator from "../../utils/pagination/pagination.js"; +import MusicCommand from "../../classes/musicCommand.js"; class QueueCommand extends MusicCommand { async run() { @@ -12,7 +12,7 @@ class QueueCommand extends MusicCommand { if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!"; if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!"; if (!this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; - const queue = soundPlayer.queues.get(this.message.channel.guild.id); + const queue = queues.get(this.message.channel.guild.id); const player = this.connection; const tracks = await fetch(`http://${player.player.node.host}:${player.player.node.port}/decodetracks`, { method: "POST", body: JSON.stringify(queue), headers: { Authorization: player.player.node.password, "Content-Type": "application/json" } }).then(res => res.json()); const trackList = []; @@ -58,4 +58,4 @@ class QueueCommand extends MusicCommand { static aliases = ["q"]; } -module.exports = QueueCommand; \ No newline at end of file +export default QueueCommand; \ No newline at end of file diff --git a/commands/music/skip.js b/commands/music/skip.js index a7a5859..392009d 100644 --- a/commands/music/skip.js +++ b/commands/music/skip.js @@ -1,5 +1,5 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { skipVotes } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class SkipCommand extends MusicCommand { async run() { @@ -10,7 +10,7 @@ class SkipCommand extends MusicCommand { if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!"; const player = this.connection; if (player.host !== this.message.author.id) { - const votes = soundPlayer.skipVotes.has(this.message.channel.guild.id) ? soundPlayer.skipVotes.get(this.message.channel.guild.id) : { count: 0, ids: [] }; + const votes = skipVotes.has(this.message.channel.guild.id) ? skipVotes.get(this.message.channel.guild.id) : { count: 0, ids: [] }; if (votes.ids.includes(this.message.author.id)) return "You've already voted to skip!"; const newObject = { count: votes.count + 1, @@ -18,9 +18,9 @@ class SkipCommand extends MusicCommand { }; if (votes.count + 1 === 3) { player.player.stop(this.message.channel.guild.id); - soundPlayer.skipVotes.set(this.message.channel.guild.id, { count: 0, ids: [] }); + skipVotes.set(this.message.channel.guild.id, { count: 0, ids: [] }); } else { - soundPlayer.skipVotes.set(this.message.channel.guild.id, newObject); + skipVotes.set(this.message.channel.guild.id, newObject); return `🔊 Voted to skip song (${votes.count + 1}/3 people have voted).`; } } else { @@ -32,4 +32,4 @@ class SkipCommand extends MusicCommand { static description = "Skips the current song"; } -module.exports = SkipCommand; \ No newline at end of file +export default SkipCommand; \ No newline at end of file diff --git a/commands/music/stop.js b/commands/music/stop.js index 898e816..7e7c066 100644 --- a/commands/music/stop.js +++ b/commands/music/stop.js @@ -1,5 +1,5 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { manager, players, queues } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class StopCommand extends MusicCommand { async run() { @@ -9,11 +9,11 @@ class StopCommand extends MusicCommand { if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!"; if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!"; if (this.connection.host !== this.message.author.id) return "Only the current voice session host can stop the music!"; - soundPlayer.manager.leave(this.message.channel.guild.id); + manager.leave(this.message.channel.guild.id); const connection = this.connection.player; connection.destroy(); - soundPlayer.players.delete(this.message.channel.guild.id); - soundPlayer.queues.delete(this.message.channel.guild.id); + players.delete(this.message.channel.guild.id); + queues.delete(this.message.channel.guild.id); return "🔊 The current voice channel session has ended."; } @@ -21,4 +21,4 @@ class StopCommand extends MusicCommand { static aliases = ["disconnect"]; } -module.exports = StopCommand; \ No newline at end of file +export default StopCommand; \ No newline at end of file diff --git a/commands/soundboard/boi.js b/commands/soundboard/boi.js index a27c418..3ccf123 100644 --- a/commands/soundboard/boi.js +++ b/commands/soundboard/boi.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class BoiCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/boi.ogg", this.message); + return await play(this.client, "./assets/audio/boi.ogg", this.message); } static description = "Plays the \"boi\" sound effect"; static aliases = ["boy", "neutron", "hugh"]; } -module.exports = BoiCommand; \ No newline at end of file +export default BoiCommand; \ No newline at end of file diff --git a/commands/soundboard/boom.js b/commands/soundboard/boom.js index 2c7f0bb..7a1b529 100644 --- a/commands/soundboard/boom.js +++ b/commands/soundboard/boom.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class BoomCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/boom.ogg", this.message); + return await play(this.client, "./assets/audio/boom.ogg", this.message); } static description = "Plays the Vine boom sound effect"; static aliases = ["thud", "vine"]; } -module.exports = BoomCommand; \ No newline at end of file +export default BoomCommand; \ No newline at end of file diff --git a/commands/soundboard/bruh.js b/commands/soundboard/bruh.js index c5bab56..93790de 100644 --- a/commands/soundboard/bruh.js +++ b/commands/soundboard/bruh.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class BruhCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/bruh.ogg", this.message); + return await play(this.client, "./assets/audio/bruh.ogg", this.message); } static description = "Plays the \"bruh\" sound effect"; static aliases = ["bro"]; } -module.exports = BruhCommand; \ No newline at end of file +export default BruhCommand; \ No newline at end of file diff --git a/commands/soundboard/explosion.js b/commands/soundboard/explosion.js index d15efd5..826cbe7 100644 --- a/commands/soundboard/explosion.js +++ b/commands/soundboard/explosion.js @@ -1,12 +1,12 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class ExplosionCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/explosion.ogg", this.message); + return await play(this.client, "./assets/audio/explosion.ogg", this.message); } static description = "Plays an explosion sound effect"; } -module.exports = ExplosionCommand; \ No newline at end of file +export default ExplosionCommand; \ No newline at end of file diff --git a/commands/soundboard/fakeping.js b/commands/soundboard/fakeping.js index 7b22061..2bc0a7d 100644 --- a/commands/soundboard/fakeping.js +++ b/commands/soundboard/fakeping.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class FakePingCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/ping.ogg", this.message); + return await play(this.client, "./assets/audio/ping.ogg", this.message); } static description = "Plays a Discord ping sound effect"; static aliases = ["notification", "notif"]; } -module.exports = FakePingCommand; \ No newline at end of file +export default FakePingCommand; \ No newline at end of file diff --git a/commands/soundboard/fart.js b/commands/soundboard/fart.js index a0d0fae..16217da 100644 --- a/commands/soundboard/fart.js +++ b/commands/soundboard/fart.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class FartCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/fart.ogg", this.message); + return await play(this.client, "./assets/audio/fart.ogg", this.message); } static description = "Plays a fart sound effect"; static aliases = ["toot"]; } -module.exports = FartCommand; \ No newline at end of file +export default FartCommand; \ No newline at end of file diff --git a/commands/soundboard/fbi.js b/commands/soundboard/fbi.js index 2a543f8..f7932ab 100644 --- a/commands/soundboard/fbi.js +++ b/commands/soundboard/fbi.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class FBICommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/fbi.ogg", this.message); + return await play(this.client, "./assets/audio/fbi.ogg", this.message); } static description = "Plays the \"FBI OPEN UP\" sound effect"; static aliases = ["openup"]; } -module.exports = FBICommand; \ No newline at end of file +export default FBICommand; \ No newline at end of file diff --git a/commands/soundboard/mail.js b/commands/soundboard/mail.js index ec58b7d..2a5f4a1 100644 --- a/commands/soundboard/mail.js +++ b/commands/soundboard/mail.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class MailCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/mail.ogg", this.message); + return await play(this.client, "./assets/audio/mail.ogg", this.message); } static description = "Plays the \"You've got mail\" sound effect"; static aliases = ["yougotmail", "youvegotmail", "aol"]; } -module.exports = MailCommand; \ No newline at end of file +export default MailCommand; \ No newline at end of file diff --git a/commands/soundboard/oof.js b/commands/soundboard/oof.js index 92475b8..bccd89f 100644 --- a/commands/soundboard/oof.js +++ b/commands/soundboard/oof.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class OofCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/oof.ogg", this.message); + return await play(this.client, "./assets/audio/oof.ogg", this.message); } static description = "Plays the Roblox \"oof\" sound"; static aliases = ["roblox", "commitdie"]; } -module.exports = OofCommand; \ No newline at end of file +export default OofCommand; \ No newline at end of file diff --git a/commands/soundboard/winxp.js b/commands/soundboard/winxp.js index 9ceb09a..d51320e 100644 --- a/commands/soundboard/winxp.js +++ b/commands/soundboard/winxp.js @@ -1,13 +1,13 @@ -const soundPlayer = require("../../utils/soundplayer.js"); -const MusicCommand = require("../../classes/musicCommand.js"); +import { play } from "../../utils/soundplayer.js"; +import MusicCommand from "../../classes/musicCommand.js"; class WinXPCommand extends MusicCommand { async run() { - return await soundPlayer.play(this.client, "./assets/audio/winxp.ogg", this.message); + return await play(this.client, "./assets/audio/winxp.ogg", this.message); } static description = "Plays the Windows XP startup sound"; static aliases = ["windows", "xp"]; } -module.exports = WinXPCommand; \ No newline at end of file +export default WinXPCommand; \ No newline at end of file diff --git a/commands/tags/tags.js b/commands/tags/tags.js index 005ee76..238bb84 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -1,7 +1,7 @@ -const database = require("../../utils/database.js"); -const paginator = require("../../utils/pagination/pagination.js"); -const { random } = require("../../utils/misc.js"); -const Command = require("../../classes/command.js"); +import database from "../../utils/database.js"; +import paginator from "../../utils/pagination/pagination.js"; +import { random } from "../../utils/misc.js"; +import Command from "../../classes/command.js"; class TagsCommand extends Command { // todo: find a way to split this into subcommands @@ -108,4 +108,4 @@ class TagsCommand extends Command { }; } -module.exports = TagsCommand; \ No newline at end of file +export default TagsCommand; \ No newline at end of file diff --git a/events/guildCreate.js b/events/guildCreate.js index d7b498b..ca7b411 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -1,9 +1,9 @@ -const db = require("../utils/database.js"); -const logger = require("../utils/logger.js"); +import db from "../utils/database.js"; +import { log } from "../utils/logger.js"; // run when the bot is added to a guild -module.exports = async (client, cluster, worker, ipc, guild) => { - logger.log(`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot.`); +export default async (client, cluster, worker, ipc, guild) => { + log(`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot.`); const guildDB = await db.getGuild(guild.id); if (!guildDB) await db.addGuild(guild); }; diff --git a/events/guildDelete.js b/events/guildDelete.js index 40a43f2..7d9d5b6 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -1,6 +1,6 @@ -const logger = require("../utils/logger.js"); +import { log } from "../utils/logger.js"; // run when the bot is removed from a guild -module.exports = async (client, cluster, worker, ipc, guild) => { - logger.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`); +export default async (client, cluster, worker, ipc, guild) => { + log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`); }; diff --git a/events/messageCreate.js b/events/messageCreate.js index d20209f..8c4535d 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -1,13 +1,12 @@ -const fs = require("fs"); -const fetch = require("node-fetch"); -const database = require("../utils/database.js"); -const logger = require("../utils/logger.js"); -const collections = require("../utils/collections.js"); -const parseCommand = require("../utils/parseCommand.js"); -const { clean } = require("../utils/misc.js"); +import { promises } from "fs"; +import database from "../utils/database.js"; +import { log, error as _error } from "../utils/logger.js"; +import { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from "../utils/collections.js"; +import parseCommand from "../utils/parseCommand.js"; +import { clean } from "../utils/misc.js"; // run when someone sends a message -module.exports = async (client, cluster, worker, ipc, message) => { +export default async (client, cluster, worker, ipc, message) => { // ignore other bots if (message.author.bot) return; @@ -17,7 +16,7 @@ module.exports = async (client, cluster, worker, ipc, message) => { let prefixCandidate; let guildDB; if (message.channel.guild) { - const cachedPrefix = collections.prefixCache.get(message.channel.guild.id); + const cachedPrefix = prefixCache.get(message.channel.guild.id); if (cachedPrefix) { prefixCandidate = cachedPrefix; } else { @@ -26,7 +25,7 @@ module.exports = async (client, cluster, worker, ipc, message) => { guildDB = await database.fixGuild(message.channel.guild); } prefixCandidate = guildDB.prefix; - collections.prefixCache.set(message.channel.guild.id, guildDB.prefix); + prefixCache.set(message.channel.guild.id, guildDB.prefix); } } @@ -58,35 +57,35 @@ module.exports = async (client, cluster, worker, ipc, message) => { preArgs.shift(); const command = rawContent.split(/\s+/g).shift().toLowerCase(); const parsed = parseCommand(preArgs); - const aliased = collections.aliases.get(command); + const aliased = aliases.get(command); // don't run if message is in a disabled channel if (message.channel.guild) { - const disabled = collections.disabledCache.get(message.channel.guild.id); + const disabled = disabledCache.get(message.channel.guild.id); if (disabled) { if (disabled.includes(message.channel.id) && command != "channel") return; } else { guildDB = await database.getGuild(message.channel.guild.id); - collections.disabledCache.set(message.channel.guild.id, guildDB.disabled); + disabledCache.set(message.channel.guild.id, guildDB.disabled); if (guildDB.disabled.includes(message.channel.id) && command !== "channel") return; } - const disabledCmds = collections.disabledCmdCache.get(message.channel.guild.id); + const disabledCmds = disabledCmdCache.get(message.channel.guild.id); if (disabledCmds) { if (disabledCmds.includes(aliased ? aliased : command)) return; } else { guildDB = await database.getGuild(message.channel.guild.id); - collections.disabledCmdCache.set(message.channel.guild.id, guildDB.disabled_commands ? guildDB.disabled_commands : guildDB.disabledCommands); + disabledCmdCache.set(message.channel.guild.id, guildDB.disabled_commands ? guildDB.disabled_commands : guildDB.disabledCommands); if ((guildDB.disabled_commands ? guildDB.disabled_commands : guildDB.disabledCommands).includes(aliased ? aliased : command)) return; } } // check if command exists and if it's enabled - const cmd = aliased ? collections.commands.get(aliased) : collections.commands.get(command); + const cmd = aliased ? commands.get(aliased) : commands.get(command); if (!cmd) return; // actually run the command - logger.log("log", `${message.author.username} (${message.author.id}) ran command ${command}`); + log("log", `${message.author.username} (${message.author.id}) ran command ${command}`); const reference = { messageReference: { channelID: message.channel.id, @@ -99,7 +98,7 @@ module.exports = async (client, cluster, worker, ipc, message) => { } }; try { - await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command); + await database.addCount(aliases.has(command) ? aliases.get(command) : command); const startTime = new Date(); // eslint-disable-next-line no-unused-vars const commandClass = new cmd(client, cluster, worker, ipc, message, parsed._, message.content.substring(prefix.length).trim().replace(command, "").trim(), (({ _, ...o }) => o)(parsed)); // we also provide the message content as a parameter for cases where we need more accuracy @@ -116,18 +115,8 @@ module.exports = async (client, cluster, worker, ipc, message) => { } else if (typeof result === "object" && result.file) { if (result.file.length > 8388119 && process.env.TEMPDIR !== "") { const filename = `${Math.random().toString(36).substring(2, 15)}.${result.name.split(".")[1]}`; - await fs.promises.writeFile(`${process.env.TEMPDIR}/${filename}`, result.file); + await promises.writeFile(`${process.env.TEMPDIR}/${filename}`, result.file); const imageURL = `${process.env.TMP_DOMAIN == "" ? "https://tmp.projectlounge.pw" : process.env.TMP_DOMAIN}/${filename}`; - const controller = new AbortController(); // eslint-disable-line no-undef - const timeout = setTimeout(() => { - controller.abort(); - }, 5000); - try { - await fetch(imageURL, { signal: controller.signal }); - clearTimeout(timeout); - } catch { - // this is here to make sure the image is properly cached by discord - } await client.createMessage(message.channel.id, Object.assign({ embed: { color: 16711680, @@ -161,7 +150,7 @@ module.exports = async (client, cluster, worker, ipc, message) => { content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size." }, reference)); } else { - logger.error(`Error occurred with command message ${message.cleanContent}: ${error.toString()}`); + _error(`Error occurred with command message ${message.cleanContent}: ${error.toString()}`); try { await client.createMessage(message.channel.id, Object.assign({ content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: " diff --git a/events/rawWS.js b/events/rawWS.js index 42d5001..78b4729 100644 --- a/events/rawWS.js +++ b/events/rawWS.js @@ -1,17 +1,17 @@ -const player = require("../utils/soundplayer.js"); +import { manager } from "../utils/soundplayer.js"; // run when a raw packet is sent, used for sending data to lavalink -module.exports = async (client, cluster, worker, ipc, packet) => { - if (!player.manager) return; +export default async (client, cluster, worker, ipc, packet) => { + if (!manager) return; switch (packet.t) { case "VOICE_SERVER_UPDATE": - await player.manager.voiceServerUpdate(packet.d); + await manager.voiceServerUpdate(packet.d); break; case "VOICE_STATE_UPDATE": - await player.manager.voiceStateUpdate(packet.d); + await manager.voiceStateUpdate(packet.d); break; case "GUILD_CREATE": - for (const state of packet.d.voice_states) await player.manager.voiceStateUpdate({ ...state, guild_id: packet.d.id }); + for (const state of packet.d.voice_states) await manager.voiceStateUpdate({ ...state, guild_id: packet.d.id }); break; } }; diff --git a/events/voiceChannelLeave.js b/events/voiceChannelLeave.js index 6227f81..c964b76 100644 --- a/events/voiceChannelLeave.js +++ b/events/voiceChannelLeave.js @@ -1,25 +1,25 @@ -const soundPlayer = require("../utils/soundplayer.js"); -const AwaitRejoin = require("../utils/awaitrejoin.js"); -const { random } = require("../utils/misc.js"); +import { players, manager, queues } from "../utils/soundplayer.js"; +import AwaitRejoin from "../utils/awaitrejoin.js"; +import { random } from "../utils/misc.js"; -module.exports = async (client, cluster, worker, ipc, member, oldChannel) => { +export default async (client, cluster, worker, ipc, member, oldChannel) => { if (!oldChannel) return; - const connection = soundPlayer.players.get(oldChannel.guild.id); + const connection = players.get(oldChannel.guild.id); if (connection && connection.type === "music" && oldChannel.id === connection.voiceChannel.id) { if (oldChannel.voiceMembers.filter((i) => i.id !== client.user.id).length === 0) { const waitMessage = await client.createMessage(connection.originalChannel.id, "🔊 Waiting 10 seconds for someone to return..."); const awaitRejoin = new AwaitRejoin(oldChannel, true); awaitRejoin.on("end", (rejoined, member) => { if (rejoined) { - soundPlayer.players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: member.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel }); + players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: member.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel }); waitMessage.edit(`🔊 ${member.mention} is the new voice channel host.`); } else { if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete(); connection.player.stop(connection.originalChannel.guild.id); - soundPlayer.manager.leave(connection.originalChannel.guild.id); + manager.leave(connection.originalChannel.guild.id); connection.player.destroy(); - soundPlayer.players.delete(connection.originalChannel.guild.id); - soundPlayer.queues.delete(connection.originalChannel.guild.id); + players.delete(connection.originalChannel.guild.id); + queues.delete(connection.originalChannel.guild.id); client.createMessage(connection.originalChannel.id, "🔊 The current voice channel session has ended."); } }); @@ -34,24 +34,24 @@ module.exports = async (client, cluster, worker, ipc, member, oldChannel) => { if (members.length === 0) { if (waitMessage.channel.messages.get(waitMessage.id)) waitMessage.delete(); connection.player.stop(connection.originalChannel.guild.id); - soundPlayer.manager.leave(connection.originalChannel.guild.id); + manager.leave(connection.originalChannel.guild.id); connection.player.destroy(); - soundPlayer.players.delete(connection.originalChannel.guild.id); - soundPlayer.queues.delete(connection.originalChannel.guild.id); + players.delete(connection.originalChannel.guild.id); + queues.delete(connection.originalChannel.guild.id); client.createMessage(connection.originalChannel.id, "🔊 The current voice channel session has ended."); } else { const randomMember = random(members); - soundPlayer.players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: randomMember.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel }); + players.set(connection.voiceChannel.guild.id, { player: connection.player, type: connection.type, host: randomMember.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel }); waitMessage.edit(`🔊 ${randomMember.mention} is the new voice channel host.`); } } }); } else if (member.id === client.user.id) { connection.player.stop(connection.originalChannel.guild.id); - soundPlayer.manager.leave(connection.originalChannel.guild.id); + manager.leave(connection.originalChannel.guild.id); connection.player.destroy(); - soundPlayer.players.delete(connection.originalChannel.guild.id); - soundPlayer.queues.delete(connection.originalChannel.guild.id); + players.delete(connection.originalChannel.guild.id); + queues.delete(connection.originalChannel.guild.id); await client.createMessage(connection.originalChannel.id, "🔊 The current voice channel session has ended."); } } diff --git a/events/voiceChannelSwitch.js b/events/voiceChannelSwitch.js index 0aeaa51..3b5e673 100644 --- a/events/voiceChannelSwitch.js +++ b/events/voiceChannelSwitch.js @@ -1,5 +1,5 @@ -const leaveHandler = require("./voiceChannelLeave.js"); +import leaveHandler from "./voiceChannelLeave.js"; -module.exports = async (client, cluster, worker, ipc, member, newChannel, oldChannel) => { +export default async (client, cluster, worker, ipc, member, newChannel, oldChannel) => { await leaveHandler(client, cluster, worker, ipc, member, oldChannel); }; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 35cd1f5..827b4f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,8 @@ "@babel/eslint-parser": "^7.13.8", "@babel/eslint-plugin": "^7.13.0", "@babel/plugin-proposal-class-properties": "^7.13.0", - "eslint": "^7.23.0" + "eslint": "^7.32.0", + "eslint-plugin-unicorn": "^35.0.0" }, "engines": { "node": ">=15" @@ -62,7 +63,6 @@ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", "dev": true, - "peer": true, "engines": { "node": ">=6.9.0" } @@ -72,7 +72,6 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", "dev": true, - "peer": true, "dependencies": { "@babel/code-frame": "^7.14.5", "@babel/generator": "^7.15.0", @@ -163,7 +162,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", "dev": true, - "peer": true, "dependencies": { "@babel/compat-data": "^7.15.0", "@babel/helper-validator-option": "^7.14.5", @@ -252,7 +250,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", "dev": true, - "peer": true, "dependencies": { "@babel/types": "^7.14.5" }, @@ -265,7 +262,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", "dev": true, - "peer": true, "dependencies": { "@babel/helper-module-imports": "^7.14.5", "@babel/helper-replace-supers": "^7.15.0", @@ -321,7 +317,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", "dev": true, - "peer": true, "dependencies": { "@babel/types": "^7.14.8" }, @@ -355,7 +350,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", "dev": true, - "peer": true, "engines": { "node": ">=6.9.0" } @@ -365,7 +359,6 @@ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", "dev": true, - "peer": true, "dependencies": { "@babel/template": "^7.14.5", "@babel/traverse": "^7.15.0", @@ -509,6 +502,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", @@ -543,6 +548,12 @@ "raw-body": "^2.4.1" } }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -730,17 +741,16 @@ } }, "node_modules/browserslist": { - "version": "4.16.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", - "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", + "version": "4.16.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", + "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", "dev": true, - "peer": true, "dependencies": { - "caniuse-lite": "^1.0.30001248", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.793", + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", "escalade": "^3.1.1", - "node-releases": "^1.1.73" + "node-releases": "^1.1.75" }, "bin": { "browserslist": "cli.js" @@ -819,6 +829,18 @@ "node-gyp-build": "^4.2.0" } }, + "node_modules/builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -849,7 +871,6 @@ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz", "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==", "dev": true, - "peer": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/browserslist" @@ -878,6 +899,24 @@ "node": ">=10" } }, + "node_modules/ci-info": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", + "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "dev": true + }, + "node_modules/clean-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", + "integrity": "sha1-jffHquUf02h06PjQW5GAvBGj/tc=", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -976,8 +1015,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", - "dev": true, - "peer": true + "dev": true }, "node_modules/colors": { "version": "1.4.0", @@ -1021,7 +1059,6 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, - "peer": true, "dependencies": { "safe-buffer": "~5.1.1" } @@ -1159,11 +1196,10 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.810", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.810.tgz", - "integrity": "sha512-NteznMlGtkIZCJNM2X6AVm3oMqWAdq7TjqagZhmVLPwd9mtrIq+rRxGHerjFAOFIqQJYQUMT72ncd/lVcH1cOw==", - "dev": true, - "peer": true + "version": "1.3.812", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.812.tgz", + "integrity": "sha512-7KiUHsKAWtSrjVoTSzxQ0nPLr/a+qoxNZwkwd9LkylTOgOXSVXkQbpIVT0WAUQcI5gXq3SwOTCrK+WfINHOXQg==", + "dev": true }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -1212,7 +1248,7 @@ }, "node_modules/eris-fleet": { "version": "0.3.9", - "resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#0e9784da393c1d26b28914eb02ede9dd765f8fca", + "resolved": "git+ssh://git@github.com/esmBot/eris-fleet.git#c000be0f63ebe3f6f67bc43c725687806acd3c0a", "license": "MIT", "peerDependencies": { "eris": "^0.15.0" @@ -1229,12 +1265,20 @@ "nan": "^2.14.0" } }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, - "peer": true, "engines": { "node": ">=6" } @@ -1305,6 +1349,68 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-plugin-unicorn": { + "version": "35.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-35.0.0.tgz", + "integrity": "sha512-FHsaO68tDPQILfs/mGF8eSISJp8RswR4FpUuBDnueK2wyEHC6zmsc9WxjYyldXoIsBuVmru6jQyFCbCWPoW/KQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.14.9", + "ci-info": "^3.2.0", + "clean-regexp": "^1.0.0", + "eslint-template-visitor": "^2.3.2", + "eslint-utils": "^3.0.0", + "is-builtin-module": "^3.1.0", + "lodash": "^4.17.21", + "pluralize": "^8.0.0", + "read-pkg-up": "^7.0.1", + "regexp-tree": "^0.1.23", + "safe-regex": "^2.1.1", + "semver": "^7.3.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/eslint-plugin-unicorn?sponsor=1" + }, + "peerDependencies": { + "eslint": ">=7.28.0" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-plugin-unicorn/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/eslint-rule-composer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", @@ -1327,6 +1433,22 @@ "node": ">=8.0.0" } }, + "node_modules/eslint-template-visitor": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz", + "integrity": "sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.16", + "@babel/eslint-parser": "^7.12.16", + "eslint-visitor-keys": "^2.0.0", + "esquery": "^1.3.1", + "multimap": "^1.1.0" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-utils": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", @@ -1481,6 +1603,18 @@ "node": ">=8" } }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/espree": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", @@ -1648,14 +1782,16 @@ "optional": true }, "node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, "dependencies": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/flat-cache": { @@ -1714,6 +1850,12 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -1783,7 +1925,6 @@ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, - "peer": true, "engines": { "node": ">=6.9.0" } @@ -1842,6 +1983,18 @@ "node": ">=4" } }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -1856,6 +2009,12 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, "node_modules/http-errors": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", @@ -1956,9 +2115,34 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "node_modules/is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-core-module": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/is-extglob": { "version": "2.1.1", @@ -2042,6 +2226,12 @@ "node": ">=4" } }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -2059,7 +2249,6 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", "dev": true, - "peer": true, "dependencies": { "minimist": "^1.2.5" }, @@ -2106,16 +2295,22 @@ "node": ">= 0.8.0" } }, + "node_modules/lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/lodash": { @@ -2239,6 +2434,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/multimap": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz", + "integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw==", + "dev": true + }, "node_modules/nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", @@ -2305,11 +2506,31 @@ } }, "node_modules/node-releases": { - "version": "1.1.74", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", - "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==", + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "dev": true + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, - "peer": true + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } }, "node_modules/npmlog": { "version": "4.1.2", @@ -2392,14 +2613,15 @@ } }, "node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, "dependencies": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/p-try": { @@ -2428,6 +2650,24 @@ "node": ">=6" } }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/parse-ms": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", @@ -2437,11 +2677,12 @@ } }, "node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/path-is-absolute": { @@ -2462,6 +2703,12 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "node_modules/peek-readable": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz", @@ -2555,6 +2802,15 @@ "split2": "^3.1.1" } }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", @@ -2725,6 +2981,47 @@ "node": ">=0.10.0" } }, + "node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -2772,6 +3069,15 @@ "node": ">= 6" } }, + "node_modules/regexp-tree": { + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.23.tgz", + "integrity": "sha512-+7HWfb4Bvu8Rs2eQTUIpX9I/PlQkYOuTNbRpKLJlQpSgwSkzFYh+pUj0gtvglnOZLKB6YgnIgRuJ2/IlpL48qw==", + "dev": true, + "bin": { + "regexp-tree": "bin/regexp-tree" + } + }, "node_modules/regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", @@ -2806,6 +3112,19 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2835,6 +3154,15 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safe-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", + "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", + "dev": true, + "dependencies": { + "regexp-tree": "~0.1.1" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -2958,6 +3286,11 @@ "is-arrayish": "^0.3.1" } }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + }, "node_modules/slice-ansi": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", @@ -3017,6 +3350,38 @@ "node": ">=0.10.0" } }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", + "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", + "dev": true + }, "node_modules/split2": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", @@ -3318,15 +3683,12 @@ } }, "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/unpipe": { @@ -3366,6 +3728,16 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3627,6 +3999,17 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, + "node_modules/yargs/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/yargs/node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", @@ -3635,6 +4018,37 @@ "node": ">=4" } }, + "node_modules/yargs/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yargs/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "engines": { + "node": ">=4" + } + }, "node_modules/yargs/node_modules/string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -3684,15 +4098,13 @@ "version": "7.15.0", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", - "dev": true, - "peer": true + "dev": true }, "@babel/core": { "version": "7.15.0", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", "dev": true, - "peer": true, "requires": { "@babel/code-frame": "^7.14.5", "@babel/generator": "^7.15.0", @@ -3756,7 +4168,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", "dev": true, - "peer": true, "requires": { "@babel/compat-data": "^7.15.0", "@babel/helper-validator-option": "^7.14.5", @@ -3821,7 +4232,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", "dev": true, - "peer": true, "requires": { "@babel/types": "^7.14.5" } @@ -3831,7 +4241,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", "dev": true, - "peer": true, "requires": { "@babel/helper-module-imports": "^7.14.5", "@babel/helper-replace-supers": "^7.15.0", @@ -3875,7 +4284,6 @@ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", "dev": true, - "peer": true, "requires": { "@babel/types": "^7.14.8" } @@ -3899,15 +4307,13 @@ "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", - "dev": true, - "peer": true + "dev": true }, "@babel/helpers": { "version": "7.15.3", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", "dev": true, - "peer": true, "requires": { "@babel/template": "^7.14.5", "@babel/traverse": "^7.15.0", @@ -4014,6 +4420,12 @@ "requires": { "type-fest": "^0.20.2" } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true } } }, @@ -4048,6 +4460,12 @@ "raw-body": "^2.4.1" } }, + "@types/normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", + "dev": true + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -4195,17 +4613,16 @@ } }, "browserslist": { - "version": "4.16.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", - "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", + "version": "4.16.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", + "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", "dev": true, - "peer": true, "requires": { - "caniuse-lite": "^1.0.30001248", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.793", + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", "escalade": "^3.1.1", - "node-releases": "^1.1.73" + "node-releases": "^1.1.75" } }, "buffer": { @@ -4256,6 +4673,12 @@ "node-gyp-build": "^4.2.0" } }, + "builtin-modules": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", + "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", + "dev": true + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -4276,8 +4699,7 @@ "version": "1.0.30001251", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz", "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==", - "dev": true, - "peer": true + "dev": true }, "chalk": { "version": "2.4.2", @@ -4296,6 +4718,21 @@ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "optional": true }, + "ci-info": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", + "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "dev": true + }, + "clean-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz", + "integrity": "sha1-jffHquUf02h06PjQW5GAvBGj/tc=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", @@ -4381,8 +4818,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", - "dev": true, - "peer": true + "dev": true }, "colors": { "version": "1.4.0", @@ -4425,7 +4861,6 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, - "peer": true, "requires": { "safe-buffer": "~5.1.1" } @@ -4522,11 +4957,10 @@ "integrity": "sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==" }, "electron-to-chromium": { - "version": "1.3.810", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.810.tgz", - "integrity": "sha512-NteznMlGtkIZCJNM2X6AVm3oMqWAdq7TjqagZhmVLPwd9mtrIq+rRxGHerjFAOFIqQJYQUMT72ncd/lVcH1cOw==", - "dev": true, - "peer": true + "version": "1.3.812", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.812.tgz", + "integrity": "sha512-7KiUHsKAWtSrjVoTSzxQ0nPLr/a+qoxNZwkwd9LkylTOgOXSVXkQbpIVT0WAUQcI5gXq3SwOTCrK+WfINHOXQg==", + "dev": true }, "emoji-regex": { "version": "9.2.2", @@ -4566,7 +5000,7 @@ } }, "eris-fleet": { - "version": "git+ssh://git@github.com/esmBot/eris-fleet.git#0e9784da393c1d26b28914eb02ede9dd765f8fca", + "version": "git+ssh://git@github.com/esmBot/eris-fleet.git#c000be0f63ebe3f6f67bc43c725687806acd3c0a", "from": "eris-fleet@github:esmBot/eris-fleet", "requires": {} }, @@ -4579,12 +5013,20 @@ "nan": "^2.14.0" } }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "peer": true + "dev": true }, "escape-string-regexp": { "version": "1.0.5", @@ -4721,6 +5163,52 @@ "requires": { "has-flag": "^4.0.0" } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, + "eslint-plugin-unicorn": { + "version": "35.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-35.0.0.tgz", + "integrity": "sha512-FHsaO68tDPQILfs/mGF8eSISJp8RswR4FpUuBDnueK2wyEHC6zmsc9WxjYyldXoIsBuVmru6jQyFCbCWPoW/KQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.14.9", + "ci-info": "^3.2.0", + "clean-regexp": "^1.0.0", + "eslint-template-visitor": "^2.3.2", + "eslint-utils": "^3.0.0", + "is-builtin-module": "^3.1.0", + "lodash": "^4.17.21", + "pluralize": "^8.0.0", + "read-pkg-up": "^7.0.1", + "regexp-tree": "^0.1.23", + "safe-regex": "^2.1.1", + "semver": "^7.3.5" + }, + "dependencies": { + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } } } }, @@ -4740,6 +5228,19 @@ "estraverse": "^4.1.1" } }, + "eslint-template-visitor": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz", + "integrity": "sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA==", + "dev": true, + "requires": { + "@babel/core": "^7.12.16", + "@babel/eslint-parser": "^7.12.16", + "eslint-visitor-keys": "^2.0.0", + "esquery": "^1.3.1", + "multimap": "^1.1.0" + } + }, "eslint-utils": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", @@ -4893,11 +5394,13 @@ "optional": true }, "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, "requires": { - "locate-path": "^3.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, "flat-cache": { @@ -4950,6 +5453,12 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -5008,8 +5517,7 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "peer": true + "dev": true }, "get-caller-file": { "version": "2.0.5", @@ -5050,6 +5558,15 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -5061,6 +5578,12 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, "http-errors": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", @@ -5129,9 +5652,28 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "requires": { + "builtin-modules": "^3.0.0" + } + }, + "is-core-module": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", + "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } }, "is-extglob": { "version": "2.1.1", @@ -5191,6 +5733,12 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -5208,7 +5756,6 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", "dev": true, - "peer": true, "requires": { "minimist": "^1.2.5" } @@ -5242,13 +5789,19 @@ "type-check": "~0.4.0" } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" + "p-locate": "^4.1.0" } }, "lodash": { @@ -5348,6 +5901,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "multimap": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz", + "integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw==", + "dev": true + }, "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", @@ -5405,11 +5964,30 @@ "optional": true }, "node-releases": { - "version": "1.1.74", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", - "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==", + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, - "peer": true + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } }, "npmlog": { "version": "4.1.2", @@ -5477,11 +6055,12 @@ } }, "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, "requires": { - "p-limit": "^2.0.0" + "p-limit": "^2.2.0" } }, "p-try": { @@ -5504,15 +6083,28 @@ "callsites": "^3.0.0" } }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, "parse-ms": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", "integrity": "sha1-VjRtR0nXjyNDDKDHE4UK75GqNh0=" }, "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -5526,6 +6118,12 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "peek-readable": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz", @@ -5593,6 +6191,12 @@ "split2": "^3.1.1" } }, + "pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true + }, "pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", @@ -5720,6 +6324,37 @@ } } }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + } + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -5761,6 +6396,12 @@ } } }, + "regexp-tree": { + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.23.tgz", + "integrity": "sha512-+7HWfb4Bvu8Rs2eQTUIpX9I/PlQkYOuTNbRpKLJlQpSgwSkzFYh+pUj0gtvglnOZLKB6YgnIgRuJ2/IlpL48qw==", + "dev": true + }, "regexpp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", @@ -5783,6 +6424,16 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -5803,6 +6454,15 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "safe-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", + "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", + "dev": true, + "requires": { + "regexp-tree": "~0.1.1" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -5890,6 +6550,13 @@ "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "requires": { "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + } } }, "slice-ansi": { @@ -5935,6 +6602,38 @@ "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz", + "integrity": "sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA==", + "dev": true + }, "split2": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", @@ -6180,9 +6879,9 @@ } }, "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "unpipe": { @@ -6216,6 +6915,16 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -6409,11 +7118,41 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", diff --git a/package.json b/package.json index 59eb696..8bd1b5f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "esmbot", "version": "1.6.2", "description": "A Discord bot with miscellaneous features", - "main": "app.js", + "exports": "./app.js", + "type": "module", "engines": { "node": ">=15" }, @@ -45,7 +46,8 @@ "@babel/eslint-parser": "^7.13.8", "@babel/eslint-plugin": "^7.13.0", "@babel/plugin-proposal-class-properties": "^7.13.0", - "eslint": "^7.23.0" + "eslint": "^7.32.0", + "eslint-plugin-unicorn": "^35.0.0" }, "optionalDependencies": { "better-sqlite3": "^7.4.1", diff --git a/shard.js b/shard.js index 35980ec..b6cb909 100644 --- a/shard.js +++ b/shard.js @@ -1,24 +1,24 @@ // shard base -const { BaseClusterWorker } = require("eris-fleet"); +import { BaseClusterWorker } from "eris-fleet"; // path stuff -const { readdir } = require("fs").promises; +import { readdir } from "fs/promises"; +import { readFileSync } from "fs"; // fancy loggings -const logger = require("./utils/logger.js"); +import { log, error } from "./utils/logger.js"; // initialize command loader -const handler = require("./utils/handler.js"); +import { load } from "./utils/handler.js"; // lavalink stuff -const sound = require("./utils/soundplayer.js"); +import { checkStatus, connect, status, connected } from "./utils/soundplayer.js"; // database stuff -const database = require("./utils/database.js"); +import database from "./utils/database.js"; // command collections -const collections = require("./utils/collections.js"); +import { paths } from "./utils/collections.js"; // playing messages -const { messages } = require("./messages.json"); +const { messages } = JSON.parse(readFileSync(new URL("./messages.json", import.meta.url))); // other stuff -const misc = require("./utils/misc.js"); +import { random } from "./utils/misc.js"; // generate help page -const helpGenerator = - process.env.OUTPUT !== "" ? require("./utils/help.js") : null; +import { generateList, createPage } from "./utils/help.js"; // whether a broadcast is currently in effect let broadcast = false; @@ -31,40 +31,40 @@ class Shard extends BaseClusterWorker { async init() { // register commands and their info - const soundStatus = await sound.checkStatus(); - logger.log("info", "Attempting to load commands..."); + const soundStatus = await checkStatus(); + log("info", "Attempting to load commands..."); for await (const commandFile of this.getFiles("./commands/")) { - logger.log("log", `Loading command from ${commandFile}...`); + log("log", `Loading command from ${commandFile}...`); try { - await handler.load(commandFile, soundStatus); + await load(commandFile, soundStatus); } catch (e) { - logger.error(`Failed to register command from ${commandFile}: ${e}`); + error(`Failed to register command from ${commandFile}: ${e}`); } } // register events const events = await readdir("./events/"); - logger.log("info", `Attempting to load ${events.length} events...`); + log("info", `Attempting to load ${events.length} events...`); for (const file of events) { - logger.log("log", `Loading event from ${file}...`); + log("log", `Loading event from ${file}...`); const eventName = file.split(".")[0]; - const event = require(`./events/${file}`); + const { default: event } = await import(`./events/${file}`); this.bot.on(eventName, event.bind(null, this.bot, this.clusterID, this.workerID, this.ipc)); } // generate docs - if (helpGenerator) { - await helpGenerator.generateList(); - if (this.clusterID === 0 && helpGenerator) { - await helpGenerator.createPage(process.env.OUTPUT); - logger.log("info", "The help docs have been generated."); + if (process.env.OUTPUT !== "") { + await generateList(); + if (this.clusterID === 0) { + await createPage(process.env.OUTPUT); + log("info", "The help docs have been generated."); } } this.ipc.register("reload", async (message) => { - const result = await handler.unload(message.msg); - if (result) return this.ipc.broadcast("reloadFail", { result: result }); - const result2 = await handler.load(collections.paths.get(message.msg)); + //const result = await unload(message.msg); + //if (result) return this.ipc.broadcast("reloadFail", { result: result }); + const result2 = await load(paths.get(message.msg)); if (result2) return this.ipc.broadcast("reloadFail", { result: result2 }); return this.ipc.broadcast("reloadSuccess"); }); @@ -72,9 +72,9 @@ class Shard extends BaseClusterWorker { this.bot.privateChannels.limit = 0; this.ipc.register("soundreload", async () => { - const soundStatus = await sound.checkStatus(); + const soundStatus = await checkStatus(); if (!soundStatus) { - const length = await sound.connect(this.bot); + const length = await connect(this.bot); return this.ipc.broadcast("soundReloadSuccess", { length }); } else { return this.ipc.broadcast("soundReloadFail"); @@ -91,27 +91,27 @@ class Shard extends BaseClusterWorker { this.ipc.register("broadcastend", () => { this.bot.editStatus("dnd", { - name: `${misc.random(messages)} | @${this.bot.user.username} help`, + name: `${random(messages)} | @${this.bot.user.username} help`, }); broadcast = false; return this.ipc.broadcast("broadcastEnd"); }); // connect to lavalink - if (!sound.status && !sound.connected) sound.connect(this.bot); + if (!status && !connected) connect(this.bot); database.setup(); this.activityChanger(); - logger.log("info", `Started worker ${this.workerID}.`); + log("info", `Started worker ${this.workerID}.`); } // set activity (a.k.a. the gamer code) activityChanger() { if (!broadcast) { this.bot.editStatus("dnd", { - name: `${misc.random(messages)} | @${this.bot.user.username} help`, + name: `${random(messages)} | @${this.bot.user.username} help`, }); } setTimeout(this.activityChanger.bind(this), 900000); @@ -129,17 +129,14 @@ class Shard extends BaseClusterWorker { } shutdown(done) { - logger.log("warn", "Shutting down..."); + log("warn", "Shutting down..."); this.bot.editStatus("dnd", { name: "Restarting/shutting down..." }); - for (const command in collections.commands) { - handler.unload(command); - } database.stop(); done(); } } -module.exports = Shard; +export default Shard; diff --git a/utils/awaitrejoin.js b/utils/awaitrejoin.js index ab8a2dd..ff76155 100644 --- a/utils/awaitrejoin.js +++ b/utils/awaitrejoin.js @@ -1,5 +1,5 @@ // this is a method to wait for someone to rejoin a voice channel -const { EventEmitter } = require("events"); +import { EventEmitter } from "events"; class AwaitRejoin extends EventEmitter { constructor(channel, anyone, memberID) { @@ -37,4 +37,4 @@ class AwaitRejoin extends EventEmitter { } } -module.exports = AwaitRejoin; \ No newline at end of file +export default AwaitRejoin; \ No newline at end of file diff --git a/utils/collections.js b/utils/collections.js index eb0454a..0cd93c4 100644 --- a/utils/collections.js +++ b/utils/collections.js @@ -1,7 +1,7 @@ -exports.commands = new Map(); -exports.paths = new Map(); -exports.aliases = new Map(); -exports.info = new Map(); +export const commands = new Map(); +export const paths = new Map(); +export const aliases = new Map(); +export const info = new Map(); class TimedMap extends Map { set(key, value) { @@ -12,7 +12,7 @@ class TimedMap extends Map { } } -exports.runningCommands = new TimedMap(); +export const runningCommands = new TimedMap(); /*class Cache extends Map { constructor(values) { @@ -26,6 +26,6 @@ exports.runningCommands = new TimedMap(); } }*/ -exports.prefixCache = new Map(); -exports.disabledCache = new Map(); -exports.disabledCmdCache = new Map(); \ No newline at end of file +export const prefixCache = new Map(); +export const disabledCache = new Map(); +export const disabledCmdCache = new Map(); \ No newline at end of file diff --git a/utils/convertpg.js b/utils/convertpg.js index 40b2418..9d4e266 100644 --- a/utils/convertpg.js +++ b/utils/convertpg.js @@ -1,5 +1,6 @@ -require("dotenv").config(); -const { Pool } = require("pg"); +import { config } from "dotenv"; +config(); +import { Pool } from "pg"; const pool = new Pool({ connectionString: process.env.DB }); diff --git a/utils/database.js b/utils/database.js index cb9e677..90549c9 100644 --- a/utils/database.js +++ b/utils/database.js @@ -1,3 +1,3 @@ // wrapper for the database drivers in ./database/ -module.exports = require(`./database/${process.env.DB ? process.env.DB.split("://")[0] : "dummy"}.js`); \ No newline at end of file +export default await import(`./database/${process.env.DB ? process.env.DB.split("://")[0] : "dummy"}.js`); \ No newline at end of file diff --git a/utils/database/dummy.js b/utils/database/dummy.js index 336eea2..dbe45ff 100644 --- a/utils/database/dummy.js +++ b/utils/database/dummy.js @@ -1,33 +1,32 @@ // dummy (no-op) database handler -const misc = require("../misc.js"); -const logger = require("../logger.js"); +import { warn } from "../logger.js"; -logger.warn("Using dummy database adapter. If this isn't what you wanted, check your DB variable."); +warn("Using dummy database adapter. If this isn't what you wanted, check your DB variable."); -exports.setup = async () => {}; -exports.stop = async () => {}; -exports.fixGuild = async () => {}; -exports.addCount = async () => {}; -exports.getCounts = async () => { +export async function setup() {} +export async function stop() {} +export async function fixGuild() {} +export async function addCount() {} +export async function getCounts() { return {}; -}; -exports.disableCommand = async () => {}; -exports.enableCommand = async () => {}; -exports.disableChannel = async () => {}; -exports.enableChannel = async () => {}; -exports.getTags = async () => {}; -exports.getTag = async () => {}; -exports.setTag = async () => {}; -exports.removeTag = async () => {}; -exports.editTag = async () => {}; -exports.setPrefix = async () => {}; -exports.addGuild = async (guild) => { +} +export async function disableCommand() {} +export async function enableCommand() {} +export async function disableChannel() {} +export async function enableChannel() {} +export async function getTags() {} +export async function getTag() {} +export async function setTag() {} +export async function removeTag() {} +export async function editTag() {} +export async function setPrefix() {} +export async function addGuild(guild) { return { id: guild.id, - tags: misc.tagDefaults, + tags: {}, prefix: process.env.PREFIX, disabled: [], disabled_commands: [] }; -}; -exports.getGuild = exports.addGuild; +} +export const getGuild = addGuild; diff --git a/utils/database/postgresql.js b/utils/database/postgresql.js index f95c3a4..8cee141 100644 --- a/utils/database/postgresql.js +++ b/utils/database/postgresql.js @@ -1,74 +1,74 @@ -const collections = require("../collections.js"); -const logger = require("../logger.js"); +import { prefixCache, disabledCmdCache, disabledCache, commands } from "../collections.js"; +import { error, log } from "../logger.js"; -const { Pool } = require("pg"); -const connection = new Pool({ +import Postgres from "pg"; +const connection = new Postgres.Pool({ connectionString: process.env.DB, statement_timeout: 10000 }); -exports.getGuild = async (query) => { +export async function getGuild(query) { return (await connection.query("SELECT * FROM guilds WHERE guild_id = $1", [query])).rows[0]; -}; +} -exports.setPrefix = async (prefix, guild) => { +export async function setPrefix(prefix, guild) { await connection.query("UPDATE guilds SET prefix = $1 WHERE guild_id = $2", [prefix, guild.id]); - collections.prefixCache.set(guild.id, prefix); -}; + prefixCache.set(guild.id, prefix); +} -exports.getTag = async (guild, tag) => { +export async function getTag(guild, tag) { const tagResult = (await connection.query("SELECT * FROM tags WHERE guild_id = $1 AND name = $2", [guild, tag])).rows; return tagResult[0] ? { content: tagResult[0].content, author: tagResult[0].author } : undefined; -}; +} -exports.getTags = async (guild) => { +export async function getTags(guild) { const tagArray = (await connection.query("SELECT * FROM tags WHERE guild_id = $1", [guild])).rows; const tags = {}; for (const tag of tagArray) { tags[tag.name] = { content: tag.content, author: tag.author }; } return tags; -}; +} -exports.setTag = async (name, content, guild) => { +export async function setTag(name, content, guild) { await connection.query("INSERT INTO tags (guild_id, name, content, author) VALUES ($1, $2, $3, $4)", [guild.id, name, content.content, content.author]); -}; +} -exports.editTag = async (name, content, guild) => { +export async function editTag(name, content, guild) { await connection.query("UPDATE tags SET content = $1, author = $2 WHERE guild_id = $3 AND name = $4", [content.content, content.author, guild.id, name]); -}; +} -exports.removeTag = async (name, guild) => { +export async function removeTag(name, guild) { await connection.query("DELETE FROM tags WHERE guild_id = $1 AND name = $2", [guild.id, name]); -}; +} -exports.disableCommand = async (guild, command) => { +export async function disableCommand(guild, command) { const guildDB = await this.getGuild(guild); await connection.query("UPDATE guilds SET disabled_commands = $1 WHERE guild_id = $2", [(guildDB.disabled_commands ? [...guildDB.disabled_commands, command] : [command]).filter((v) => v !== undefined), guild]); - collections.disabledCmdCache.set(guild, guildDB.disabled_commands ? [...guildDB.disabled_commands, command] : [command].filter((v) => v !== undefined)); -}; + disabledCmdCache.set(guild, guildDB.disabled_commands ? [...guildDB.disabled_commands, command] : [command].filter((v) => v !== undefined)); +} -exports.enableCommand = async (guild, command) => { +export async function enableCommand(guild, command) { const guildDB = await this.getGuild(guild); const newDisabled = guildDB.disabled_commands ? guildDB.disabled_commands.filter(item => item !== command) : []; await connection.query("UPDATE guilds SET disabled_commands = $1 WHERE guild_id = $2", [newDisabled, guild]); - collections.disabledCmdCache.set(guild, newDisabled); -}; + disabledCmdCache.set(guild, newDisabled); +} -exports.disableChannel = async (channel) => { +export async function disableChannel(channel) { const guildDB = await this.getGuild(channel.guild.id); await connection.query("UPDATE guilds SET disabled = $1 WHERE guild_id = $2", [[...guildDB.disabled, channel.id], channel.guild.id]); - collections.disabledCache.set(channel.guild.id, [...guildDB.disabled, channel.id]); -}; + disabledCache.set(channel.guild.id, [...guildDB.disabled, channel.id]); +} -exports.enableChannel = async (channel) => { +export async function enableChannel(channel) { const guildDB = await this.getGuild(channel.guild.id); const newDisabled = guildDB.disabled.filter(item => item !== channel.id); await connection.query("UPDATE guilds SET disabled = $1 WHERE guild_id = $2", [newDisabled, channel.guild.id]); - collections.disabledCache.set(channel.guild.id, newDisabled); -}; + disabledCache.set(channel.guild.id, newDisabled); +} -exports.getCounts = async () => { +export async function getCounts() { const counts = await connection.query("SELECT * FROM counts"); //const countArray = []; const countObject = {}; @@ -76,37 +76,37 @@ exports.getCounts = async () => { countObject[command] = count; } return countObject; -}; +} -exports.addCount = async (command) => { +export async function addCount(command) { let count = await connection.query("SELECT * FROM counts WHERE command = $1", [command]); if (!count.rows[0]) { await connection.query("INSERT INTO counts (command, count) VALUES ($1, $2)", [command, 0]); count = await connection.query("SELECT * FROM counts WHERE command = $1", [command]); } await connection.query("UPDATE counts SET count = $1 WHERE command = $2", [count.rows[0].count ? count.rows[0].count + 1 : 1, command]); -}; +} -exports.addGuild = async (guild) => { +export async function addGuild(guild) { const query = await this.getGuild(guild); if (query) return query; try { await connection.query("INSERT INTO guilds (guild_id, prefix, disabled, disabled_commands) VALUES ($1, $2, $3, $4)", [guild.id, process.env.PREFIX, [], []]); } catch (e) { - logger.error(`Failed to register guild ${guild.id}: ${e}`); + error(`Failed to register guild ${guild.id}: ${e}`); } return await this.getGuild(guild.id); -}; +} -exports.fixGuild = async (guild) => { +export async function fixGuild(guild) { const guildDB = await connection.query("SELECT exists(SELECT 1 FROM guilds WHERE guild_id = $1)", [guild.id]); if (!guildDB.rows[0].exists) { - logger.log(`Registering guild database entry for guild ${guild.id}...`); + log(`Registering guild database entry for guild ${guild.id}...`); return await this.addGuild(guild); } -}; +} -exports.setup = async () => { +export async function setup() { let counts; try { counts = await connection.query("SELECT * FROM counts"); @@ -115,12 +115,12 @@ exports.setup = async () => { } if (!counts.rows[0]) { - for (const command of collections.commands.keys()) { + for (const command of commands.keys()) { await connection.query("INSERT INTO counts (command, count) VALUES ($1, $2)", [command, 0]); } } else { const exists = []; - for (const command of collections.commands.keys()) { + for (const command of commands.keys()) { const count = await connection.query("SELECT * FROM counts WHERE command = $1", [command]); if (!count.rows[0]) { await connection.query("INSERT INTO counts (command, count) VALUES ($1, $2)", [command, 0]); @@ -134,8 +134,8 @@ exports.setup = async () => { } } } -}; +} -exports.stop = async () => { +export async function stop() { await connection.end(); -}; \ No newline at end of file +} \ No newline at end of file diff --git a/utils/database/sqlite.js b/utils/database/sqlite.js index ed014a2..d3f0e50 100644 --- a/utils/database/sqlite.js +++ b/utils/database/sqlite.js @@ -1,10 +1,10 @@ -const collections = require("../collections.js"); -const logger = require("../logger.js"); +import collections from "../collections.js"; +import logger from "../logger.js"; -const sqlite3 = require("better-sqlite3"); +import sqlite3 from "better-sqlite3"; const connection = sqlite3(process.env.DB.replace("sqlite://", "")); -exports.setup = async () => { +export async function setup() { let counts; try { counts = connection.prepare("SELECT * FROM counts").all(); @@ -39,13 +39,13 @@ exports.setup = async () => { } } } -}; +} -exports.stop = async () => { +export async function stop() { connection.close(); -}; +} -exports.fixGuild = async (guild) => { +export async function fixGuild(guild) { let guildDB; try { guildDB = connection.prepare("SELECT * FROM guilds WHERE guild_id = ?").get(guild.id); @@ -56,53 +56,53 @@ exports.fixGuild = async (guild) => { logger.log(`Registering guild database entry for guild ${guild.id}...`); return await this.addGuild(guild); } -}; +} -exports.addCount = async (command) => { +export async function addCount(command) { connection.prepare("UPDATE counts SET count = count + 1 WHERE command = ?").run(command); -}; +} -exports.getCounts = async () => { +export async function getCounts() { const counts = connection.prepare("SELECT * FROM counts").all(); const countObject = {}; for (const { command, count } of counts) { countObject[command] = count; } return countObject; -}; +} -exports.disableCommand = async (guild, command) => { +export async function disableCommand(guild, command) { const guildDB = await this.getGuild(guild); connection.prepare("UPDATE guilds SET disabled_commands = ? WHERE guild_id = ?").run(JSON.stringify((guildDB.disabledCommands ? [...JSON.parse(guildDB.disabledCommands), command] : [command]).filter((v) => v !== undefined)), guild); collections.disabledCmdCache.set(guild, guildDB.disabled_commands ? [...JSON.parse(guildDB.disabledCommands), command] : [command].filter((v) => v !== undefined)); -}; +} -exports.enableCommand = async (guild, command) => { +export async function enableCommand(guild, command) { const guildDB = await this.getGuild(guild); const newDisabled = guildDB.disabledCommands ? JSON.parse(guildDB.disabledCommands).filter(item => item !== command) : []; connection.prepare("UPDATE guilds SET disabled_commands = ? WHERE guild_id = ?").run(JSON.stringify(newDisabled), guild); collections.disabledCmdCache.set(guild, newDisabled); -}; +} -exports.disableChannel = async (channel) => { +export async function disableChannel(channel) { const guildDB = await this.getGuild(channel.guild.id); connection.prepare("UPDATE guilds SET disabled = ? WHERE guild_id = ?").run(JSON.stringify([...JSON.parse(guildDB.disabled), channel.id]), channel.guild.id); collections.disabledCache.set(channel.guild.id, [...JSON.parse(guildDB.disabled), channel.id]); -}; +} -exports.enableChannel = async (channel) => { +export async function enableChannel(channel) { const guildDB = await this.getGuild(channel.guild.id); const newDisabled = JSON.parse(guildDB.disabled).filter(item => item !== channel.id); connection.prepare("UPDATE guilds SET disabled = ? WHERE guild_id = ?").run(JSON.stringify(newDisabled), channel.guild.id); collections.disabledCache.set(channel.guild.id, newDisabled); -}; +} -exports.getTag = async (guild, tag) => { +export async function getTag(guild, tag) { const tagResult = connection.prepare("SELECT * FROM tags WHERE guild_id = ? AND name = ?").get(guild, tag); return tagResult ? { content: tagResult.content, author: tagResult.author } : undefined; -}; +} -exports.getTags = async (guild) => { +export async function getTags(guild) { const tagArray = connection.prepare("SELECT * FROM tags WHERE guild_id = ?").all(guild); const tags = {}; if (!tagArray) return []; @@ -110,9 +110,9 @@ exports.getTags = async (guild) => { tags[tag.name] = { content: tag.content, author: tag.author }; } return tags; -}; +} -exports.setTag = async (name, content, guild) => { +export async function setTag(name, content, guild) { const tag = { id: guild.id, name: name, @@ -120,22 +120,22 @@ exports.setTag = async (name, content, guild) => { author: content.author }; connection.prepare("INSERT INTO tags (guild_id, name, content, author) VALUES (@id, @name, @content, @author)").run(tag); -}; +} -exports.removeTag = async (name, guild) => { +export async function removeTag(name, guild) { connection.prepare("DELETE FROM tags WHERE guild_id = ? AND name = ?").run(guild.id, name); -}; +} -exports.editTag = async (name, content, guild) => { +export async function editTag(name, content, guild) { connection.prepare("UPDATE tags SET content = ?, author = ? WHERE guild_id = ? AND name = ?").run(content.content, content.author, guild.id, name); -}; +} -exports.setPrefix = async (prefix, guild) => { +export async function setPrefix(prefix, guild) { connection.prepare("UPDATE guilds SET prefix = ? WHERE guild_id = ?").run(prefix, guild.id); collections.prefixCache.set(guild.id, prefix); -}; +} -exports.addGuild = async (guild) => { +export async function addGuild(guild) { const query = await this.getGuild(guild); if (query) return query; const guildObject = { @@ -146,12 +146,12 @@ exports.addGuild = async (guild) => { }; connection.prepare("INSERT INTO guilds (guild_id, prefix, disabled, disabled_commands) VALUES (@id, @prefix, @disabled, @disabledCommands)").run(guildObject); return guildObject; -}; +} -exports.getGuild = async (query) => { +export async function getGuild(query) { try { return connection.prepare("SELECT * FROM guilds WHERE guild_id = ?").get(query); } catch { return; } -}; +} diff --git a/utils/handler.js b/utils/handler.js index fa1e54e..1aae134 100644 --- a/utils/handler.js +++ b/utils/handler.js @@ -1,18 +1,36 @@ -const collections = require("./collections.js"); -const logger = require("./logger.js"); +import { paths, commands, info, aliases as _aliases } from "./collections.js"; +import { log } from "./logger.js"; +//import { Worker, isMainThread, workerData, parentPort } from "worker_threads"; +//import { join, dirname } from "path"; +//import { fileURLToPath } from "url"; + +/*const importNoCache = (module) => { + return new Promise((resolve, reject) => { + const worker = new Worker(new URL("./handler.js", import.meta.url), { + workerData: { module: module } + }); + worker.once("message", (result) => { + resolve(result); + }); + worker.once("error", (result) => { + reject(result); + }); + }); +};*/ // load command into memory -exports.load = async (command, soundStatus) => { - const props = require(`../${command}`); - if (props.requires.includes("mashape") && process.env.MASHAPE === "") return logger.log("warn", `Mashape/RapidAPI info not provided in config, skipped loading command ${command}...`); - if (props.requires.includes("sound") && soundStatus) return logger.log("warn", `Failed to connect to some Lavalink nodes, skipped loading command ${command}...`); +export async function load(command, soundStatus) { + //const props = await importNoCache(`../${command}`); + const { default: props } = await import(`../${command}`); + if (props.requires.includes("mashape") && process.env.MASHAPE === "") return log("warn", `Mashape/RapidAPI info not provided in config, skipped loading command ${command}...`); + if (props.requires.includes("sound") && soundStatus) return log("warn", `Failed to connect to some Lavalink nodes, skipped loading command ${command}...`); const commandArray = command.split("/"); const commandName = commandArray[commandArray.length - 1].split(".")[0]; - collections.paths.set(commandName, command); - collections.commands.set(commandName, props); + paths.set(commandName, command); + commands.set(commandName, props); - collections.info.set(commandName, { + info.set(commandName, { category: commandArray[2], description: props.description, aliases: props.aliases, @@ -22,23 +40,23 @@ exports.load = async (command, soundStatus) => { if (props.aliases) { for (const alias of props.aliases) { - collections.aliases.set(alias, commandName); - collections.paths.set(alias, command); + _aliases.set(alias, commandName); + paths.set(alias, command); } } return false; -}; +} // unload command from memory -exports.unload = async (command) => { +/*export async function unload(command) { let cmd; - if (collections.commands.has(command)) { - cmd = collections.commands.get(command); - } else if (collections.aliases.has(command)) { - cmd = collections.commands.get(collections.aliases.get(command)); + if (commands.has(command)) { + cmd = commands.get(command); + } else if (_aliases.has(command)) { + cmd = commands.get(_aliases.get(command)); } if (!cmd) return `The command \`${command}\` doesn't seem to exist, nor is it an alias.`; - const path = collections.paths.get(command); + const path = paths.get(command); const mod = require.cache[require.resolve(`../${path}`)]; delete require.cache[require.resolve(`../${path}`)]; for (let i = 0; i < module.children.length; i++) { @@ -48,4 +66,15 @@ exports.unload = async (command) => { } } return false; -}; +}*/ + +/*if (!isMainThread) { + const getModule = async () => { + console.log("test"); + const module = await import(workerData.module); + console.log("test 2"); + parentPort.postMessage(module); + process.exit(); + }; + getModule(); +}*/ \ No newline at end of file diff --git a/utils/help.js b/utils/help.js index 9cd6dea..01edb67 100644 --- a/utils/help.js +++ b/utils/help.js @@ -1,32 +1,32 @@ -const collections = require("./collections.js"); -const fs = require("fs"); +import { commands, info } from "./collections.js"; +import { promises } from "fs"; const categoryTemplate = { general: [], tags: ["> **Every command in this category is a subcommand of the tag command.**\n"], "image-editing": ["> **These commands support the PNG, JPEG, WEBP (static), and GIF (animated or static) formats.**\n"] }; -exports.categories = categoryTemplate; +export let categories = categoryTemplate; -exports.generateList = async () => { - this.categories = categoryTemplate; - for (const [command] of collections.commands) { - const category = collections.info.get(command).category; - const description = collections.info.get(command).description; - const params = collections.info.get(command).params; +export async function generateList() { + categories = categoryTemplate; + for (const [command] of commands) { + const category = info.get(command).category; + const description = info.get(command).description; + const params = info.get(command).params; if (category === "tags") { const subCommands = [...Object.keys(description)]; for (const subCommand of subCommands) { - this.categories.tags.push(`**tags${subCommand !== "default" ? ` ${subCommand}` : ""}**${params[subCommand] ? ` ${params[subCommand]}` : ""} - ${description[subCommand]}`); + categories.tags.push(`**tags${subCommand !== "default" ? ` ${subCommand}` : ""}**${params[subCommand] ? ` ${params[subCommand]}` : ""} - ${description[subCommand]}`); } } else { - if (!this.categories[category]) this.categories[category] = []; - this.categories[category].push(`**${command}**${params ? ` ${params}` : ""} - ${description}`); + if (!categories[category]) categories[category] = []; + categories[category].push(`**${command}**${params ? ` ${params}` : ""} - ${description}`); } } -}; +} -exports.createPage = async (output) => { +export async function createPage(output) { let template = `# esmBot${process.env.NODE_ENV === "development" ? " Dev" : ""} Command List This page was last generated on \`${new Date().toString()}\`. @@ -41,7 +41,7 @@ Default prefix is \`&\`. `; template += "\n## Table of Contents\n"; - for (const category of Object.keys(this.categories)) { + for (const category of Object.keys(categories)) { const categoryStringArray = category.split("-"); for (const index of categoryStringArray.keys()) { categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1); @@ -50,13 +50,13 @@ Default prefix is \`&\`. } // hell - for (const category of Object.keys(this.categories)) { + for (const category of Object.keys(categories)) { const categoryStringArray = category.split("-"); for (const index of categoryStringArray.keys()) { categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1); } template += `\n## ${categoryStringArray.join(" ")}\n`; - for (const command of this.categories[category]) { + for (const command of categories[category]) { if (command.startsWith(">")) { template += `${command}\n`; } else { @@ -65,5 +65,5 @@ Default prefix is \`&\`. } } - await fs.promises.writeFile(output, template); -}; \ No newline at end of file + await promises.writeFile(output, template); +} \ No newline at end of file diff --git a/utils/image-runner.js b/utils/image-runner.js index c6d4c95..c46208c 100644 --- a/utils/image-runner.js +++ b/utils/image-runner.js @@ -1,8 +1,12 @@ -const magick = require(`../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`); -const { isMainThread, parentPort, workerData } = require("worker_threads"); -const fetch = require("node-fetch"); +import { createRequire } from "module"; +import { isMainThread, parentPort, workerData } from "worker_threads"; +import fetch from "node-fetch"; -exports.run = object => { +const nodeRequire = createRequire(import.meta.url); + +const magick = nodeRequire(`../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`); + +function run(object) { return new Promise((resolve, reject) => { // If the image has a path, it must also have a type let promise = new Promise((resolveTest) => { resolveTest(); }); // no-op @@ -32,10 +36,10 @@ exports.run = object => { } }); }); -}; +} if (!isMainThread) { - this.run(workerData) + run(workerData) .then(returnObject => { parentPort.postMessage(returnObject); process.exit(); diff --git a/utils/image.js b/utils/image.js index 593b11c..828d126 100644 --- a/utils/image.js +++ b/utils/image.js @@ -1,16 +1,16 @@ -const fetch = require("node-fetch"); -const fs = require("fs"); -const fileType = require("file-type"); +import fetch from "node-fetch"; +import fs from "fs"; +import fileType from "file-type"; const formats = ["image/jpeg", "image/png", "image/webp", "image/gif", "video/mp4", "video/webm", "video/mov"]; -exports.jobs = {}; +export const jobs = {}; -exports.connections = new Map(); +export const connections = new Map(); -exports.servers = JSON.parse(fs.readFileSync("./servers.json", { encoding: "utf8" })).image; +export const servers = JSON.parse(fs.readFileSync("./servers.json", { encoding: "utf8" })).image; -exports.getType = async (image, extraReturnTypes) => { +export async function getType(image, extraReturnTypes) { if (!image.startsWith("http")) { const imageType = await fileType.fromFile(image); if (imageType && formats.includes(imageType.mime)) { @@ -50,4 +50,4 @@ exports.getType = async (image, extraReturnTypes) => { clearTimeout(timeout); } return type; -}; +} diff --git a/utils/imagedetect.js b/utils/imagedetect.js index 08599f9..55d5d3a 100644 --- a/utils/imagedetect.js +++ b/utils/imagedetect.js @@ -1,6 +1,8 @@ -const fetch = require("node-fetch"); -const { getType } = require("./image.js"); -const execPromise = require("util").promisify(require("child_process").exec); +import fetch from "node-fetch"; +import { getType } from "./image.js"; +import { exec } from "child_process"; +import { promisify } from "util"; +const execPromise = promisify(exec); const tenorURLs = [ "tenor.com", @@ -119,7 +121,7 @@ const checkImages = async (message, extraReturnTypes, video) => { }; // this checks for the latest message containing an image and returns the url of the image -module.exports = async (client, cmdMessage, extraReturnTypes = false, video = false) => { +export default async (client, cmdMessage, extraReturnTypes = false, video = false) => { // we start by checking if the message is a reply to another message if (cmdMessage.messageReference) { const replyMessage = await client.getMessage(cmdMessage.messageReference.channelID, cmdMessage.messageReference.messageID).catch(() => undefined); diff --git a/utils/logger.js b/utils/logger.js index 6e5c799..20e1bdb 100644 --- a/utils/logger.js +++ b/utils/logger.js @@ -1,7 +1,7 @@ -exports.log = (type, content) => content ? process.send({ op: type, msg: content }) : process.send({ op: "info", msg: type }); +export function log(type, content) { return content ? process.send({ op: type, msg: content }) : process.send({ op: "info", msg: type }); } -exports.error = (...args) => this.log("error", ...args); +export function error(...args) { return log("error", ...args); } -exports.warn = (...args) => this.log("warn", ...args); +export function warn(...args) { return log("warn", ...args); } -exports.debug = (...args) => this.log("debug", ...args); +export function debug(...args) { return log("debug", ...args); } diff --git a/utils/misc.js b/utils/misc.js index b58951c..c110d40 100644 --- a/utils/misc.js +++ b/utils/misc.js @@ -1,18 +1,19 @@ -const util = require("util"); -const fs = require("fs"); +import util from "util"; +import fs from "fs"; +import { config } from "dotenv"; // random(array) to select a random entry in array -exports.random = (array) => { +export function random(array) { if (!array || array.length < 1) return null; return array[Math.floor(Math.random() * array.length)]; -}; +} const optionalReplace = (token) => { return token === undefined || token === "" ? "" : (token === "true" || token === "false" ? token : ""); }; // clean(text) to clean message of any private info or mentions -exports.clean = async (text) => { +export async function clean(text) { if (text && text.constructor && text.constructor.name == "Promise") text = await text; if (typeof text !== "string") @@ -22,7 +23,7 @@ exports.clean = async (text) => { .replaceAll("`", `\`${String.fromCharCode(8203)}`) .replaceAll("@", `@${String.fromCharCode(8203)}`); - const { parsed } = require("dotenv").config(); + const { parsed } = config(); const imageServers = JSON.parse(fs.readFileSync("./servers.json", { encoding: "utf8" })).image; for (const { server, auth } of imageServers) { @@ -35,15 +36,15 @@ exports.clean = async (text) => { } return text; -}; +} // regexEscape(string) to escape characters in a string for use in a regex -exports.regexEscape = (string) => { +export function regexEscape(string) { return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string -}; +} // decodeEntities(string) -exports.decodeEntities = (string) => { +export function decodeEntities(string) { var translate_re = /&(nbsp|amp|quot|lt|gt);/g; var translate = { "nbsp": " ", @@ -58,15 +59,4 @@ exports.decodeEntities = (string) => { var num = parseInt(numStr, 10); return String.fromCharCode(num); }); -}; - -// define defaults for prefixes and tags -exports.defaults = { - prefix: process.env.PREFIX -}; -exports.tagDefaults = { - help: { - content: "https://projectlounge.pw/esmBot/help.html", - author: "198198681982205953" - } -}; +} diff --git a/utils/pagination/awaitinteractions.js b/utils/pagination/awaitinteractions.js index cc80918..1fb1c28 100644 --- a/utils/pagination/awaitinteractions.js +++ b/utils/pagination/awaitinteractions.js @@ -1,5 +1,5 @@ // eris doesn't come with a method to wait for interactions by default, so we make our own -const EventEmitter = require("events").EventEmitter; +import { EventEmitter } from "events"; class InteractionCollector extends EventEmitter { constructor(client, message, options = {}) { @@ -30,4 +30,4 @@ class InteractionCollector extends EventEmitter { } } -module.exports = InteractionCollector; +export default InteractionCollector; diff --git a/utils/pagination/awaitmessages.js b/utils/pagination/awaitmessages.js index 0c0a44e..7cb3294 100644 --- a/utils/pagination/awaitmessages.js +++ b/utils/pagination/awaitmessages.js @@ -1,5 +1,5 @@ // eris doesn't come with an awaitMessages method by default, so we make our own -const EventEmitter = require("events").EventEmitter; +import { EventEmitter } from "events"; class MessageCollector extends EventEmitter { constructor(client, channel, filter, options = {}) { @@ -34,4 +34,4 @@ class MessageCollector extends EventEmitter { } } -module.exports = MessageCollector; +export default MessageCollector; diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index 1420370..77b027e 100644 --- a/utils/pagination/pagination.js +++ b/utils/pagination/pagination.js @@ -1,8 +1,8 @@ -const MessageCollector = require("./awaitmessages.js"); -const InteractionCollector = require("./awaitinteractions.js"); -const fetch = require("node-fetch"); +import MessageCollector from "./awaitmessages.js"; +import InteractionCollector from "./awaitinteractions.js"; +import fetch from "node-fetch"; -module.exports = async (client, message, pages, timeout = 120000) => { +export default async (client, message, pages, timeout = 120000) => { const manageMessages = message.channel.guild && message.channel.permissionsOf(client.user.id).has("manageMessages") ? true : false; const options = { messageReference: { diff --git a/utils/parseCommand.js b/utils/parseCommand.js index 5ccec84..f9b5291 100644 --- a/utils/parseCommand.js +++ b/utils/parseCommand.js @@ -1,4 +1,4 @@ -module.exports = (input) => { +export default (input) => { if (typeof input === "string") input = input.split(/\s+/g); const args = { _: [] }; let curr = null; @@ -61,7 +61,7 @@ module.exports = (input) => { // Format: // [{name: "verbose", type: "bool"}, {name: "username", type: "string"}] // */ -// module.exports = (input, format) => { +// export default (input, format) => { // let results = {}; // let text = input.split(' ').slice(1).join(' '); // format.forEach(element => { diff --git a/utils/services/image.js b/utils/services/image.js index 28f198c..2ab5a23 100644 --- a/utils/services/image.js +++ b/utils/services/image.js @@ -1,11 +1,12 @@ -const { BaseServiceWorker } = require("eris-fleet"); -const logger = require("../logger.js"); -const fetch = require("node-fetch"); -const WebSocket = require("ws"); -const fs = require("fs"); -const path = require("path"); -const { Worker } = require("worker_threads"); -const { EventEmitter } = require("events"); +import { BaseServiceWorker } from "eris-fleet"; +import * as logger from "../logger.js"; +import fetch from "node-fetch"; +import WebSocket from "ws"; +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; +import { Worker } from "worker_threads"; +import { EventEmitter } from "events"; class ImageWorker extends BaseServiceWorker { constructor(setup) { @@ -255,7 +256,7 @@ class ImageWorker extends BaseServiceWorker { }).catch(err => reject(err)); } else { // Called from command (not using image API) - const worker = new Worker(path.join(__dirname, "../image-runner.js"), { + const worker = new Worker(path.join(path.dirname(fileURLToPath(import.meta.url)), "../image-runner.js"), { workerData: object }); worker.once("message", (data) => { @@ -300,4 +301,4 @@ class ImageWorker extends BaseServiceWorker { } } -module.exports = ImageWorker; +export default ImageWorker; diff --git a/utils/services/prometheus.js b/utils/services/prometheus.js index 3c1fb85..8ff2824 100644 --- a/utils/services/prometheus.js +++ b/utils/services/prometheus.js @@ -1,14 +1,14 @@ -const { BaseServiceWorker } = require("eris-fleet"); -const http = require("http"); -const logger = require("../logger.js"); -const database = require("../database.js"); +import { BaseServiceWorker } from "eris-fleet"; +import { createServer } from "http"; +import { log } from "../logger.js"; +import database from "../database.js"; class PrometheusWorker extends BaseServiceWorker { constructor(setup) { super(setup); if (process.env.METRICS !== "" && process.env.METRICS !== undefined) { - this.httpServer = http.createServer(async (req, res) => { + this.httpServer = createServer(async (req, res) => { if (req.method !== "GET") { res.statusCode = 405; return res.end("GET only"); @@ -46,7 +46,7 @@ esmbot_connected_workers ${servers.length} res.end(); }); this.httpServer.listen(process.env.METRICS, () => { - logger.log("info", `Serving metrics at ${process.env.METRICS}`); + log("info", `Serving metrics at ${process.env.METRICS}`); }); } @@ -59,4 +59,4 @@ esmbot_connected_workers ${servers.length} } } -module.exports = PrometheusWorker; +export default PrometheusWorker; diff --git a/utils/soundplayer.js b/utils/soundplayer.js index 1f68d7e..4a1a76f 100644 --- a/utils/soundplayer.js +++ b/utils/soundplayer.js @@ -1,20 +1,20 @@ -const logger = require("./logger.js"); -const fetch = require("node-fetch"); -const fs = require("fs"); -const format = require("format-duration"); -const { Manager } = require("lavacord"); +import * as logger from "./logger.js"; +import fetch from "node-fetch"; +import fs from "fs"; +import format from "format-duration"; +import { Manager } from "lavacord"; let nodes; -exports.players = new Map(); -exports.queues = new Map(); -exports.skipVotes = new Map(); +export const players = new Map(); +export const queues = new Map(); +export const skipVotes = new Map(); -exports.manager; -exports.status = false; -exports.connected = false; +export let manager; +export let status = false; +export let connected = false; -exports.checkStatus = async () => { +export async function checkStatus() { const json = await fs.promises.readFile("./servers.json", { encoding: "utf8" }); nodes = JSON.parse(json).lava; const newNodes = []; @@ -27,12 +27,12 @@ exports.checkStatus = async () => { } } nodes = newNodes; - this.status = newNodes.length === 0 ? true : false; - return this.status; -}; + status = newNodes.length === 0 ? true : false; + return status; +} -exports.connect = async (client) => { - this.manager = new Manager(nodes, { +export async function connect(client) { + manager = new Manager(nodes, { user: client.user.id, shards: client.shards.size || 1, send: (packet) => { @@ -41,39 +41,39 @@ exports.connect = async (client) => { return guild.shard.sendWS(packet.op, packet.d); } }); - const { length } = await this.manager.connect(); + const { length } = await manager.connect(); logger.log(`Successfully connected to ${length} Lavalink node(s).`); - exports.connected = true; - this.manager.on("error", (error, node) => { + connected = true; + manager.on("error", (error, node) => { logger.error(`An error occurred on Lavalink node ${node}: ${error}`); }); return length; -}; +} -exports.play = async (client, sound, message, music = false) => { - if (!this.manager) return "The sound commands are still starting up!"; +export async function play(client, sound, message, music = false) { + if (!manager) return "The sound commands are still starting up!"; if (!message.channel.guild) return "This command only works in servers!"; if (!message.member.voiceState.channelID) return "You need to be in a voice channel first!"; if (!message.channel.permissionsOf(client.user.id).has("voiceConnect")) return "I can't join this voice channel!"; const voiceChannel = message.channel.guild.channels.get(message.member.voiceState.channelID); if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return "I don't have permission to join this voice channel!"; - const player = this.players.get(message.channel.guild.id); - if (!music && this.manager.voiceStates.has(message.channel.guild.id) && (player && player.type === "music")) return "I can't play a sound effect while playing music!"; - const node = this.manager.idealNodes[0]; + const player = players.get(message.channel.guild.id); + if (!music && manager.voiceStates.has(message.channel.guild.id) && (player && player.type === "music")) return "I can't play a sound effect while playing music!"; + const node = manager.idealNodes[0]; if (!music && !nodes.filter(obj => obj.host === node.host)[0].local) { sound = sound.replace(/\.\//, "https://raw.githubusercontent.com/esmBot/esmBot/master/"); } const { tracks } = await fetch(`http://${node.host}:${node.port}/loadtracks?identifier=${sound}`, { headers: { Authorization: node.password } }).then(res => res.json()); - const oldQueue = this.queues.get(voiceChannel.guild.id); + const oldQueue = queues.get(voiceChannel.guild.id); if (!tracks || tracks.length === 0) return "I couldn't find that song!"; if (music) { - this.queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, tracks[0].track] : [tracks[0].track]); + queues.set(voiceChannel.guild.id, oldQueue ? [...oldQueue, tracks[0].track] : [tracks[0].track]); } let connection; if (player) { connection = player.player; } else { - connection = await this.manager.join({ + connection = await manager.join({ guild: voiceChannel.guild.id, channel: voiceChannel.id, node: node.id @@ -83,17 +83,17 @@ exports.play = async (client, sound, message, music = false) => { if (oldQueue && music) { return `Your tune \`${tracks[0].info.title}\` has been added to the queue!`; } else { - this.nextSong(client, message, connection, tracks[0].track, tracks[0].info, music, voiceChannel, player ? player.loop : false); + nextSong(client, message, connection, tracks[0].track, tracks[0].info, music, voiceChannel, player ? player.loop : false); return; } -}; +} -exports.nextSong = async (client, message, connection, track, info, music, voiceChannel, loop = false, inQueue = false, lastTrack = null) => { - this.skipVotes.set(voiceChannel.guild.id, { count: 0, ids: [] }); +export async function nextSong(client, message, connection, track, info, music, voiceChannel, loop = false, inQueue = false, lastTrack = null) { + skipVotes.set(voiceChannel.guild.id, { count: 0, ids: [] }); const parts = Math.floor((0 / info.length) * 10); let playingMessage; - if (!music && this.players.get(voiceChannel.guild.id)) { - const playMessage = this.players.get(voiceChannel.guild.id).playMessage; + if (!music && players.get(voiceChannel.guild.id)) { + const playMessage = players.get(voiceChannel.guild.id).playMessage; try { playMessage.delete(); } catch { @@ -101,7 +101,7 @@ exports.nextSong = async (client, message, connection, track, info, music, voice } } if (lastTrack === track) { - playingMessage = this.players.get(voiceChannel.guild.id).playMessage; + playingMessage = players.get(voiceChannel.guild.id).playMessage; } else { playingMessage = await client.createMessage(message.channel.id, !music ? "🔊 Playing sound..." : { "embed": { @@ -130,24 +130,24 @@ exports.nextSong = async (client, message, connection, track, info, music, voice }); } await connection.play(track); - this.players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: message.author.id, voiceChannel: voiceChannel, originalChannel: message.channel, loop: loop, playMessage: playingMessage }); + players.set(voiceChannel.guild.id, { player: connection, type: music ? "music" : "sound", host: message.author.id, voiceChannel: voiceChannel, originalChannel: message.channel, loop: loop, playMessage: playingMessage }); if (inQueue && connection.listeners("error").length === 0) { connection.on("error", (error) => { if (playingMessage.channel.messages.get(playingMessage.id)) playingMessage.delete(); - const playMessage = this.players.get(voiceChannel.guild.id).playMessage; + const playMessage = players.get(voiceChannel.guild.id).playMessage; if (playMessage.channel.messages.get(playMessage.id)) playMessage.delete(); - this.manager.leave(voiceChannel.guild.id); + manager.leave(voiceChannel.guild.id); connection.destroy(); - this.players.delete(voiceChannel.guild.id); - this.queues.delete(voiceChannel.guild.id); + players.delete(voiceChannel.guild.id); + queues.delete(voiceChannel.guild.id); logger.error(error); }); } if (connection.listeners("end").length === 0) { connection.on("end", async (data) => { if (data.reason === "REPLACED") return; - const queue = this.queues.get(voiceChannel.guild.id); - const player = this.players.get(voiceChannel.guild.id); + const queue = queues.get(voiceChannel.guild.id); + const player = players.get(voiceChannel.guild.id); let newQueue; if (player.loop) { queue.push(queue.shift()); @@ -155,12 +155,12 @@ exports.nextSong = async (client, message, connection, track, info, music, voice } else { newQueue = queue ? queue.slice(1) : []; } - this.queues.set(voiceChannel.guild.id, newQueue); + queues.set(voiceChannel.guild.id, newQueue); if (newQueue.length === 0) { - this.manager.leave(voiceChannel.guild.id); + manager.leave(voiceChannel.guild.id); connection.destroy(); - this.players.delete(voiceChannel.guild.id); - this.queues.delete(voiceChannel.guild.id); + players.delete(voiceChannel.guild.id); + queues.delete(voiceChannel.guild.id); if (music) await client.createMessage(message.channel.id, "🔊 The current voice channel session has ended."); try { if (playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); @@ -170,7 +170,7 @@ exports.nextSong = async (client, message, connection, track, info, music, voice } } else { const newTrack = await fetch(`http://${connection.node.host}:${connection.node.port}/decodetrack?track=${encodeURIComponent(newQueue[0])}`, { headers: { Authorization: connection.node.password } }).then(res => res.json()); - this.nextSong(client, message, connection, newQueue[0], newTrack, music, voiceChannel, player.loop, true, track); + nextSong(client, message, connection, newQueue[0], newTrack, music, voiceChannel, player.loop, true, track); try { if (newQueue[0] !== track && playingMessage.channel.messages.get(playingMessage.id)) await playingMessage.delete(); if (newQueue[0] !== track && player.playMessage.channel.messages.get(player.playMessage.id)) await player.playMessage.delete(); @@ -180,4 +180,4 @@ exports.nextSong = async (client, message, connection, track, info, music, voice } }); } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/utils/urlcheck.js b/utils/urlcheck.js index 74fd4fa..10aef72 100644 --- a/utils/urlcheck.js +++ b/utils/urlcheck.js @@ -1,4 +1,4 @@ -module.exports = (string) => { +export default (string) => { const protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/; const domainRE = /^[^\s.]+\.\S{2,}$/; const match = string.match(protocolAndDomainRE); diff --git a/utils/wrap.js b/utils/wrap.js index 94aeb6c..a0f4485 100644 --- a/utils/wrap.js +++ b/utils/wrap.js @@ -1,4 +1,4 @@ -module.exports = (str) => { +export default (str) => { var regexString = ".{1,15}([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)"; var re = new RegExp(regexString, "g"); var lines = str.match(re) || [];