diff --git a/.gitignore b/.gitignore index d81631d1..2b86767f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,3 @@ Thumbs.db # Node node_modules - -# Dashboard DB -/json.sqlite diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f1ab3994..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "dashboard/dashboard-core"] - path = dashboard/dashboard-core - url = https://git.jonnybro.ru/jonny_bro/dashboard-core - branch = main diff --git a/.prettierrc b/.prettierrc index 219e598f..1fdeabad 100644 --- a/.prettierrc +++ b/.prettierrc @@ -8,4 +8,4 @@ "trailingComma": "all", "useTabs": true, "parser": "babel" -} \ No newline at end of file +} diff --git a/README.md b/README.md index 86ba4dc0..5ca6aa94 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ JaBa offers: * Slash and Context commands. * Supports commands in DMs. * Localization support (any language; English, Russian and Ukrainian for now). -* Dashboard for changing various settings. * Basic messages monitoring (updating and deletion). ## Commands @@ -29,10 +28,6 @@ JaBa does many thing, here is **8 main categories**: * **General**: `afk`, `avatar`, `boosters`, `minecraft`, `remindme`, `shorturl`, `serverinfo`, `userinfo`, `whois` and **7** more! * **Bot's owner commands**: `eval`, `servers`, `reload` and **2** more! -## *Kinda* Cool Dashboard - -JaBa has it's own dashboard to change server's settings! - ## Get The Bot ### Ready To Use @@ -53,7 +48,6 @@ Use [this instruction](https://github.com/JonnyBro/JaBa/wiki/Self-Hosting) to le * [Full commands list](https://dash.jababot.ru/commands) * [Discord](https://discord.gg/Ptkj2n9nzZ) * [Github](https://github.com/JonnyBro/JaBa/) -* [Dashboard](https://dash.jababot.ru) ## Support @@ -63,7 +57,7 @@ If you want to contribute, feel free to fork this repo and making a pull request ## TODO * [ ] Refactor [tictactoe](./helpers/tictactoe.js). -* [ ] Finish and release *dashboard-core* submodule. +* [ ] Rewrite dashboard. ## License diff --git a/base/BaseCommand.js b/base/BaseCommand.js index 7abc79a0..2e5fd642 100644 --- a/base/BaseCommand.js +++ b/base/BaseCommand.js @@ -1,5 +1,5 @@ /* eslint-disable no-unused-vars */ -const path = require("path"); +import { sep } from "path"; class BaseCommand { constructor(options, client) { @@ -15,8 +15,8 @@ class BaseCommand { /** * @type {String} */ - this.category = this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other"; + this.category = this.dirname ? this.dirname.split(sep)[parseInt(this.dirname.split(sep).length - 1, 10)] : "Other"; } } -module.exports = BaseCommand; +export default BaseCommand; diff --git a/base/BaseEvent.js b/base/BaseEvent.js index bd69c478..2fa28085 100644 --- a/base/BaseEvent.js +++ b/base/BaseEvent.js @@ -11,4 +11,4 @@ class BaseEvent { } } -module.exports = BaseEvent; +export default BaseEvent; diff --git a/base/Client.js b/base/Client.js index d5e50f83..b8217352 100644 --- a/base/Client.js +++ b/base/Client.js @@ -1,32 +1,41 @@ -const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } = require("discord.js"), - { GiveawaysManager } = require("discord-giveaways"), - { REST } = require("@discordjs/rest"), - { Player: DiscordPlayer } = require("discord-player"), - { SpotifyExtractor } = require("@discord-player/extractor"), - { YoutubeiExtractor } = require("discord-player-youtubei"), - { Routes } = require("discord-api-types/v10"); +import { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } from "discord.js"; +import { GiveawaysManager } from "discord-giveaways"; +import { REST } from "@discordjs/rest"; +import { Player } from "discord-player"; +import { SpotifyExtractor } from "@discord-player/extractor"; +import { YoutubeiExtractor } from "discord-player-youtubei"; +import { Routes } from "discord-api-types/v10"; +import { join, sep } from "path"; +import { promises as fs } from "fs"; +import { setTimeout } from "timers/promises"; +import mongoose from "mongoose"; -const BaseEvent = require("./BaseEvent.js"), - BaseCommand = require("./BaseCommand.js"), - path = require("path"), - fs = require("fs").promises, - mongoose = require("mongoose"); +import config from "../config.js"; +import * as emojis from "../emojis.json"; +import langs from "../languages/language-meta.js"; +import logger from "../helpers/logger.js"; +import * as funcs from "../helpers/functions.js"; + +import BaseEvent from "./BaseEvent.js"; +import BaseCommand from "./BaseCommand.js"; +import guild from "./Guild.js"; +import user from "./User.js"; +import member from "./Member.js"; class JaBaClient extends Client { constructor(options) { super(options); - this.config = require("../config"); - this.customEmojis = require("../emojis"); - this.languages = require("../languages/language-meta"); + this.config = config; + this.customEmojis = emojis; + this.languages = langs; this.commands = new Collection(); - this.logger = require("../helpers/logger"); - this.wait = require("node:timers/promises").setTimeout; - this.functions = require("../helpers/functions"); - this.guildsData = require("../base/Guild"); - this.usersData = require("../base/User"); - this.membersData = require("../base/Member"); - this.dashboard = require("../dashboard/dashboard"); + this.logger = logger; + this.wait = setTimeout; + this.functions = funcs; + this.guildsData = guild.default; + this.usersData = user.default; + this.membersData = member.default; this.databaseCache = {}; this.databaseCache.users = new Collection(); @@ -43,7 +52,7 @@ class JaBaClient extends Client { * @returns {Promise} A Promise that resolves when the client is fully initialized. */ async init() { - this.player = new DiscordPlayer(this); + this.player = new Player(this); await this.player.extractors.register(YoutubeiExtractor, { authentication: this.config.youtubeCookie, @@ -63,25 +72,33 @@ class JaBaClient extends Client { this.player.events.on("playerStart", async (queue, track) => { const m = ( await queue.metadata.channel.send({ - content: this.translate("music/play:NOW_PLAYING", { - songName: `${track.title} - ${track.author}`, - songURL: track.url, - }, queue.metadata.data.guild.language), + content: this.translate( + "music/play:NOW_PLAYING", + { + songName: `${track.title} - ${track.author}`, + songURL: track.url, + }, + queue.metadata.data.guild.language, + ), }) ).id; - if (track.durationMS > 1) + if (track.durationMS > 1) { setTimeout(() => { const message = queue.metadata.channel.messages.cache.get(m); if (message && message.deletable) message.delete(); }, track.durationMS); - else - setTimeout(() => { - const message = queue.metadata.channel.messages.cache.get(m); + } else { + setTimeout( + () => { + const message = queue.metadata.channel.messages.cache.get(m); - if (message && message.deletable) message.delete(); - }, 5 * 60 * 1000); + if (message && message.deletable) message.delete(); + }, + 5 * 60 * 1000, + ); + } }); this.player.events.on("emptyQueue", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.data.guild.language))); this.player.events.on("emptyChannel", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.data.guild.language))); @@ -106,9 +123,7 @@ class JaBaClient extends Client { mongoose .connect(this.config.mongoDB) - .then(() => { - this.logger.log("Connected to the MongoDB database."); - }) + .then(this.logger.log("Connected to the MongoDB database.")) .catch(e => { this.logger.error(`Unable to connect to the MongoDB database.\nError: ${e.message}\n${e.stack}`); }); @@ -127,8 +142,8 @@ class JaBaClient extends Client { */ async loadCommands(dir) { const rest = new REST().setToken(this.config.token), - filePath = path.join(__dirname, dir), - folders = (await fs.readdir(filePath)).map(file => path.join(filePath, file)); + filePath = join(__dirname, dir), + folders = (await fs.readdir(filePath)).map(file => join(filePath, file)); const commands = []; for (const folder of folders) { @@ -137,7 +152,7 @@ class JaBaClient extends Client { for (const file of files) { if (!file.endsWith(".js")) continue; - const Command = require(path.join(folder, file)); + const Command = require(join(folder, file)); if (!(Command.prototype instanceof BaseCommand)) continue; @@ -158,8 +173,8 @@ class JaBaClient extends Client { await rest.put(route, { body: commands }); this.logger.log("Successfully registered application commands."); - } catch (err) { - this.logger.error("Error registering application commands:", err); + } catch (e) { + this.logger.error("Error registering application commands:", e); } } @@ -171,7 +186,7 @@ class JaBaClient extends Client { */ async loadCommand(dir, file) { try { - const Command = require(path.join(dir, `${file}.js`)); + const Command = require(join(dir, `${file}.js`)); if (!(Command.prototype instanceof BaseCommand)) { return this.logger.error(`Tried to load a non-command file: "${file}.js"`); @@ -183,8 +198,8 @@ class JaBaClient extends Client { if (typeof command.onLoad === "function") await command.onLoad(this); this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`); - } catch (error) { - this.logger.error(`Error loading command "${file}":`, error); + } catch (e) { + this.logger.error(`Error loading command "${file}":`, e); } } @@ -195,7 +210,7 @@ class JaBaClient extends Client { * @returns {void} This method does not return a value. */ unloadCommand(dir, name) { - delete require.cache[require.resolve(`${dir}${path.sep}${name}.js`)]; + delete require.cache[require.resolve(`${dir}${sep}${name}.js`)]; return; } @@ -206,15 +221,15 @@ class JaBaClient extends Client { * @returns {Promise} This method does not return a value. */ async loadEvents(dir) { - const filePath = path.join(__dirname, dir); + const filePath = join(__dirname, dir); const files = await fs.readdir(filePath); for (const file of files) { - const fullPath = path.join(filePath, file); + const fullPath = join(filePath, file); const stat = await fs.lstat(fullPath); if (stat.isDirectory()) { - await this.loadEvents(path.join(dir, file)); + await this.loadEvents(join(dir, file)); continue; } @@ -237,8 +252,8 @@ class JaBaClient extends Client { event.once ? this.once(event.name, event.execute.bind(event, this)) : this.on(event.name, event.execute.bind(event, this)); this.logger.log(`Successfully loaded "${file}" event. (Event: ${event.name})`); - } catch (error) { - this.logger.error(`Error loading event "${file}":`, error); + } catch (e) { + this.logger.error(`Error loading event "${file}":`, e); } } } @@ -291,7 +306,7 @@ class JaBaClient extends Client { .setColor(data.color ?? this.config.embed.color) .setFooter(typeof data.footer === "object" ? data.footer : data.footer ? { text: data.footer } : this.config.embed.footer) .setTimestamp(data.timestamp ?? null) - .setAuthor(typeof data.author === "string" ? { name: data.author, iconURL: this.user.avatarURL() } : data.author ?? null); + .setAuthor(typeof data.author === "string" ? { name: data.author, iconURL: this.user.avatarURL() } : (data.author ?? null)); return embed; } @@ -341,6 +356,7 @@ class JaBaClient extends Client { await memberData.save(); const guildData = await this.getGuildData(guildId); + if (guildData) { guildData.members.push(memberData._id); await guildData.save(); @@ -370,4 +386,4 @@ class JaBaClient extends Client { } } -module.exports = JaBaClient; +export default JaBaClient; diff --git a/base/Guild.js b/base/Guild.js index 634cfdd9..a2b3507b 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -1,55 +1,57 @@ -const mongoose = require("mongoose"), - Schema = mongoose.Schema, - languages = require("../languages/language-meta.json"); +import { model, Schema } from "mongoose"; +import { langs } from "../languages/language-meta.js"; -module.exports = mongoose.model("Guild", new Schema({ - id: { type: String }, +export default model( + "Guild", + new Schema({ + id: { type: String }, - membersData: { type: Object, default: {} }, - members: [{ type: Schema.Types.ObjectId, ref: "Member" }], + membersData: { type: Object, default: {} }, + members: [{ type: Schema.Types.ObjectId, ref: "Member" }], - language: { type: String, default: languages.find(l => l.default).name }, - plugins: { - type: Object, - default: { - welcome: { - enabled: false, - message: null, - channel: null, - withImage: null, + language: { type: String, default: langs.find(l => l.default).name }, + plugins: { + type: Object, + default: { + welcome: { + enabled: false, + message: null, + channel: null, + withImage: null, + }, + goodbye: { + enabled: false, + message: null, + channel: null, + withImage: null, + }, + autorole: { + enabled: false, + role: null, + }, + automod: { + enabled: false, + ignored: [], + }, + warnsSanctions: { + kick: null, + ban: null, + }, + monitoring: { + messageUpdate: null, + messageDelete: null, + }, + tickets: { + count: 0, + ticketLogs: null, + transcriptionLogs: null, + ticketsCategory: null, + }, + suggestions: null, + reports: null, + birthdays: null, + modlogs: null, }, - goodbye: { - enabled: false, - message: null, - channel: null, - withImage: null, - }, - autorole: { - enabled: false, - role: null, - }, - automod: { - enabled: false, - ignored: [], - }, - warnsSanctions: { - kick: null, - ban: null, - }, - monitoring: { - messageUpdate: null, - messageDelete: null, - }, - tickets: { - count: 0, - ticketLogs: null, - transcriptionLogs: null, - ticketsCategory: null, - }, - suggestions: null, - reports: null, - birthdays: null, - modlogs: null, }, - }, -})); + }), +); diff --git a/base/Member.js b/base/Member.js index d494f72c..59aeec04 100644 --- a/base/Member.js +++ b/base/Member.js @@ -1,33 +1,36 @@ -const mongoose = require("mongoose"); +import { model, Schema } from "mongoose"; -module.exports = mongoose.model("Member", new mongoose.Schema({ - id: { type: String }, - guildID: { type: String }, +export default model( + "Member", + new Schema({ + id: { type: String }, + guildID: { type: String }, - money: { type: Number, default: 0 }, - workStreak: { type: Number, default: 0 }, - bankSold: { type: Number, default: 0 }, - exp: { type: Number, default: 0 }, - level: { type: Number, default: 0 }, - transactions: { type: Array, default: [] }, + money: { type: Number, default: 0 }, + workStreak: { type: Number, default: 0 }, + bankSold: { type: Number, default: 0 }, + exp: { type: Number, default: 0 }, + level: { type: Number, default: 0 }, + transactions: { type: Array, default: [] }, - registeredAt: { type: Number, default: Date.now() }, + registeredAt: { type: Number, default: Date.now() }, - cooldowns: { - type: Object, - default: { - work: 0, - rob: 0, + cooldowns: { + type: Object, + default: { + work: 0, + rob: 0, + }, }, - }, - sanctions: { type: Array, default: [] }, - mute: { - type: Object, - default: { - muted: false, - case: null, - endDate: null, + sanctions: { type: Array, default: [] }, + mute: { + type: Object, + default: { + muted: false, + case: null, + endDate: null, + }, }, - }, -})); + }), +); diff --git a/base/User.js b/base/User.js index c455a4c4..e86ba80b 100644 --- a/base/User.js +++ b/base/User.js @@ -1,5 +1,5 @@ -const mongoose = require("mongoose"), - Canvas = require("@napi-rs/canvas"); +import { Schema, model } from "mongoose"; +import { createCanvas, loadImage } from "@napi-rs/canvas"; const genToken = () => { let token = ""; @@ -9,7 +9,7 @@ const genToken = () => { return token; }; -const userSchema = new mongoose.Schema({ +const userSchema = new Schema({ id: { type: String }, rep: { type: Number, default: 0 }, @@ -88,17 +88,17 @@ const userSchema = new mongoose.Schema({ }); userSchema.method("getAchievements", async function () { - const canvas = Canvas.createCanvas(1800, 250), + const canvas = createCanvas(1800, 250), ctx = canvas.getContext("2d"); const images = [ - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.work.achieved ? "_colored" : ""}1.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.firstCommand.achieved ? "_colored" : ""}2.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.married.achieved ? "_colored" : ""}3.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.work.achieved ? "_colored" : ""}1.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.firstCommand.achieved ? "_colored" : ""}2.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.married.achieved ? "_colored" : ""}3.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`), ]; let dim = 0; @@ -107,7 +107,7 @@ userSchema.method("getAchievements", async function () { dim += 200; } - return (await canvas.encode("png")); + return await canvas.encode("png"); }); -module.exports = mongoose.model("User", userSchema); +export default model("User", userSchema); diff --git a/base/newClient.js b/base/newClient.js new file mode 100644 index 00000000..ae3e9497 --- /dev/null +++ b/base/newClient.js @@ -0,0 +1,19 @@ +import { Client } from "discord.js"; +import { config } from "../config.js"; +import { init as initCommands } from "../handlers/command-handler/index.js"; +import { init as initEvents } from "../handlers/event-handler/index.js"; + +export class ExtendedClient extends Client { + /** + * @param {import("discord.js").ClientOptions} options + */ + constructor(options) { + super(options); + } + + async init() { + return this.login(config.token) + .then(async () => await Promise.all([initCommands(), initEvents()])) + .catch(console.error); + } +} diff --git a/clips/.gitkeep b/clips/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/commands/Administration/config.js b/commands/Administration/config.js index c0aa1f57..d4f5f0df 100644 --- a/commands/Administration/config.js +++ b/commands/Administration/config.js @@ -103,7 +103,8 @@ class Config extends BaseCommand { ? interaction.translate("administration/config:WELCOME_CONTENT", { channel: `<#${guildData.plugins.welcome.channel}>`, withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), inline: true, }, { @@ -112,7 +113,8 @@ class Config extends BaseCommand { ? interaction.translate("administration/config:GOODBYE_CONTENT", { channel: `<#${guildData.plugins.goodbye.channel}>`, withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), inline: true, }, { @@ -125,19 +127,22 @@ class Config extends BaseCommand { (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", { count: guildData.plugins.warnsSanctions.kick, - }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + + }) + : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", { count: guildData.plugins.warnsSanctions.ban, - }) : interaction.translate("administration/config:BAN_NOT_DEFINED")), + }) + : interaction.translate("administration/config:BAN_NOT_DEFINED")), }, { name: interaction.translate("administration/config:AUTOMOD_TITLE"), value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", { channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), }, { name: interaction.translate("administration/config:MONITORING_CHANNELS"), @@ -156,10 +161,6 @@ class Config extends BaseCommand { `${interaction.translate("administration/config:TICKETLOGS")}: ${guildData.plugins?.tickets?.ticketLogs ? `<#${guildData.plugins?.tickets?.ticketLogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` + `${interaction.translate("administration/config:TRANSCRIPTIONLOGS")}: ${guildData.plugins?.tickets?.transcriptionLogs ? `<#${guildData.plugins?.tickets?.transcriptionLogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n`, }, - { - name: interaction.translate("administration/config:DASHBOARD_TITLE"), - value: `[${interaction.translate("administration/config:DASHBOARD_CONTENT")}](${client.config.dashboard.domain})`, - }, ], }); @@ -215,13 +216,14 @@ async function changeSetting(interaction, setting, state, channel) { content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, ephemeral: true, }); - } else + } else { return interaction.reply({ content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: ${ data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**` }`, ephemeral: true, }); + } } } else { if (!state) { @@ -245,13 +247,14 @@ async function changeSetting(interaction, setting, state, channel) { content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, ephemeral: true, }); - } else + } else { return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${ data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**` }`, ephemeral: true, }); + } } } } diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index 06da073d..ee60eb44 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -63,7 +63,7 @@ class Shorturl extends BaseCommand { }).then(res => res.json()); interaction.editReply({ - content: ``, + content: `<${res.shortLink}>`, }); } } diff --git a/commands/General/stats.js b/commands/General/stats.js index 7cc62b61..2813fcb2 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -91,7 +91,6 @@ class Stats extends BaseCommand { { name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"), value: interaction.translate("misc:STATS_FOOTER", { - dashboardLink: client.config.dashboard.domain, supportLink: "https://discord.gg/Ptkj2n9nzZ", inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] }), owner: client.config.owner.id, diff --git a/config.sample.js b/config.sample.js index fd73d453..c2508e29 100644 --- a/config.sample.js +++ b/config.sample.js @@ -1,4 +1,4 @@ -module.exports = { +export default { /* The token of your Discord Bot */ token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", /* UserID of your Discord Bot */ @@ -22,19 +22,23 @@ module.exports = { invite: "https://discord.gg/discord", // Invite link to the support server }, /* Dashboard configuration */ - dashboard: { + /* dashboard: { enabled: false, // Whether the dashboard is enabled or not maintanceKey: "letmein", // Maintance key port: 80, // Dashboard port domain: "http://localhost", // The base URL of the dashboard without / at the end secret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Your Bot's Client Secret logs: "123456789098765432", // The channel ID for logs - }, + }, */ /* Embeds defaults */ embed: { color: "#00FF00", // Color footer: { - text: "My Discord Bot | v" + require("./package.json").version, // Footer text + text: + "My Discord Bot | v" + + import("./package.json", { + with: { type: "json" }, + }).version, // Footer text }, }, /* Bot's owner informations */ @@ -42,7 +46,5 @@ module.exports = { id: "123456789098765432", // The ID of the bot's owner }, /* Add your own API keys here */ - apiKeys: { - shlink: "12345678-1234-1234-1234-123456789098" /* Shlink.io REST API key */, - }, + apiKeys: {}, }; diff --git a/dashboard/dashboard-core b/dashboard/dashboard-core deleted file mode 160000 index 42cb4400..00000000 --- a/dashboard/dashboard-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 42cb44000f844f17b0d9e12e15a45ab60f3dcdb7 diff --git a/dashboard/dashboard.js b/dashboard/dashboard.js deleted file mode 100644 index 8279623d..00000000 --- a/dashboard/dashboard.js +++ /dev/null @@ -1,221 +0,0 @@ -const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"), - DBD = require("./dashboard-core/index"), - settings = require("./settings"); - -const { PermissionsBitField } = require("discord.js"); - -const locales = { - "en-US": require("../languages/en-US/dashboard.json"), - "ru-RU": require("../languages/ru-RU/dashboard.json"), - "uk-UA": require("../languages/uk-UA/dashboard.json"), -}; - -/** - * - * @param {import("../base/Client")} client - */ -module.exports.load = async client => { - const commands = client.commands.map(v => { - return { - commandName: v.command.name, - commandDescription: client.translate(`${v.category.toLowerCase()}/${v.command.name}:DESCRIPTION`), - commandUsage: client.translate(`${v.category.toLowerCase()}/${v.command.name}:USAGE`), - commandAlias: "", - _category: v.category, - }; - }); - let categories = []; - - commands.forEach(c => { - if (!categories.includes(c._category)) categories.push(c._category); - }); - - categories = categories.map(c => { - return { - category: c, - categoryId: c.toLowerCase(), - subTitle: "", - hideAlias: true, - hideDescription: false, - hideSidebarItem: c === "Owner" || c === "IAT" ? true : false, - list: commands.filter(v => v._category === c), - }; - }); - - const Dashboard = new DBD.Dashboard({ - port: client.config.dashboard.port, - client: { - id: client.user.id, - secret: client.config.dashboard.secret, - }, - cookiesSecret: client.config.dashboard.secret, - domain: client.config.dashboard.domain, - redirectUri: `${client.config.dashboard.domain}/discord/callback`, - bot: client, - ownerIDs: [client.config.owner.id], - requiredPermissions: PermissionsBitField.Flags.ViewChannel, - invite: { - clientId: client.user.id, - scopes: ["bot", "applications.commands"], - permissions: "8", - redirectUri: `${client.config.dashboard.domain}`, - }, - supportServer: { - slash: "/support", - inviteUrl: client.config.support.invite, - }, - rateLimits: { - manage: { - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes) - message: "You are ratelimited!", // Message returned if user should be rate limited, could be also JSON/HTML - store: null, // - if null, new MemoryStore() - // supported stores: https://www.npmjs.com/package/express-rate-limit#store - }, - guildPage: { - windowMs: 15 * 60 * 1000, - max: 100, - message: "You are ratelimited!", - store: null, - }, - settingsUpdatePostAPI: { - windowMs: 15 * 60 * 1000, - max: 100, - message: "You are ratelimited!", - store: null, - }, - }, - useTheme404: true, - useThemeMaintenance: true, - useUnderMaintenance: false, - underMaintenanceAccessKey: client.config.dashboard.maintanceKey, - underMaintenanceAccessPage: "/get-access", - underMaintenance: { - title: "Under Maintenance", - contentTitle: "This page is under maintenance", - texts: [ - "
", - "We still want to change for the better for you.", - "Therefore, we are introducing technical updates so that we can allow you to enjoy the quality of our services.", - "
", - `Come back to us later or join our Discord Support Server`, - ], - }, - theme: SoftUI({ - customThemeOptions: { - // eslint-disable-next-line no-unused-vars - index: async ({ req, res, config }) => { - const user = req.session?.user; - const username = (user?.discriminator === "0" ? user?.username : user?.tag) || "Guest"; - - let users = 0; - client.guilds.cache.forEach(g => { - users += g.memberCount; - }); - - const cards = [ - { - title: "Current User", - icon: "single-02", - getValue: username, - }, - { - title: "Playing music in this much servers", - icon: "settings-gear-65", - getValue: client.player.nodes.cache.size, - }, - { - title: "Users Count", - icon: "favourite-28", - getValue: users, - }, - { - title: "Servers Count", - icon: "notification-70", - getValue: `${client.guilds.cache.size - 1} out of 2000`, - progressBar: { - enabled: true, - getProgress: Math.round(((client.guilds.cache.size - 1) / 2000) * 100), - }, - }, - ]; - - return { - values: [], - graph: {}, - cards, - }; - }, - }, - websiteName: `${client.user.username} Dashboard`, - colorScheme: "blue", - supporteMail: "", - icons: { - favicon: client.user.avatarURL(), - noGuildIcon: "https://pnggrid.com/wp-content/uploads/2021/05/Discord-Logo-Circle-1024x1024.png", - sidebar: { - darkUrl: client.user.avatarURL(), - lightUrl: client.user.avatarURL(), - hideName: false, - borderRadius: "1rem", - alignCenter: true, - }, - }, - index: { - card: { - category: "JaBa Bot", - title: "Simple bot made by Jonny_Bro", - description: "JaBa's dashboard", - image: "", - link: { - enabled: false, - url: "https://github.com/JonnyBro", - }, - }, - graph: { - enabled: false, - lineGraph: true, - title: "Memory Usage", - tag: "Memory (MB)", - max: 100, - }, - }, - notify: { - errors: { - settingsSave: "Failed to save setttings", - }, - success: { - settingsSave: "Successfully saved setttings.", - login: "Successfully logged in.", - logout: "Successfully logged out.", - }, - }, - preloader: { - image: "", - spinner: true, - text: "Page is loading", - }, - commands: categories, - locales: { - enUS: locales["en-US"], - ruRU: locales["ru-RU"], - ukUA: locales["uk-UA"], - }, - }), - customPages: [ - DBD.customPagesTypes.redirectToUrl("/github", () => { - return "https://github.com/JonnyBro/JaBa"; - }), - DBD.customPagesTypes.redirectToUrl("/updates", () => { - return "https://github.com/JonnyBro/JaBa/blob/main/dashboard/docs/updates.md"; - }), - ], - settings: settings(client), - }); - - await Dashboard.init().then(() => { - client.logger.ready(`Dashboard launched on port ${client.config.dashboard.port}`); - }).catch(err => { - client.logger.error(`Dashboard failed to initialize:\n${err}`); - }); -}; diff --git a/dashboard/settings.js b/dashboard/settings.js deleted file mode 100644 index 7110aba0..00000000 --- a/dashboard/settings.js +++ /dev/null @@ -1,459 +0,0 @@ -const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"), - DBD = require("./dashboard-core/index"); - -const { PermissionsBitField, ChannelType } = require("discord.js"); - -module.exports = client => [ - { - categoryId: "main", - categoryName: "Main settings", - categoryDescription: "Setup your bot here!", - categoryPermissions: PermissionsBitField.Flags.ManageGuild, - categoryOptionsList: [ - { - optionId: "lang", - optionName: "Language", - optionDescription: "Change bot's language on the server", - optionType: DBD.formTypes.select({ - English: "en-US", - Russian: "ru-RU", - Ukrainian: "uk-UA", - }), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.language; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.language = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome", - optionName: "Welcome Message", - optionDescription: "Setup welcome message on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "welcome_enable", - optionName: "Enabled", - optionDescription: "Toggle welcome messages sending", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_image", - optionName: "Add Image", - optionDescription: "Toggle sending an image with welcome message", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.withImage; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.withImage = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_message", - optionName: "Message", - optionDescription: "Change welcome message (You can use {user}, {server} and {membercount} wildcards)", - optionType: DBD.formTypes.input("Welcome, {user}!", 2, 100, false, false), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.message; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.message = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_channel", - optionName: "Channel", - optionDescription: "Select a channel for welcome messages", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.channel; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.channel = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "goodbye", - optionName: "Goodbye Message", - optionDescription: "Setup goodbye message on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "goodbye_enable", - optionName: "Enabled", - optionDescription: "Toggle goodbye messages sending", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_image", - optionName: "Add Image", - optionDescription: "Toggle sending an image with goodbye message", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.withImage; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.withImage = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_message", - optionName: "Message", - optionDescription: "Change goodbye message (You can use {user}, {server} and {membercount} wildcards)", - optionType: DBD.formTypes.input("goodbye, {user}!", 2, 100, false, false), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.message; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.message = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_channel", - optionName: "Channel", - optionDescription: "Select a channel for goodbye messages", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.channel; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.channel = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "autorole", - optionName: "Auto Role", - optionDescription: "Setup auto role on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "autorole_enable", - optionName: "Enabled", - optionDescription: "Toggle auto role granting for new members", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.autorole.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.autorole.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "autorole_role", - optionName: "Role", - optionDescription: "Select a role for auto role. Select \"-\" to disable", - optionType: DBD.formTypes.rolesSelect(false, false, true), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.autorole.role; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.autorole.role = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "automod", - optionName: "Auto Mod", - optionDescription: "Setup auto mod on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "automod_enable", - optionName: "Enabled", - optionDescription: "Toggle auto mod. It will remove invite links from non-moderators", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.automod.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.automod.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "automod_ignore", - optionName: "Ignore Channels", - optionDescription: "Select a channels for auto mod to ignore", - optionType: DBD.formTypes.channelsMultiSelect(false, false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.automod.ignored; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.automod.ignored = newData; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "monitoring", - optionName: "Monitoring Channels", - optionDescription: "Setup monitoring channels on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "monitoring_messageupdate", - optionName: "Message Update Channel", - optionDescription: "Select a channel for messages update logs to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins?.monitoring?.messageUpdate; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; - - guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "monitoring_messagedelete", - optionName: "Message Deletion Channel", - optionDescription: "Select a channel for messages deletion logs to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins?.monitoring?.messageDelete; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; - - guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "channels", - optionName: "Special Channels", - optionDescription: "Setup special channels on the server. Select \"-\" to disable", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "channels_suggestions", - optionName: "Suggestions Channel", - optionDescription: "Select a channel for suggestions to go to", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.suggestions; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.suggestions = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_reports", - optionName: "Reports Channel", - optionDescription: "Select a channel for reports to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.reports; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.reports = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_birthdays", - optionName: "Birthdays Channel", - optionDescription: "Select a channel for birthdays message to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.birthdays; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.birthdays = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_modlogs", - optionName: "Moderation Logs Channel", - optionDescription: "Select a channel for moderation logs to go to (warns). Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.modlogs; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.modlogs = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - ], - }, - { - categoryId: "test", - categoryName: "test settings", - categoryDescription: "ooga booga", - categoryPermissions: PermissionsBitField.Flags.ViewChannel, - categoryOptionsList: [ - { - optionType: DBD.formTypes.embedBuilder({ - username: "JaBa", - avatarURL: "https://cdn.discordapp.com/avatars/708637495054565426/af98d49ebc9bf28b40b45ed5a0a623b4.png?size=4096", - }), - }, - ], - }, -]; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..eabf7207 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,50 @@ +import globals from "globals"; +import pluginJs from "@eslint/js"; +import stylisticJs from "@stylistic/eslint-plugin-js"; + +/** @type {import("eslint").Linter.Config[]} */ +export default [ + pluginJs.configs.recommended, + { + languageOptions: { + globals: globals.node, + ecmaVersion: "latest", + sourceType: "module", + }, + ignores: ["node_modules", "dashboard"], + plugins: { + "@stylistic/js": stylisticJs, + }, + rules: { + "arrow-body-style": ["error", "as-needed"], + camelcase: "error", + curly: ["error", "multi-line"], + eqeqeq: ["error", "always"], + "no-console": "off", + "no-var": "error", + "prefer-const": "error", + yoda: "error", + "@stylistic/js/arrow-spacing": ["error", { before: true, after: true }], + "@stylistic/js/comma-dangle": ["error", "always-multiline"], + "@stylistic/js/comma-spacing": ["error", { before: false, after: true }], + "@stylistic/js/comma-style": ["error", "last"], + "@stylistic/js/dot-location": ["error", "property"], + "@stylistic/js/keyword-spacing": ["error", { before: true, after: true }], + "@stylistic/js/no-multi-spaces": "error", + "@stylistic/js/no-multiple-empty-lines": [ + "error", + { + max: 2, + maxEOF: 1, + maxBOF: 0, + }, + ], + "@stylistic/js/no-trailing-spaces": ["error"], + "@stylistic/js/object-curly-spacing": ["error", "always"], + "@stylistic/js/quotes": ["error", "double"], + "@stylistic/js/indent": ["error", "tab"], + "@stylistic/js/semi": ["error", "always"], + "@stylistic/js/space-infix-ops": "error", + }, + }, +]; diff --git a/events/CommandHandler.js b/events/CommandHandler.js index 0337da0c..4923eec7 100644 --- a/events/CommandHandler.js +++ b/events/CommandHandler.js @@ -1,5 +1,5 @@ -const { InteractionType } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { InteractionType } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class CommandHandler extends BaseEvent { constructor() { @@ -33,12 +33,10 @@ class CommandHandler extends BaseEvent { if (interaction.type !== InteractionType.ApplicationCommand || !interaction.isCommand()) return; // IAT Guild Command Check - if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") - return interaction.reply({ content: "IAT only", ephemeral: true }); + if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT only", ephemeral: true }); // Owner-only command check - if (command.ownerOnly && interaction.user.id !== client.config.owner.id) - return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true }); + if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true }); // First command achievement check const { firstCommand } = interaction.data.user.achievements; @@ -68,4 +66,4 @@ class CommandHandler extends BaseEvent { } } -module.exports = CommandHandler; +export default CommandHandler; diff --git a/events/Guild/guildBanAdd.js b/events/Guild/guildBanAdd.js index be02d479..dd92d904 100644 --- a/events/Guild/guildBanAdd.js +++ b/events/Guild/guildBanAdd.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class guildBanAdd extends BaseEvent { constructor() { @@ -26,8 +26,10 @@ class guildBanAdd extends BaseEvent { await ban.user.send({ embeds: [embed], }); - } catch (e) { /**/ } + } catch { + /**/ + } } } -module.exports = guildBanAdd; +export default guildBanAdd; diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js index ffa6a96f..0856149d 100644 --- a/events/Guild/guildCreate.js +++ b/events/Guild/guildCreate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildCreate extends BaseEvent { constructor() { @@ -62,12 +62,13 @@ class GuildCreate extends BaseEvent { const logChannel = client.channels.cache.get(client.config.support.logs); - if (logChannel) + if (logChannel) { await logChannel.send({ embeds: [embed], }); + } } } } -module.exports = GuildCreate; +export default GuildCreate; diff --git a/events/Guild/guildDelete.js b/events/Guild/guildDelete.js index 20b795cc..b87299c0 100644 --- a/events/Guild/guildDelete.js +++ b/events/Guild/guildDelete.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildDelete extends BaseEvent { constructor() { @@ -25,13 +25,13 @@ class GuildDelete extends BaseEvent { const logChannel = client.channels.cache.get(client.config.support.logs); - if (logChannel) + if (logChannel) { await logChannel.send({ embeds: [embed], }); - else client.logger.warn(`Log channel not found for guild deletion: ${guild.name}`); + } else client.logger.warn(`Log channel not found for guild deletion: ${guild.name}`); } } } -module.exports = GuildDelete; +export default GuildDelete; diff --git a/events/Guild/guildMemberAdd.js b/events/Guild/guildMemberAdd.js index 0112ae64..8bad2c4c 100644 --- a/events/Guild/guildMemberAdd.js +++ b/events/Guild/guildMemberAdd.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberAdd extends BaseEvent { constructor() { @@ -46,4 +46,4 @@ class GuildMemberAdd extends BaseEvent { } } -module.exports = GuildMemberAdd; +export default GuildMemberAdd; diff --git a/events/Guild/guildMemberRemove.js b/events/Guild/guildMemberRemove.js index c3e1499a..9726d708 100644 --- a/events/Guild/guildMemberRemove.js +++ b/events/Guild/guildMemberRemove.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberRemove extends BaseEvent { constructor() { @@ -37,4 +37,4 @@ class GuildMemberRemove extends BaseEvent { } } -module.exports = GuildMemberRemove; +export default GuildMemberRemove; diff --git a/events/Guild/guildMemberUpdate.js b/events/Guild/guildMemberUpdate.js index 2c48d1a9..fd8d1e3b 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/events/Guild/guildMemberUpdate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberUpdate extends BaseEvent { constructor() { @@ -44,4 +44,4 @@ class GuildMemberUpdate extends BaseEvent { } } -module.exports = GuildMemberUpdate; +export default GuildMemberUpdate; diff --git a/events/MessageHandler.js b/events/MessageHandler.js index fd1abac8..6ef06e6a 100644 --- a/events/MessageHandler.js +++ b/events/MessageHandler.js @@ -1,5 +1,5 @@ -const { PermissionsBitField, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { PermissionsBitField, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; const xpCooldown = {}; @@ -23,7 +23,7 @@ class MessageCreate extends BaseEvent { if (message.guild) { if (!message.member) await message.guild.members.fetch(message.author.id); - + data.guild = await client.getGuildData(message.guildId); data.member = await client.getMemberData(message.author.id, message.guildId); } @@ -69,8 +69,7 @@ class MessageCreate extends BaseEvent { if (msg.content) embed.addFields([{ name: message.translate("misc:QUOTE_CONTENT"), value: msg.content }]); if (msg.attachments.size > 0) { - if (msg.attachments.find(a => a.contentType.includes("image/"))) - embed.setImage(msg.attachments.find(a => a.contentType.includes("image/")).url); + if (msg.attachments.find(a => a.contentType.includes("image/"))) embed.setImage(msg.attachments.find(a => a.contentType.includes("image/")).url); embed.addFields([ { @@ -160,4 +159,4 @@ class MessageCreate extends BaseEvent { } } -module.exports = MessageCreate; +export default MessageCreate; diff --git a/events/Monitoring/messageDelete.js b/events/Monitoring/messageDelete.js index 5b760cd1..643bf78d 100644 --- a/events/Monitoring/messageDelete.js +++ b/events/Monitoring/messageDelete.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class messageDelete extends BaseEvent { constructor() { @@ -40,4 +40,4 @@ class messageDelete extends BaseEvent { } } -module.exports = messageDelete; +export default messageDelete; diff --git a/events/Monitoring/messageUpdate.js b/events/Monitoring/messageUpdate.js index 72bc91df..38fa9521 100644 --- a/events/Monitoring/messageUpdate.js +++ b/events/Monitoring/messageUpdate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class messageUpdate extends BaseEvent { constructor() { @@ -42,4 +42,4 @@ class messageUpdate extends BaseEvent { } } -module.exports = messageUpdate; +export default messageUpdate; diff --git a/events/Ready.js b/events/Ready.js index 41fd0645..af7fe3cb 100644 --- a/events/Ready.js +++ b/events/Ready.js @@ -1,5 +1,5 @@ -const { ActivityType } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { ActivityType } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class Ready extends BaseEvent { constructor() { @@ -28,8 +28,6 @@ class Ready extends BaseEvent { const checkReminds = require("../helpers/checkReminds"); checkReminds.init(client); - if (client.config.dashboard.enabled) await client.dashboard.load(client); - client.logger.ready(`Loaded a total of ${commands.length} command(s).`); client.logger.ready(`${client.user.getUsername()}, ready to serve ${users} members in ${servers} servers.`); console.timeEnd("botReady"); @@ -63,4 +61,4 @@ class Ready extends BaseEvent { } } -module.exports = Ready; +export default Ready; diff --git a/events/TicketsButton.js b/events/TicketsButton.js index dbbf7340..9aa95547 100644 --- a/events/TicketsButton.js +++ b/events/TicketsButton.js @@ -1,5 +1,5 @@ -const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, PermissionsBitField } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, PermissionsBitField } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class CommandHandler extends BaseEvent { constructor() { @@ -60,9 +60,13 @@ class CommandHandler extends BaseEvent { }); await logChannel.send({ embeds: [logEmbed] }); - await interaction.success("tickets/createticketembed:TICKET_CREATED", { - channel: channel.toString(), - }, { ephemeral: true }); + await interaction.success( + "tickets/createticketembed:TICKET_CREATED", + { + channel: channel.toString(), + }, + { ephemeral: true }, + ); await channel.send(`<@${interaction.user.id}>`); @@ -75,14 +79,8 @@ class CommandHandler extends BaseEvent { description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"), }); - const closeButton = new ButtonBuilder() - .setCustomId("close_ticket") - .setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET")) - .setStyle(ButtonStyle.Danger); - const transcriptButton = new ButtonBuilder() - .setCustomId("transcript_ticket") - .setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET")) - .setStyle(ButtonStyle.Secondary); + const closeButton = new ButtonBuilder().setCustomId("close_ticket").setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET")).setStyle(ButtonStyle.Danger); + const transcriptButton = new ButtonBuilder().setCustomId("transcript_ticket").setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET")).setStyle(ButtonStyle.Secondary); const row = new ActionRowBuilder().addComponents(closeButton, transcriptButton); guildData.plugins.tickets.count++; @@ -135,14 +133,18 @@ class CommandHandler extends BaseEvent { }); transcript += "---- TICKET CLOSED ----\n"; - if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] }); + if (transcriptionLogs !== null) { + interaction.guild.channels.cache + .get(transcriptionLogs) + .send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] }); + } try { await interaction.user.send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }], }); - } catch (e) { + } catch { interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } } @@ -181,7 +183,7 @@ class CommandHandler extends BaseEvent { content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }], }); - } catch (error) { + } catch { interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } } else return; @@ -189,4 +191,4 @@ class CommandHandler extends BaseEvent { } } -module.exports = CommandHandler; +export default CommandHandler; diff --git a/handlers/command-handler/functions/registerCommands.js b/handlers/command-handler/functions/registerCommands.js new file mode 100644 index 00000000..c7fe5ef9 --- /dev/null +++ b/handlers/command-handler/functions/registerCommands.js @@ -0,0 +1,28 @@ +import logger from "../../../helpers/logger.js"; +import differentCommands from "../utils/differentcommands.js"; + +export default async function registerCommands(props) { + const globalCommands = props.commands.filter(cmd => !cmd.options?.devOnly); + props.client.once("ready", () => registerGlobalCommands(props.client, globalCommands)); +} + +const registerGlobalCommands = async (client, commands) => { + const appCommandsManager = client.application.commands; + await appCommandsManager.fetch(); + + await Promise.all( + commands.map(async ({ data }) => { + const targetCommand = appCommandsManager.cache.find(cmd => cmd.name === data.name); + + if (targetCommand && differentCommands(targetCommand, data)) { + await targetCommand.edit(data).catch(() => logger.error(`Failed to update command: ${data.name} globally`)); + + logger.log(`Edited command globally: ${data.name}`); + } else if (!targetCommand) { + await appCommandsManager.create(data).catch(() => logger.error(`Failed to register command: ${data.name}`)); + } + }), + ); + + logger.log("Registered global commands"); +}; diff --git a/handlers/command-handler/index.js b/handlers/command-handler/index.js new file mode 100644 index 00000000..96ffe039 --- /dev/null +++ b/handlers/command-handler/index.js @@ -0,0 +1,36 @@ +import logger from "../../helpers/logger.js"; +import { client } from "../../index.js"; +import { getFilePaths } from "../../utils/get-path.js"; +import { toFileURL } from "../../utils/resolve-file.js"; +import registerCommands from "./functions/registerCommands.js"; + +export const commands = []; + +export const init = async () => { + await buildCommands(); + + await registerCommands({ + client, + commands, + }); +}; + +const buildCommands = async () => { + const commandFilePaths = (await getFilePaths("./newCommands", true)).filter(path => path.endsWith(".js")); + + for (const cmdFilePath of commandFilePaths) { + const { data, run } = await import(toFileURL(cmdFilePath)); + + if (!data || !data.name) { + logger.warn(`Command ${cmdFilePath} does not have a data object or name`); + continue; + } + + if (typeof run !== "function") { + logger.warn(`Command ${cmdFilePath} does not have a run function or it is not a function`); + continue; + } + + commands.push({ data, run }); + } +}; diff --git a/handlers/command-handler/utils/differentcommands.js b/handlers/command-handler/utils/differentcommands.js new file mode 100644 index 00000000..bf32572c --- /dev/null +++ b/handlers/command-handler/utils/differentcommands.js @@ -0,0 +1,8 @@ +export default function differentCommands(appCommand, localCommand) { + const appOptions = appCommand.options || []; + const localOptions = localCommand.options || []; + const appDescription = appCommand.description || ""; + const localDescription = localCommand.description || ""; + + return localDescription !== appDescription || localOptions.length !== appOptions.length; +} diff --git a/handlers/event-handler/index.js b/handlers/event-handler/index.js new file mode 100644 index 00000000..6200e0a6 --- /dev/null +++ b/handlers/event-handler/index.js @@ -0,0 +1,42 @@ +import logger from "../../helpers/logger.js"; +import { client } from "../../index.js"; +import { getFilePaths } from "../../utils/get-path.js"; +import { toFileURL } from "../../utils/resolve-file.js"; + +export const events = []; + +export const init = async () => { + await buildEvents(); + registerEvents(); +}; + +const buildEvents = async () => { + try { + const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); + + for (const eventFilePath of eventFilePaths) { + const { data, run } = await import(toFileURL(eventFilePath)); + + if (!data || !data.name) { + logger.warn(`Event ${eventFilePath} does not have a data object or name`); + continue; + } + + if (typeof run !== "function") { + logger.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); + continue; + } + + events.push({ data, run }); + } + } catch (error) { + logger.error("Error build events: ", error); + } +}; + +const registerEvents = async () => { + for (const { data, run } of events) { + if (data.once) client.once(data.name, run); + else client.on(data.name, run); + } +}; diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 2a8a57d3..7334e6fb 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -1,4 +1,4 @@ -const { CronJob } = require("cron"); +import { CronJob } from "cron"; /** * @@ -61,5 +61,9 @@ async function checkBirthdays(client) { } } -module.exports.init = async client => new CronJob("0 5 * * *", checkBirthdays(client), null, true, "Europe/Moscow"); -module.exports.run = async client => await checkBirthdays(client); +export async function init(client) { + new CronJob("0 5 * * *", checkBirthdays(client), null, true, "Europe/Moscow"); +} +export async function run(client) { + await checkBirthdays(client); +} diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 7f0c123b..7c271c9c 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -56,5 +56,11 @@ async function checkReminds(client) { }); } -module.exports.init = async client => setInterval(async () => await checkReminds(client), 1000); -module.exports.run = async client => await checkReminds(client); +export async function init(client) { + setInterval(async () => { + await checkReminds(client); + }, 1000); +} +export async function run(client) { + await checkReminds(client); +} diff --git a/helpers/cleanup.js b/helpers/cleanup.js index 159bd4e1..59cce4e0 100644 --- a/helpers/cleanup.js +++ b/helpers/cleanup.js @@ -1,5 +1,4 @@ // Thanks Stackoverflow <3 - function setDaysTimeout(callback, days) { // 86400 seconds in a day const msInDay = 86400 * 1000; @@ -19,7 +18,7 @@ function setDaysTimeout(callback, days) { * * @param {import("../base/Client")} client */ -module.exports.init = async function (client) { +export async function init(client) { setDaysTimeout(async () => { const timestamp = Date.now() + 29 * 24 * 60 * 60 * 1000; // 29 days const members = client.membersData.find({ transactions: { $gt: [] } }); @@ -66,4 +65,4 @@ module.exports.init = async function (client) { } }); }, 30); -}; +} diff --git a/helpers/extenders.js b/helpers/extenders.js index 54856c47..33cc2c01 100644 --- a/helpers/extenders.js +++ b/helpers/extenders.js @@ -1,4 +1,4 @@ -const { Message, BaseInteraction, User, GuildMember } = require("discord.js"); +import { Message, BaseInteraction, User, GuildMember } from "discord.js"; /** * diff --git a/helpers/functions.js b/helpers/functions.js index 923885cc..38cbb15b 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -1,147 +1,119 @@ -const moment = require("moment"); +import moment from "moment"; -module.exports = { - /** - * Asynchronously iterates over a collection and executes a callback function for each item. - * - * @param {any[]} collection - The collection to iterate over. - * @param {(item: any) => Promise} callback - The async callback function to execute for each item in the collection. - * @returns {Promise} A promise that resolves when all items in the collection have been processed. - */ - async asyncForEach(collection, callback) { - const allPromises = collection.map(async key => { - await callback(key); - }); +/** + * Asynchronously iterates over a collection and executes a callback function for each item. + * + * @param {any[]} collection - The collection to iterate over. + * @param {(item: any) => Promise} callback - The async callback function to execute for each item in the collection. + * @returns {Promise} A promise that resolves when all items in the collection have been processed. + */ +export async function asyncForEach(collection, callback) { + const allPromises = collection.map(async key => { + await callback(key); + }); - return await Promise.all(allPromises); - }, + return await Promise.all(allPromises); +} - /** - * Sorts an array by the specified key in ascending order. - * - * @param {any[]} array - The array to sort. - * @param {string} key - The key to sort the array by. - * @returns {any[]} The sorted array. - */ - sortByKey(array, key) { - return array.sort(function (a, b) { - const x = a[key]; - const y = b[key]; - return x < y ? 1 : x > y ? -1 : 0; - }); - }, +/** + * Sorts an array by the specified key in ascending order. + * + * @param {any[]} array - The array to sort. + * @param {string} key - The key to sort the array by. + * @returns {any[]} The sorted array. + */ +export function sortByKey(array, key) { + return array.sort(function (a, b) { + const x = a[key]; + const y = b[key]; + return x < y ? 1 : x > y ? -1 : 0; + }); +} - /** - * Shuffles the elements of the provided array in-place. - * - * @param {any[]} pArray - The array to shuffle. - * @returns {any[]} The shuffled array. - */ - shuffle(pArray) { - const array = []; +/** + * Shuffles the elements of the provided array in-place. + * + * @param {any[]} pArray - The array to shuffle. + * @returns {any[]} The shuffled array. + */ +export function shuffle(pArray) { + const array = []; - pArray.forEach(element => array.push(element)); + pArray.forEach(element => array.push(element)); - let currentIndex = array.length, - temporaryValue, - randomIndex; + let currentIndex = array.length, + temporaryValue, + randomIndex; - while (currentIndex !== 0) { - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; + while (currentIndex !== 0) { + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } + return array; +} - return array; - }, +/** + * Generates a random integer between the specified minimum and maximum values (inclusive). + * + * @param {number} [min=0] - The minimum value (inclusive). + * @param {number} [max=100] - The maximum value (inclusive). + * @returns {number} A random integer between min and max. + */ +export function randomNum(min = 0, max = 100) { + min = Math.floor(min); + max = Math.floor(max); - /** - * Generates a random integer between the specified minimum and maximum values (inclusive). - * - * @param {number} [min=0] - The minimum value (inclusive). - * @param {number} [max=100] - The maximum value (inclusive). - * @returns {number} A random integer between min and max. - */ - randomNum(min = 0, max = 100) { - min = Math.floor(min); - max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1) + min); +} +/** + * Formats a date for the specified client and locale. + * + * @param {Object} client - The client object containing language data. + * @param {string} date - The date to format. + * @param {string} [format=null] - The date format to use. If not provided, the default format for the client's language will be used. + * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the date. + * @returns {string} The formatted date. + */ +export function printDate(client, date, format = null, locale = client.defaultLanguage.name) { + const languageData = client.languages.find(language => language.name === locale); + if (format === "" || format === null) format = languageData.defaultMomentFormat; + return moment(new Date(date)).locale(languageData.moment).format(format); +} +/** + * Formats a time value relative to the current time. + * + * @param {Object} client - The client object containing language data. + * @param {string|number|Date} time - The time value to format. + * @param {boolean} [type=false] - If true, formats the time as "X time ago", otherwise formats it as "in X time". + * @param {boolean} [prefix=true] - If true, includes a prefix like "in" or "ago" in the formatted time. + * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the time. + * @returns {string} The formatted time value. + */ +export function convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage.name) { + const languageData = client.languages.find(language => language.name === locale); + const m = moment(time).locale(languageData.moment); + return type ? m.toNow(!prefix) : m.fromNow(!prefix); +} - return Math.floor(Math.random() * (max - min + 1) + min); - }, - - /** - * Formats a date for the specified client and locale. - * - * @param {Object} client - The client object containing language data. - * @param {string} date - The date to format. - * @param {string} [format=null] - The date format to use. If not provided, the default format for the client's language will be used. - * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the date. - * @returns {string} The formatted date. - */ - printDate(client, date, format = null, locale = client.defaultLanguage.name) { - const languageData = client.languages.find(language => language.name === locale); - if (format === "" || format === null) format = languageData.defaultMomentFormat; - - return moment(new Date(date)).locale(languageData.moment).format(format); - }, - - /** - * Formats a time value relative to the current time. - * - * @param {Object} client - The client object containing language data. - * @param {string|number|Date} time - The time value to format. - * @param {boolean} [type=false] - If true, formats the time as "X time ago", otherwise formats it as "in X time". - * @param {boolean} [prefix=true] - If true, includes a prefix like "in" or "ago" in the formatted time. - * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the time. - * @returns {string} The formatted time value. - */ - convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage.name) { - const languageData = client.languages.find(language => language.name === locale); - const m = moment(time).locale(languageData.moment); - - return type ? m.toNow(!prefix) : m.fromNow(!prefix); - }, - - /** - * Generates the appropriate noun form based on the given number and noun forms. - * - * @param {number} number - The number to use for determining the noun form. - * @param {string} one - The noun form for the singular case. - * @param {string} two - The noun form for the dual case. - * @param {string} five - The noun form for the plural case. - * @returns {string} The appropriate noun form based on the given number. - */ - getNoun(number, one, two, five) { - let n = Math.abs(number); - n %= 100; - if (n >= 5 && n <= 20) return five; - n %= 10; - - if (n === 1) return one; - if (n >= 2 && n <= 4) return two; - - return five; - }, - - /** - * Function to apply text on a canvas with dynamic font size based on the width constraint. - * - * @param {import("@napi-rs/canvas").Canvas} canvas - The canvas object where the text will be applied. - * @param {string} text - The string of text that needs to be applied on the canvas. - * @param {number} defaultFontSize - The initial font size for the text. It is expected to decrease with each iteration. - * @param {number} width - The maximum width that the text can occupy before it has to shrink down. - * @param {string} font - The name of the font used for drawing the text on the canvas. - * - * @return {string} - The final calculated font size in a format 'px '. - */ - applyText(canvas, text, defaultFontSize, width, font) { - const ctx = canvas.getContext("2d"); - do ctx.font = `${(defaultFontSize -= 1)}px ${font}`; - while (ctx.measureText(text).width > width); - - return ctx.font; - }, -}; +/** + * Generates the appropriate noun form based on the given number and noun forms. + * + * @param {number} number - The number to use for determining the noun form. + * @param {string} one - The noun form for the singular case. + * @param {string} two - The noun form for the dual case. + * @param {string} five - The noun form for the plural case. + * @returns {string} The appropriate noun form based on the given number. + */ +export function getNoun(number, one, two, five) { + let n = Math.abs(number); + n %= 100; + if (n >= 5 && n <= 20) return five; + n %= 10; + if (n === 1) return one; + if (n >= 2 && n <= 4) return two; + return five; +} diff --git a/helpers/languages.js b/helpers/languages.js index 78ff2445..742c648e 100644 --- a/helpers/languages.js +++ b/helpers/languages.js @@ -1,19 +1,19 @@ -const i18next = require("i18next"), - Backend = require("i18next-fs-backend"), - path = require("path"), - fs = require("fs").promises; +import { use, init, getFixedT } from "i18next"; +import Backend from "i18next-fs-backend"; +import { join, resolve } from "path"; +import { promises as fs } from "fs"; async function walkDirectory(dir, namespaces = [], folderName = "") { const files = await fs.readdir(dir); const languages = []; for (const file of files) { - const stat = await fs.stat(path.join(dir, file)); + const stat = await fs.stat(join(dir, file)); if (stat.isDirectory()) { const isLanguage = file.includes("-"); if (isLanguage) languages.push(file); - const folder = await walkDirectory(path.join(dir, file), namespaces, isLanguage ? "" : `${file}/`); + const folder = await walkDirectory(join(dir, file), namespaces, isLanguage ? "" : `${file}/`); namespaces = folder.namespaces; } else { @@ -27,16 +27,16 @@ async function walkDirectory(dir, namespaces = [], folderName = "") { }; } -module.exports = async () => { +export default async () => { const options = { - loadPath: path.resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), + loadPath: resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), }; - const { namespaces, languages } = await walkDirectory(path.resolve(__dirname, "../languages/")); + const { namespaces, languages } = await walkDirectory(resolve(__dirname, "../languages/")); - i18next.use(Backend); + use(Backend); - await i18next.init({ + await init({ backend: options, debug: false, fallbackLng: "en-US", @@ -47,5 +47,5 @@ module.exports = async () => { preload: languages, }); - return new Map(languages.map(item => [item, i18next.getFixedT(item)])); + return new Map(languages.map(item => [item, getFixedT(item)])); }; diff --git a/helpers/logger.js b/helpers/logger.js index 86f02925..b987c48a 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -1,52 +1,47 @@ -const { bgBlue, black, green } = require("chalk"); - -function dateTimePad(value, digits) { - let number = value; - while (number.toString().length < digits) number = "0" + number; - - return number; -} +import chalk from "chalk"; function format(tDate) { - return ( - dateTimePad(tDate.getDate(), 2) + - "-" + - dateTimePad(tDate.getMonth() + 1, 2) + - "-" + - dateTimePad(tDate.getFullYear(), 2) + - " " + - dateTimePad(tDate.getHours(), 2) + - ":" + - dateTimePad(tDate.getMinutes(), 2) + - ":" + - dateTimePad(tDate.getSeconds(), 2) + - "." + - dateTimePad(tDate.getMilliseconds(), 3) - ); + return new Intl.DateTimeFormat("ru-RU", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + }).format(tDate); } -module.exports = class Logger { - static log(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${bgBlue("LOG")} ${content}`); - } - - static warn(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgYellow("WARN")} ${content}`); - } - - static error(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgRed("ERROR")} ${content}`); - } - - static debug(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${green("DEBUG")} ${content}`); - } - - static cmd(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgWhite("CMD")} ${content}`); - } - - static ready(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgGreen("READY")} ${content}`); - } +const logLevels = { + LOG: chalk.bgBlue("LOG"), + WARN: chalk.black.bgYellow("WARN"), + ERROR: chalk.black.bgRed("ERROR"), + DEBUG: chalk.green("DEBUG"), + CMD: chalk.black.bgWhite("CMD"), + READY: chalk.black.bgGreen("READY"), +}; + +export default { + log(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.LOG} ${content}`); + }, + + warn(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content}`); + }, + + error(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content}`); + }, + + debug(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content}`); + }, + + cmd(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content}`); + }, + + ready(content) { + return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content}`); + }, }; diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js index a7c44a33..c3d238b9 100644 --- a/helpers/tictactoe.js +++ b/helpers/tictactoe.js @@ -1,7 +1,7 @@ // Thanks to simply-djs for this =) // TODO: Refactor this please... -const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require("discord.js"); +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } from "discord.js"; /** * @param {import("discord.js").ChatInputCommandInteraction} interaction @@ -15,7 +15,7 @@ const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require( * @param {string} options.idleEmoji Emoji for "nothing" * @returns {Promise} */ -async function tictactoe(interaction, options = {}) { +export async function tictactoe(interaction, options = {}) { // eslint-disable-next-line no-async-promise-executor return new Promise(async resolve => { try { @@ -25,41 +25,47 @@ async function tictactoe(interaction, options = {}) { if (interaction.commandId) { opponent = interaction.options.getUser(options.userSlash || "user"); - if (!opponent) + if (!opponent) { return interaction.reply({ content: interaction.translate("fun/tictactoe:NO_USER"), ephemeral: true, }); + } - if (opponent.bot) + if (opponent.bot) { return interaction.reply({ content: interaction.translate("fun/tictactoe:BOT_USER"), ephemeral: true, }); + } - if (opponent.id == (interaction.user ? interaction.user : interaction.author).id) + if (opponent.id === (interaction.user ? interaction.user : interaction.author).id) { return interaction.reply({ content: interaction.translate("misc:CANT_YOURSELF"), ephemeral: true, }); + } } else if (!interaction.commandId) { opponent = interaction.mentions.members.first()?.user; - if (!opponent) + if (!opponent) { return interaction.reply({ content: interaction.translate("fun/tictactoe:NO_USER"), }); + } - if (opponent.bot) + if (opponent.bot) { return interaction.reply({ content: interaction.translate("fun/tictactoe:BOT_USER"), ephemeral: true, }); + } - if (opponent.id === interaction.member.id) + if (opponent.id === interaction.member.id) { return interaction.reply({ content: interaction.translate("misc:CANT_YOURSELF"), }); + } } const footer = options.embedFooter || client.config.embed.footer, @@ -97,25 +103,26 @@ async function tictactoe(interaction, options = {}) { }); collector.on("collect", async button => { - if (button.user.id !== opponent.id) + if (button.user.id !== opponent.id) { return button.reply({ content: interaction.translate("fun/tictactoe:REQUEST_SEND", { opponent: opponent.id, }), ephemeral: true, }); + } - if (button.customId == "declinettt") { + if (button.customId === "declinettt") { button.deferUpdate(); return collector.stop("decline"); - } else if (button.customId == "acceptttt") { + } else if (button.customId === "acceptttt") { button.deferUpdate(); collector.stop(); const fighters = [(interaction.user ? interaction.user : interaction.author).id, opponent.id].sort(() => (Math.random() > 0.5 ? 1 : -1)); - const x_emoji = options.xEmoji || "❌"; - const o_emoji = options.oEmoji || "⭕"; + const xEmoji = options.xEmoji || "❌"; + const oEmoji = options.oEmoji || "⭕"; const dashmoji = options.idleEmoji || "➖"; @@ -175,32 +182,32 @@ async function tictactoe(interaction, options = {}) { }); let msg; - if (interaction.commandId) + if (interaction.commandId) { msg = await interaction.editReply({ embeds: [ epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕", + emoji: client.emojis.cache.get(oEmoji) || "⭕", }), ), ], }); - else if (!interaction.commandId) + } else if (!interaction.commandId) { msg = await button.message.edit({ embeds: [ epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕", + emoji: client.emojis.cache.get(oEmoji) || "⭕", }), ), ], }); + } await ttt(msg); - // eslint-disable-next-line no-inner-declarations async function ttt(m) { Args.userid = fighters[Args.user]; const won = { @@ -222,214 +229,212 @@ async function tictactoe(interaction, options = {}) { const c = new ActionRowBuilder().addComponents([c1, c2, c3]); const buttons = [a, b, c]; - if (Args.a1.emoji == o_emoji && Args.b1.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b1.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a2.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c2.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a2.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c2.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b3.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b3.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.a2.emoji == o_emoji && Args.a3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.a2.emoji === oEmoji && Args.a3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.b1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.b3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.b1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.b3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.c1.emoji == o_emoji && Args.c2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.c1.emoji === oEmoji && Args.c2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (won["<:O_:863314110560993340>"] != false) - if (Args.user == 0) { + if (won["<:O_:863314110560993340>"] !== false) { + if (Args.user === 0) { const won = await client.users.fetch(fighters[1]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); - } else if (Args.user == 1) { + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } + } else if (Args.user === 1) { const won = await client.users.fetch(fighters[0]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } } + } - if (Args.a1.emoji == x_emoji && Args.b1.emoji == x_emoji && Args.c1.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a2.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c2.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a3.emoji == x_emoji && Args.b3.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a1.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a3.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c1.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a1.emoji == x_emoji && Args.a2.emoji == x_emoji && Args.a3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.b1.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.b3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.c1.emoji == x_emoji && Args.c2.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (won["<:X_:863314044781723668>"] != false) - if (Args.user == 0) { + if (Args.a1.emoji === xEmoji && Args.b1.emoji === xEmoji && Args.c1.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a2.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c2.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a3.emoji === xEmoji && Args.b3.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a1.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a3.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c1.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a1.emoji === xEmoji && Args.a2.emoji === xEmoji && Args.a3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.b1.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.b3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.c1.emoji === xEmoji && Args.c2.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (won["<:X_:863314044781723668>"] !== false) { + if (Args.user === 0) { const won = await client.users.fetch(fighters[1]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); - } else if (Args.user == 1) { + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } + } else if (Args.user === 1) { const won = await client.users.fetch(fighters[0]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } } + } m.edit({ content: `<@${Args.userid}>`, @@ -437,7 +442,7 @@ async function tictactoe(interaction, options = {}) { epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`, + emoji: Args.user === 0 ? `${client.emojis.cache.get(oEmoji) || "⭕"}` : `${client.emojis.cache.get(xEmoji) || "❌"}`, }), ), ], @@ -458,18 +463,18 @@ async function tictactoe(interaction, options = {}) { ttt(m); } else { - if (Args.user == 0) { + if (Args.user === 0) { Args.user = 1; Args[b.customId] = { style: ButtonStyle.Success, - emoji: o_emoji, + emoji: oEmoji, disabled: true, }; } else { Args.user = 0; Args[b.customId] = { style: ButtonStyle.Danger, - emoji: x_emoji, + emoji: xEmoji, disabled: true, }; } @@ -487,49 +492,49 @@ async function tictactoe(interaction, options = {}) { .filter(key => predicate(obj[key])) .reduce((res, key) => ((res[key] = obj[key]), res), {}); const Brgs = objectFilter( - map(Args, (_, fruit) => fruit.emoji == dashmoji), - num => num == true, + map(Args, (_, fruit) => fruit.emoji === dashmoji), + num => num === true, ); - if (Object.keys(Brgs).length == 0) { - if (Args.a1.emoji == o_emoji && Args.b1.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a2.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c2.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b3.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.a2.emoji == o_emoji && Args.a3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.b1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.b3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.c1.emoji == o_emoji && Args.c2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Object.keys(Brgs).length === 0) { + if (Args.a1.emoji === oEmoji && Args.b1.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a2.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c2.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b3.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.a2.emoji === oEmoji && Args.a3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.b1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.b3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.c1.emoji === oEmoji && Args.c2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (won["<:O_:863314110560993340>"] == true) return ttt(m); - else if (won["<:X_:863314044781723668>"] == true) return; + if (won["<:O_:863314110560993340>"] === true) return ttt(m); + else if (won["<:X_:863314044781723668>"] === true) return; else { ttt(m); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:TIE"), - embeds: [epm.setDescription(interaction.translate("fun/tictactoe:TIE_DESC"))], - }); - else + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:TIE"), + embeds: [epm.setDescription(interaction.translate("fun/tictactoe:TIE_DESC"))], + }); + } else { return m .edit({ content: interaction.translate("fun/tictactoe:TIE"), embeds: [ epm.setDescription( - `${interaction.translate("fun/tictactoe:TIE_DESC")}!\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.a3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.b3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.c3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + `${interaction.translate("fun/tictactoe:TIE_DESC")}!\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.a3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.b3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.c3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), ), ], components: [], }) .catch(() => {}); + } } } @@ -537,20 +542,21 @@ async function tictactoe(interaction, options = {}) { } }); collector.on("end", (collected, reason) => { - if (collected.size === 0 && reason == "time") + if (collected.size === 0 && reason === "time") { m.edit({ content: interaction.translate("fun/tictactoe:NO_ANSWER", { user: Args.userid, }), components: [], }); + } }); } } }); collector.on("end", (_, reason) => { - if (reason == "time") { + if (reason === "time") { const embed = client.embed({ author: { name: user.getUsername(), @@ -570,7 +576,7 @@ async function tictactoe(interaction, options = {}) { components: [], }); } - if (reason == "decline") { + if (reason === "decline") { const embed = client.embed({ author: { name: user.getUsername(), @@ -594,6 +600,4 @@ async function tictactoe(interaction, options = {}) { console.log("TicTacToe errored:", e); } }); -} - -module.exports = tictactoe; +}; diff --git a/index.js b/index.js index a38734d5..cbab0c0a 100644 --- a/index.js +++ b/index.js @@ -1,29 +1,70 @@ -require("./helpers/extenders"); +// import "./helpers/extenders.js"; -const { GatewayIntentBits } = require("discord.js"), - Client = require("./base/Client"); +// import { GatewayIntentBits } from "discord.js"; +// import JaBaClient from "./base/Client.js"; +// import languages from "./helpers/languages.js"; -const client = new Client({ - intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildModeration, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions ], +import { GatewayIntentBits } from "discord.js"; +import { ExtendedClient } from "./base/newClient.js"; + +export const client = new ExtendedClient({ + intents: [ + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildModeration, + GatewayIntentBits.GuildEmojisAndStickers, + GatewayIntentBits.GuildIntegrations, + GatewayIntentBits.GuildInvites, + GatewayIntentBits.GuildVoiceStates, + GatewayIntentBits.GuildPresences, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.GuildMessageReactions, + GatewayIntentBits.GuildMessageTyping, + GatewayIntentBits.MessageContent, + GatewayIntentBits.DirectMessageTyping, + GatewayIntentBits.DirectMessages, + GatewayIntentBits.DirectMessageReactions, + ], allowedMentions: { parse: ["everyone", "roles", "users"] }, }); -(async () => { - console.time("botReady"); +client.init(); - client.translations = await require("./helpers/languages")(); +// const client = new JaBaClient({ +// intents: [ +// GatewayIntentBits.Guilds, +// GatewayIntentBits.GuildMembers, +// GatewayIntentBits.GuildModeration, +// GatewayIntentBits.GuildEmojisAndStickers, +// GatewayIntentBits.GuildIntegrations, +// GatewayIntentBits.GuildInvites, +// GatewayIntentBits.GuildVoiceStates, +// GatewayIntentBits.GuildPresences, +// GatewayIntentBits.GuildMessages, +// GatewayIntentBits.GuildMessageReactions, +// GatewayIntentBits.GuildMessageTyping, +// GatewayIntentBits.MessageContent, +// GatewayIntentBits.DirectMessageTyping, +// GatewayIntentBits.DirectMessages, +// GatewayIntentBits.DirectMessageReactions, +// ], +// allowedMentions: { parse: ["everyone", "roles", "users"] }, +// }); - await client.loadEvents("../events"); - await client.loadCommands("../commands"); - await client.init(); -})(); +// (async () => { +// console.time("botReady"); -client - .on("disconnect", () => client.logger.warn("Bot disconnected.")) - .on("reconnecting", () => client.logger.warn("Bot reconnecting...")) - .on("warn", console.log) - .on("error", console.log); +// client.translations = await languages(); -process - .on("unhandledRejection", e => console.log(e)) - .on("uncaughtException", e => console.log(e)); \ No newline at end of file +// await client.loadEvents("../events"); +// await client.loadCommands("../commands"); +// await client.init(); +// })(); + +// client +// .on("disconnect", () => client.logger.warn("Bot disconnected.")) +// .on("reconnecting", () => client.logger.warn("Bot reconnecting...")) +// .on("warn", console.log) +// .on("error", console.log); + +// process.on("unhandledRejection", e => console.log(e)).on("uncaughtException", e => console.log(e)); diff --git a/languages/en-US/administration/config.json b/languages/en-US/administration/config.json index ec9ec653..29fc99cf 100644 --- a/languages/en-US/administration/config.json +++ b/languages/en-US/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Automatic Sanctions", "BAN_CONTENT": "Ban: After **{{count}}** warnings", "BAN_NOT_DEFINED": "Ban: Not set", - "DASHBOARD_TITLE": "Modify Settings", - "DASHBOARD_CONTENT": "Click here to go to the dashboard", "GOODBYE_TITLE": "Farewell", "GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}", "KICK_CONTENT": "Kick: After **{{count}}** warnings", diff --git a/languages/en-US/dashboard.json b/languages/en-US/dashboard.json deleted file mode 100644 index 315050aa..00000000 --- a/languages/en-US/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "English", - "index": { - "feeds": [ "Current User", "Playing music in this much servers", "Users Count", "Servers Count" ], - "card": { - "category": "JaBa Bot", - "title": "Simple bot made by Jonny_Bro", - "description": "Upper Text", - "image": "", - "footer": "Bottom Text" - }, - "feedsTitle": "Feeds", - "graphTitle": "Graphs" - }, - "manage": { - "settings": { - "memberCount": "Members", - "info": { - "info": "Info", - "server": "Server Information" - } - } - }, - "privacyPolicy": { - "title": "Privacy Policy", - "description": "Privacy Policy and Terms of Service", - "pp": "Complete Privacy Policy" - }, - "partials": { - "sidebar": { - "dash": "Dashboard", - "manage": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin", - "account": "Account Pages", - "login": "Sign In", - "logout": "Sign Out" - }, - "navbar": { - "home": "Home", - "pages": { - "manage": "Manage Guilds", - "settings": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin Panel", - "error": "Error", - "credits": "Credits", - "debug": "Debug", - "leaderboard": "Leaderboard", - "profile": "Profile", - "maintenance": "Under Maintenance" - } - }, - "title": { - "pages": { - "manage": "Manage Guilds", - "settings": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin Panel", - "error": "Error", - "credits": "Credits", - "debug": "Debug", - "leaderboard": "Leaderboard", - "profile": "Profile", - "maintenance": "Under Maintenance" - } - }, - "notify": { - "errors": { - "settingsSave": "Failed to save setttings" - }, - "success": { - "settingsSave": "Successfully saved setttings.", - "login": "Successfully logged in.", - "logout": "Successfully logged out." - } - }, - "preloader": { - "text": "Page is loading..." - }, - "premium": { - "title": "Want more from JaBa?", - "description": "Check out premium features below!", - "buttonText": "Become Premium" - }, - "settings": { - "title": "Site Configuration", - "description": "Configurable Viewing Options", - "theme": { - "title": "Site Theme", - "description": "Make the site more appealing for your eyes!" - }, - "language": { - "title": "Site Language", - "description": "Select your preffered language!" - } - } - } -} \ No newline at end of file diff --git a/languages/en-US/misc.json b/languages/en-US/misc.json index ed6d5cd7..baa94e62 100644 --- a/languages/en-US/misc.json +++ b/languages/en-US/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Please specify an integer greater than 0 or `all`.", "OWNER_ONLY": "Only the bot owner can use this command.", "SELECT_CANCELED": "Selection canceled.", - "STATS_FOOTER": "● [Dashboard]({{dashboardLink}})\n● [Support Server]({{supportLink}})\n● [Invite JaBa to Your Server]({{inviteLink}})", + "STATS_FOOTER": "● [Support Server]({{supportLink}})\n● [Invite JaBa to Your Server]({{inviteLink}})", "TIMED_OUT": "Time out.", "JUMP_TO_PAGE": "Specify the page you want to jump to (maximum **{{length}}**):", "QUOTE_TITLE": "Message from {{user}}", diff --git a/languages/language-meta.js b/languages/language-meta.js new file mode 100644 index 00000000..cc409b36 --- /dev/null +++ b/languages/language-meta.js @@ -0,0 +1,23 @@ +export default [ + { + name: "en-US", + nativeName: "English", + moment: "en", + defaultMomentFormat: "HH:mm:ss, MMMM Do YYYY", + default: true, + }, + { + name: "ru-RU", + nativeName: "Русский", + moment: "ru", + defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + default: false, + }, + { + name: "uk-UA", + nativeName: "Українська", + moment: "uk", + defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + default: false, + }, +]; diff --git a/languages/language-meta.json b/languages/language-meta.json deleted file mode 100644 index ae102d46..00000000 --- a/languages/language-meta.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "name": "en-US", - "nativeName": "English", - "moment": "en", - "defaultMomentFormat": "HH:mm:ss, MMMM Do YYYY", - "default": true - }, - { - "name": "ru-RU", - "nativeName": "Русский", - "moment": "ru", - "defaultMomentFormat": "HH:mm:ss, Do MMMM YYYY", - "default": false - }, - { - "name": "uk-UA", - "nativeName": "Українська", - "moment": "uk", - "defaultMomentFormat": "HH:mm:ss, Do MMMM YYYY", - "default": false - } -] \ No newline at end of file diff --git a/languages/ru-RU/administration/config.json b/languages/ru-RU/administration/config.json index 277325d3..eb229e73 100644 --- a/languages/ru-RU/administration/config.json +++ b/languages/ru-RU/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Автоматические наказания", "BAN_CONTENT": "Бан: После **{{count}}** предупреждений", "BAN_NOT_DEFINED": "Бан: Не назначено", - "DASHBOARD_TITLE": "Изменить настройки", - "DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления", "GOODBYE_TITLE": "Прощание", "GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}", "KICK_CONTENT": "Кик: После **{{count}}** предупреждений", diff --git a/languages/ru-RU/dashboard.json b/languages/ru-RU/dashboard.json deleted file mode 100644 index c60a4107..00000000 --- a/languages/ru-RU/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "Русский", - "index": { - "feeds": [ "Текущий пользователь", "Играю музыку в стольких серверах", "Кол-во пользователей", "Кол-во серверов" ], - "card": { - "category": "JaBa Bot", - "title": "Простой бот, созданный Jonny_Bro", - "description": "Верхний текст", - "image": "", - "footer": "Нижний текст" - }, - "feedsTitle": "Новости", - "graphTitle": "Графики" - }, - "manage": { - "settings": { - "memberCount": "Участники", - "info": { - "info": "Информация", - "server": "Информация о сервере" - } - } - }, - "privacyPolicy": { - "title": "Политика конф.", - "description": "Политика конфиденциальности и Условия использования", - "pp": "Полная политика конфиденциальности" - }, - "partials": { - "sidebar": { - "dash": "Панель управления", - "manage": "Сервера", - "commands": "Команды", - "pp": "Политика конф.", - "admin": "Админ панель", - "account": "Аккаунт", - "login": "Войти", - "logout": "Выйти" - }, - "navbar": { - "home": "Главная", - "pages": { - "manage": "Настройки серверов", - "settings": "Настройки", - "commands": "Команды", - "pp": "Политика конфиденциальности", - "admin": "Админ панель", - "error": "Ошибка", - "credits": "Разработчики панели", - "debug": "Отладка", - "leaderboard": "Таблица лидеров", - "profile": "Профиль", - "maintenance": "Техобслуживание" - } - }, - "title": { - "pages": { - "manage": "Настройки серверов", - "settings": "Настройки", - "commands": "Команды", - "pp": "Политика конфиденциальности", - "admin": "Админ панель", - "error": "Ошибка", - "credits": "Разработчики панели", - "debug": "Отладка", - "leaderboard": "Таблица лидеров", - "profile": "Профиль", - "maintenance": "Техобслуживание" - } - }, - "notify": { - "errors": { - "settingsSave": "Произошла ошибка при сохранении настроек." - }, - "success": { - "settingsSave": "Настройки успешно сохранены.", - "login": "Вход успешно выполнен.", - "logout": "Выход успешно выполнен." - } - }, - "preloader": { - "text": "Загрузка..." - }, - "premium": { - "title": "Хотите большего JaBa?", - "description": "Проверьте Премиум функции!", - "buttonText": "Стать Премиум" - }, - "settings": { - "title": "Настройки сайта", - "description": "Настройте параметры панели управления", - "theme": { - "title": "Тема", - "description": "У нас есть тёмная и светлая!" - }, - "language": { - "title": "Язык", - "description": "Выберите предпочитаемый язык!" - } - } - } -} \ No newline at end of file diff --git a/languages/ru-RU/misc.json b/languages/ru-RU/misc.json index 307c3184..693cbda8 100644 --- a/languages/ru-RU/misc.json +++ b/languages/ru-RU/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Укажите целое число больше 0 или `all`", "OWNER_ONLY": "Данную команду может использовать только владелец бота", "SELECT_CANCELED": "Выбор отменён", - "STATS_FOOTER": "● [Панель управления]({{dashboardLink}})\n● [Сервер поддержки]({{supportLink}})\n● [Пригласить JaBa на свой сервер]({{inviteLink}})", + "STATS_FOOTER": "● [Сервер поддержки]({{supportLink}})\n● [Пригласить JaBa на свой сервер]({{inviteLink}})", "TIMED_OUT": "Время вышло", "JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):", "QUOTE_TITLE": "Сообщение от {{user}}", diff --git a/languages/uk-UA/administration/config.json b/languages/uk-UA/administration/config.json index 23667af3..63c4c186 100644 --- a/languages/uk-UA/administration/config.json +++ b/languages/uk-UA/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Автоматичні покарання", "BAN_CONTENT": "Бан: Після **{{count}}** попереджень", "BAN_NOT_DEFINED": "Бан: Не призначено", - "DASHBOARD_TITLE": "Змінити налаштування", - "DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування", "GOODBYE_TITLE": "Прощання", "GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}", "KICK_CONTENT": "Кік: Після **{{count}}** попереджень", diff --git a/languages/uk-UA/dashboard.json b/languages/uk-UA/dashboard.json deleted file mode 100644 index 6141e871..00000000 --- a/languages/uk-UA/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "Українська", - "index": { - "feeds": [ "Поточний Користувач", "Играю музыку в стольких серверах", "Кількість користувачів", "Кількість серверів" ], - "card": { - "category": "JaBa Бот", - "title": "Простий бот, створений Jonny_Bro", - "description": "Верхній Текст", - "image": "", - "footer": "Нижній Текст" - }, - "feedsTitle": "Канали", - "graphTitle": "Графіки" - }, - "manage": { - "settings": { - "memberCount": "Учасники", - "info": { - "info": "Інформація", - "server": "Інформація про Сервер" - } - } - }, - "privacyPolicy": { - "title": "Політика Конфіденційності", - "description": "Політика Конфіденційності та Умови Сервісу", - "pp": "Повна Політика Конфіденційності" - }, - "partials": { - "sidebar": { - "dash": "Панель Керування", - "manage": "Налаштування серверів", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Адмін", - "account": "Сторінки Аккаунта", - "login": "Увійти", - "logout": "Вийти" - }, - "navbar": { - "home": "Головна", - "pages": { - "manage": "Налаштування серверів", - "settings": "Керувати", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Панель Адміністратора", - "error": "Помилка", - "credits": "Автори", - "debug": "Налагодження", - "leaderboard": "Таблиця Лідерів", - "profile": "Профіль", - "maintenance": "Технічне Обслуговування" - } - }, - "title": { - "pages": { - "manage": "Керувати Гілдіями", - "settings": "Керувати", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Панель Адміністратора", - "error": "Помилка", - "credits": "Автори", - "debug": "Налагодження", - "leaderboard": "Таблиця Лідерів", - "profile": "Профіль", - "maintenance": "Технічне Обслуговування" - } - }, - "notify": { - "errors": { - "settingsSave": "Сталася помилка при збереженні налаштувань." - }, - "success": { - "settingsSave": "Налаштування успішно збережені.", - "login": "Успішний вхід.", - "logout": "Успішний вихід." - } - }, - "preloader": { - "text": "Завантаження..." - }, - "premium": { - "title": "Бажаєте більше від JaBa?", - "description": "Ознайомтесь з преміум-функціями нижче!", - "buttonText": "Стати Преміум" - }, - "settings": { - "title": "Налаштування Сайту", - "description": "Налаштовувані параметри перегляду", - "theme": { - "title": "Тема", - "description": "Зробіть сайт більш привабливим для своїх очей!" - }, - "language": { - "title": "Мова", - "description": "Виберіть бажану мову!" - } - } - } -} \ No newline at end of file diff --git a/languages/uk-UA/misc.json b/languages/uk-UA/misc.json index d5ffcdc1..383b642b 100644 --- a/languages/uk-UA/misc.json +++ b/languages/uk-UA/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Вкажіть ціле число більше 0 або `all`", "OWNER_ONLY": "Цю команду може використовувати тільки власник бота", "SELECT_CANCELED": "Вибір скасовано", - "STATS_FOOTER": "● [Панель керування]({{dashboardLink}})\n● [Сервер підтримки]({{supportLink}})\n● [Запросити JaBa на свій сервер]({{inviteLink}})", + "STATS_FOOTER": "● [Сервер підтримки]({{supportLink}})\n● [Запросити JaBa на свій сервер]({{inviteLink}})", "TIMED_OUT": "Час вийшов", "JUMP_TO_PAGE": "Вкажіть сторінку, до якої хочете перейти (максимум **{{length}}**):", "QUOTE_TITLE": "Повідомлення від {{user}}", diff --git a/newCommands/Fun/8ball.js b/newCommands/Fun/8ball.js new file mode 100644 index 00000000..7600c06c --- /dev/null +++ b/newCommands/Fun/8ball.js @@ -0,0 +1,8 @@ +export const data = { + name: "8ball", + description: "8ball", +}; + +export const run = () => { + console.log("8ball"); +}; diff --git a/newEvents/ready.js b/newEvents/ready.js new file mode 100644 index 00000000..0f698b5d --- /dev/null +++ b/newEvents/ready.js @@ -0,0 +1,14 @@ +import logger from "../helpers/logger.js"; + +export const data = { + name: "ready", + once: true, +}; + +/** + * + * @param {import("../base/Client.JaBaClient")} client + */ +export async function run(client) { + logger.log(client.user.tag + " is online!"); +} diff --git a/package.json b/package.json index b1e79467..f69dbec3 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "4.6.7", "description": "My Discord Bot", "main": "index.js", + "type": "module", "scripts": { "start": "node ." }, @@ -30,93 +31,11 @@ "node-fetch": "^2.7.0" }, "devDependencies": { - "eslint": "^8.57.1" - }, - "eslintConfig": { - "extends": "eslint:recommended", - "env": { - "commonjs": true, - "es6": true, - "es2020": true, - "node": true - }, - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2020 - }, - "rules": { - "arrow-spacing": [ - "warn", - { - "before": true, - "after": true - } - ], - "comma-dangle": [ - "error", - "always-multiline" - ], - "comma-spacing": "error", - "comma-style": "error", - "dot-location": [ - "error", - "property" - ], - "handle-callback-err": "off", - "indent": [ - "error", - "tab", - { - "SwitchCase": 1 - } - ], - "keyword-spacing": "error", - "max-nested-callbacks": [ - "error", - { - "max": 4 - } - ], - "max-statements-per-line": [ - "error", - { - "max": 2 - } - ], - "no-console": "off", - "no-multi-spaces": "error", - "no-multiple-empty-lines": [ - "error", - { - "max": 2, - "maxEOF": 1, - "maxBOF": 0 - } - ], - "no-trailing-spaces": [ - "error" - ], - "no-var": "error", - "object-curly-spacing": [ - "error", - "always" - ], - "prefer-const": "error", - "quotes": [ - "error", - "double" - ], - "semi": [ - "error", - "always" - ], - "space-in-parens": "error", - "space-infix-ops": "error", - "space-unary-ops": "error", - "yoda": "error" - } + "@eslint/js": "^9.16.0", + "@stylistic/eslint-plugin-js": "^2.11.0", + "eslint": "^9.16.0", + "globals": "^15.13.0", + "prettier": "^3.4.2", + "prettier-eslint": "^16.3.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 260d182c..c6b4d075 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: version: 5.1.4 i18next: specifier: ^24.0.0 - version: 24.0.0 + version: 24.0.0(typescript@5.7.2) i18next-fs-backend: specifier: ^2.6.0 version: 2.6.0 @@ -69,9 +69,24 @@ importers: specifier: ^2.7.0 version: 2.7.0 devDependencies: + '@eslint/js': + specifier: ^9.16.0 + version: 9.16.0 + '@stylistic/eslint-plugin-js': + specifier: ^2.11.0 + version: 2.11.0(eslint@9.16.0) eslint: - specifier: ^8.57.1 - version: 8.57.1 + specifier: ^9.16.0 + version: 9.16.0 + globals: + specifier: ^15.13.0 + version: 15.13.0 + prettier: + specifier: ^3.4.2 + version: 3.4.2 + prettier-eslint: + specifier: ^16.3.0 + version: 16.3.0 packages: @@ -143,22 +158,54 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.11.0': - resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/config-array@0.19.1': + resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/core@0.9.1': + resolution: {integrity: sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/eslintrc@2.1.4': resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/eslintrc@3.2.0': + resolution: {integrity: sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/js@8.57.1': resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/js@9.16.0': + resolution: {integrity: sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/object-schema@2.1.5': + resolution: {integrity: sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/plugin-kit@0.2.4': + resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@fastify/busboy@2.1.1': resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} engines: {node: '>=14'} + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} @@ -172,6 +219,18 @@ packages: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} deprecated: Use @eslint/object-schema instead + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@humanwhocodes/retry@0.4.1': + resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} + engines: {node: '>=18.18'} + + '@jest/schemas@29.6.3': + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + '@mongodb-js/saslprep@1.1.9': resolution: {integrity: sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==} @@ -263,10 +322,19 @@ packages: resolution: {integrity: sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==} engines: {node: '>=v14.0.0', npm: '>=7.0.0'} + '@sinclair/typebox@0.27.8': + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@sindresorhus/is@5.6.0': resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==} engines: {node: '>=14.16'} + '@stylistic/eslint-plugin-js@2.11.0': + resolution: {integrity: sha512-btchD0P3iij6cIk5RR5QMdEhtCCV0+L6cNheGhGCd//jaHILZMTi/EOqgEDAf1s4ZoViyExoToM+S2Iwa3U9DA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + '@szmarczak/http-timer@5.0.1': resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} engines: {node: '>=14.16'} @@ -274,9 +342,15 @@ packages: '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/http-cache-semantics@4.0.4': resolution: {integrity: sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==} + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/luxon@3.4.2': resolution: {integrity: sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA==} @@ -292,6 +366,37 @@ packages: '@types/ws@8.5.12': resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + '@typescript-eslint/parser@6.21.0': + resolution: {integrity: sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/scope-manager@6.21.0': + resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} + engines: {node: ^16.0.0 || >=18.0.0} + + '@typescript-eslint/types@6.21.0': + resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} + engines: {node: ^16.0.0 || >=18.0.0} + + '@typescript-eslint/typescript-estree@6.21.0': + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/visitor-keys@6.21.0': + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} + engines: {node: ^16.0.0 || >=18.0.0} + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -316,6 +421,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} + engines: {node: '>=0.4.0'} + hasBin: true + agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} @@ -323,14 +433,26 @@ packages: ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + ansi-regex@2.1.1: + resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} + engines: {node: '>=0.10.0'} + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + ansi-styles@2.2.1: + resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} + engines: {node: '>=0.10.0'} + ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -345,6 +467,10 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -357,6 +483,13 @@ packages: brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + bson@6.9.0: resolution: {integrity: sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig==} engines: {node: '>=16.20.1'} @@ -373,6 +506,10 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + chalk@1.1.3: + resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==} + engines: {node: '>=0.10.0'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -406,6 +543,10 @@ packages: resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} engines: {node: '>= 6'} + common-tags@1.8.2: + resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} + engines: {node: '>=4.0.0'} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -418,8 +559,8 @@ packages: cron@3.2.1: resolution: {integrity: sha512-w2n5l49GMmmkBFEsH9FIDhjZ1n1QgTMOCMGuQtOXs5veNiosZmso6bQGuqOJSYAXXrG84WQFVneNk+Yt0Ua9iw==} - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} crypt@0.0.2: @@ -467,6 +608,10 @@ packages: resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} engines: {node: '>=8'} + dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + discord-api-types@0.37.100: resolution: {integrity: sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==} @@ -502,6 +647,9 @@ packages: resolution: {integrity: sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==} engines: {node: '>=18'} + dlv@1.1.3: + resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} + doctrine@3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -526,6 +674,10 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -534,15 +686,38 @@ packages: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.2.0: + resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@8.57.1: resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true + eslint@9.16.0: + resolution: {integrity: sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -570,6 +745,10 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -587,10 +766,18 @@ packages: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + file-type@16.5.4: resolution: {integrity: sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==} engines: {node: '>=10'} + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -599,6 +786,10 @@ packages: resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} @@ -638,6 +829,10 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -650,6 +845,18 @@ packages: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + + globals@15.13.0: + resolution: {integrity: sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==} + engines: {node: '>=18'} + + globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + got@13.0.0: resolution: {integrity: sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==} engines: {node: '>=16'} @@ -657,6 +864,10 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + has-ansi@2.0.0: + resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} + engines: {node: '>=0.10.0'} + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -715,6 +926,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. @@ -741,6 +956,10 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} @@ -806,6 +1025,13 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + loglevel-colored-level-prefix@1.0.0: + resolution: {integrity: sha512-u45Wcxxc+SdAlh4yeF/uKlC1SPUPCy0gullSNKXod5I4bmifzk+Q4lSLExNEVn19tGaJipbZ4V4jbFn79/6mVA==} + + loglevel@1.9.2: + resolution: {integrity: sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==} + engines: {node: '>= 0.6.0'} + long@5.2.3: resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} @@ -830,6 +1056,14 @@ packages: memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} @@ -841,6 +1075,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -996,14 +1234,43 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + peek-readable@4.1.0: resolution: {integrity: sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==} engines: {node: '>=8'} + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-eslint@16.3.0: + resolution: {integrity: sha512-Lh102TIFCr11PJKUMQ2kwNmxGhTsv/KzUg9QYF2Gkw259g/kPgndZDWavk7/ycbRvj2oz4BPZ1gCU8bhfZH/Xg==} + engines: {node: '>=16.10.0'} + peerDependencies: + prettier-plugin-svelte: ^3.0.0 + svelte-eslint-parser: '*' + peerDependenciesMeta: + prettier-plugin-svelte: + optional: true + svelte-eslint-parser: + optional: true + + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} + engines: {node: '>=14'} + hasBin: true + + pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + prism-media@1.3.5: resolution: {integrity: sha512-IQdl0Q01m4LrkN1EGIE9lphov5Hy7WWlH6ulf5QdGePLlPas9p2mhgddTEHrlaXYjjFToM1/rWuwF37VF4taaA==} peerDependencies: @@ -1038,6 +1305,9 @@ packages: randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + readable-stream@1.0.34: resolution: {integrity: sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==} @@ -1055,6 +1325,9 @@ packages: regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + require-relative@0.8.7: + resolution: {integrity: sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==} + resolve-alpn@1.2.1: resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} @@ -1126,6 +1399,10 @@ packages: signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + smart-buffer@4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} @@ -1167,6 +1444,10 @@ packages: string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + strip-ansi@3.0.1: + resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} + engines: {node: '>=0.10.0'} + strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -1179,6 +1460,10 @@ packages: resolution: {integrity: sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==} engines: {node: '>=10'} + supports-color@2.0.0: + resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} + engines: {node: '>=0.8.0'} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1193,6 +1478,10 @@ packages: tiny-typed-emitter@2.1.0: resolution: {integrity: sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==} + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + token-types@4.2.1: resolution: {integrity: sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==} engines: {node: '>=10'} @@ -1204,6 +1493,12 @@ packages: resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} engines: {node: '>=14'} + ts-api-utils@1.4.3: + resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + ts-mixer@6.0.4: resolution: {integrity: sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==} @@ -1218,6 +1513,11 @@ packages: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} @@ -1245,6 +1545,12 @@ packages: varint@6.0.0: resolution: {integrity: sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==} + vue-eslint-parser@9.4.3: + resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} + engines: {node: ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '>=6.0.0' + web-streams-polyfill@3.3.3: resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} engines: {node: '>= 8'} @@ -1432,7 +1738,24 @@ snapshots: eslint: 8.57.1 eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.11.0': {} + '@eslint-community/eslint-utils@4.4.0(eslint@9.16.0)': + dependencies: + eslint: 9.16.0 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/config-array@0.19.1': + dependencies: + '@eslint/object-schema': 2.1.5 + debug: 4.3.7 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/core@0.9.1': + dependencies: + '@types/json-schema': 7.0.15 '@eslint/eslintrc@2.1.4': dependencies: @@ -1448,10 +1771,39 @@ snapshots: transitivePeerDependencies: - supports-color + '@eslint/eslintrc@3.2.0': + dependencies: + ajv: 6.12.6 + debug: 4.3.7 + espree: 10.3.0 + globals: 14.0.0 + ignore: 5.3.2 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + '@eslint/js@8.57.1': {} + '@eslint/js@9.16.0': {} + + '@eslint/object-schema@2.1.5': {} + + '@eslint/plugin-kit@0.2.4': + dependencies: + levn: 0.4.1 + '@fastify/busboy@2.1.1': {} + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -1464,6 +1816,14 @@ snapshots: '@humanwhocodes/object-schema@2.0.3': {} + '@humanwhocodes/retry@0.3.1': {} + + '@humanwhocodes/retry@0.4.1': {} + + '@jest/schemas@29.6.3': + dependencies: + '@sinclair/typebox': 0.27.8 + '@mongodb-js/saslprep@1.1.9': dependencies: sparse-bitfield: 3.0.3 @@ -1532,16 +1892,28 @@ snapshots: '@sapphire/snowflake@3.5.3': {} + '@sinclair/typebox@0.27.8': {} + '@sindresorhus/is@5.6.0': {} + '@stylistic/eslint-plugin-js@2.11.0(eslint@9.16.0)': + dependencies: + eslint: 9.16.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + '@szmarczak/http-timer@5.0.1': dependencies: defer-to-connect: 2.0.1 '@tokenizer/token@0.3.0': {} + '@types/estree@1.0.6': {} + '@types/http-cache-semantics@4.0.4': {} + '@types/json-schema@7.0.15': {} + '@types/luxon@3.4.2': {} '@types/node@22.5.5': @@ -1558,6 +1930,46 @@ snapshots: dependencies: '@types/node': 22.5.5 + '@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 6.21.0 + debug: 4.3.7 + eslint: 8.57.1 + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@6.21.0': + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + + '@typescript-eslint/types@6.21.0': {} + + '@typescript-eslint/typescript-estree@6.21.0(typescript@5.7.2)': + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + debug: 4.3.7 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.3 + ts-api-utils: 1.4.3(typescript@5.7.2) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/visitor-keys@6.21.0': + dependencies: + '@typescript-eslint/types': 6.21.0 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} '@vladfrangu/async_event_emitter@2.4.6': {} @@ -1566,12 +1978,14 @@ snapshots: abbrev@1.1.1: {} - acorn-jsx@5.3.2(acorn@8.12.1): + acorn-jsx@5.3.2(acorn@8.14.0): dependencies: - acorn: 8.12.1 + acorn: 8.14.0 acorn@8.12.1: {} + acorn@8.14.0: {} + agent-base@6.0.2: dependencies: debug: 4.3.7 @@ -1585,12 +1999,18 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 + ansi-regex@2.1.1: {} + ansi-regex@5.0.1: {} + ansi-styles@2.2.1: {} + ansi-styles@4.3.0: dependencies: color-convert: 2.0.1 + ansi-styles@5.2.0: {} + any-promise@1.3.0: {} aproba@2.0.0: {} @@ -1602,6 +2022,8 @@ snapshots: argparse@2.0.1: {} + array-union@2.1.0: {} + balanced-match@1.0.2: {} barse@0.4.3: @@ -1615,6 +2037,14 @@ snapshots: balanced-match: 1.0.2 concat-map: 0.0.1 + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + bson@6.9.0: {} cacheable-lookup@7.0.0: {} @@ -1631,6 +2061,14 @@ snapshots: callsites@3.1.0: {} + chalk@1.1.3: + dependencies: + ansi-styles: 2.2.1 + escape-string-regexp: 1.0.5 + has-ansi: 2.0.0 + strip-ansi: 3.0.1 + supports-color: 2.0.0 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -1669,6 +2107,8 @@ snapshots: commander@6.2.1: {} + common-tags@1.8.2: {} + concat-map@0.0.1: {} console-control-strings@1.1.0: {} @@ -1680,7 +2120,7 @@ snapshots: '@types/luxon': 3.4.2 luxon: 3.5.0 - cross-spawn@7.0.3: + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 shebang-command: 2.0.0 @@ -1718,6 +2158,10 @@ snapshots: detect-libc@2.0.3: {} + dir-glob@3.0.1: + dependencies: + path-type: 4.0.0 + discord-api-types@0.37.100: {} discord-api-types@0.37.107: {} @@ -1790,6 +2234,8 @@ snapshots: - bufferutil - utf-8-validate + dlv@1.1.3: {} + doctrine@3.0.0: dependencies: esutils: 2.0.3 @@ -1816,6 +2262,8 @@ snapshots: entities@4.5.0: {} + escape-string-regexp@1.0.5: {} + escape-string-regexp@4.0.0: {} eslint-scope@7.2.2: @@ -1823,12 +2271,19 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 + eslint-scope@8.2.0: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + eslint-visitor-keys@3.4.3: {} + eslint-visitor-keys@4.2.0: {} + eslint@8.57.1: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.1) - '@eslint-community/regexpp': 4.11.0 + '@eslint-community/regexpp': 4.12.1 '@eslint/eslintrc': 2.1.4 '@eslint/js': 8.57.1 '@humanwhocodes/config-array': 0.13.0 @@ -1837,7 +2292,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.7 doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -1868,10 +2323,55 @@ snapshots: transitivePeerDependencies: - supports-color + eslint@9.16.0: + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.16.0) + '@eslint-community/regexpp': 4.12.1 + '@eslint/config-array': 0.19.1 + '@eslint/core': 0.9.1 + '@eslint/eslintrc': 3.2.0 + '@eslint/js': 9.16.0 + '@eslint/plugin-kit': 0.2.4 + '@humanfs/node': 0.16.6 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.1 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.3.7 + escape-string-regexp: 4.0.0 + eslint-scope: 8.2.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + esquery: 1.6.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.4 + transitivePeerDependencies: + - supports-color + + espree@10.3.0: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.2.0 + espree@9.6.1: dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) eslint-visitor-keys: 3.4.3 esquery@1.6.0: @@ -1890,6 +2390,14 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-glob@3.3.2: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} @@ -1907,12 +2415,20 @@ snapshots: dependencies: flat-cache: 3.2.0 + file-entry-cache@8.0.0: + dependencies: + flat-cache: 4.0.1 + file-type@16.5.4: dependencies: readable-web-to-node-stream: 3.0.2 strtok3: 6.3.0 token-types: 4.2.1 + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + find-up@5.0.0: dependencies: locate-path: 6.0.0 @@ -1924,6 +2440,11 @@ snapshots: keyv: 4.5.4 rimraf: 3.0.2 + flat-cache@4.0.1: + dependencies: + flatted: 3.3.1 + keyv: 4.5.4 + flatted@3.3.1: {} form-data-encoder@2.1.4: {} @@ -1976,6 +2497,10 @@ snapshots: get-stream@6.0.1: {} + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + glob-parent@6.0.2: dependencies: is-glob: 4.0.3 @@ -1993,6 +2518,19 @@ snapshots: dependencies: type-fest: 0.20.2 + globals@14.0.0: {} + + globals@15.13.0: {} + + globby@11.1.0: + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 + got@13.0.0: dependencies: '@sindresorhus/is': 5.6.0 @@ -2009,6 +2547,10 @@ snapshots: graphemer@1.4.0: {} + has-ansi@2.0.0: + dependencies: + ansi-regex: 2.1.1 + has-flag@4.0.0: {} has-unicode@2.0.1: {} @@ -2040,9 +2582,11 @@ snapshots: i18next-fs-backend@2.6.0: {} - i18next@24.0.0: + i18next@24.0.0(typescript@5.7.2): dependencies: '@babel/runtime': 7.25.6 + optionalDependencies: + typescript: 5.7.2 iconv-lite@0.6.3: dependencies: @@ -2059,6 +2603,8 @@ snapshots: imurmurhash@0.1.4: {} + indent-string@4.0.0: {} + inflight@1.0.6: dependencies: once: 1.4.0 @@ -2082,6 +2628,8 @@ snapshots: dependencies: is-extglob: 2.1.1 + is-number@7.0.0: {} + is-path-inside@3.0.3: {} isarray@0.0.1: {} @@ -2139,6 +2687,13 @@ snapshots: lodash@4.17.21: {} + loglevel-colored-level-prefix@1.0.0: + dependencies: + chalk: 1.1.3 + loglevel: 1.9.2 + + loglevel@1.9.2: {} + long@5.2.3: {} lowercase-keys@3.0.0: {} @@ -2159,6 +2714,13 @@ snapshots: memory-pager@1.5.0: {} + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + mimic-response@3.1.0: {} mimic-response@4.0.0: {} @@ -2167,6 +2729,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@9.0.3: + dependencies: + brace-expansion: 2.0.1 + minimist@1.2.8: {} minipass@3.3.6: @@ -2308,10 +2874,39 @@ snapshots: path-key@3.1.1: {} + path-type@4.0.0: {} + peek-readable@4.1.0: {} + picomatch@2.3.1: {} + prelude-ls@1.2.1: {} + prettier-eslint@16.3.0: + dependencies: + '@typescript-eslint/parser': 6.21.0(eslint@8.57.1)(typescript@5.7.2) + common-tags: 1.8.2 + dlv: 1.1.3 + eslint: 8.57.1 + indent-string: 4.0.0 + lodash.merge: 4.6.2 + loglevel-colored-level-prefix: 1.0.0 + prettier: 3.4.2 + pretty-format: 29.7.0 + require-relative: 0.8.7 + typescript: 5.7.2 + vue-eslint-parser: 9.4.3(eslint@8.57.1) + transitivePeerDependencies: + - supports-color + + prettier@3.4.2: {} + + pretty-format@29.7.0: + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.3.1 + prism-media@1.3.5(@discordjs/opus@0.9.0): optionalDependencies: '@discordjs/opus': 0.9.0 @@ -2328,6 +2923,8 @@ snapshots: dependencies: safe-buffer: 5.2.1 + react-is@18.3.1: {} + readable-stream@1.0.34: dependencies: core-util-is: 1.0.3 @@ -2357,6 +2954,8 @@ snapshots: regenerator-runtime@0.14.1: {} + require-relative@0.8.7: {} + resolve-alpn@1.2.1: {} resolve-from@4.0.0: {} @@ -2413,6 +3012,8 @@ snapshots: signal-exit@3.0.7: {} + slash@3.0.0: {} + smart-buffer@4.2.0: optional: true @@ -2461,6 +3062,10 @@ snapshots: dependencies: safe-buffer: 5.2.1 + strip-ansi@3.0.1: + dependencies: + ansi-regex: 2.1.1 + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -2472,6 +3077,8 @@ snapshots: '@tokenizer/token': 0.3.0 peek-readable: 4.1.0 + supports-color@2.0.0: {} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -2489,6 +3096,10 @@ snapshots: tiny-typed-emitter@2.1.0: {} + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + token-types@4.2.1: dependencies: '@tokenizer/token': 0.3.0 @@ -2500,6 +3111,10 @@ snapshots: dependencies: punycode: 2.3.1 + ts-api-utils@1.4.3(typescript@5.7.2): + dependencies: + typescript: 5.7.2 + ts-mixer@6.0.4: {} tslib@2.7.0: {} @@ -2510,6 +3125,8 @@ snapshots: type-fest@0.20.2: {} + typescript@5.7.2: {} + undici-types@6.19.8: {} undici@5.28.4: @@ -2530,6 +3147,19 @@ snapshots: varint@6.0.0: {} + vue-eslint-parser@9.4.3(eslint@8.57.1): + dependencies: + debug: 4.3.7 + eslint: 8.57.1 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.6.0 + lodash: 4.17.21 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + web-streams-polyfill@3.3.3: {} webidl-conversions@3.0.1: {} diff --git a/utils/get-path.js b/utils/get-path.js new file mode 100644 index 00000000..800ce749 --- /dev/null +++ b/utils/get-path.js @@ -0,0 +1,24 @@ +import fs from "node:fs/promises"; +import path from "node:path"; + +export const getFilePaths = async (directory, nesting) => { + let filePaths = []; + + if (!directory) return; + + const files = await fs.readdir(directory, { withFileTypes: true }); + + for (const file of files) { + const filePath = path.join(directory, file.name); + + if (file.isFile()) { + filePaths.push(filePath); + } + + if (nesting && file.isDirectory()) { + filePaths = [...filePaths, ...(await getFilePaths(filePath, true))]; + } + } + + return filePaths; +}; diff --git a/utils/resolve-file.js b/utils/resolve-file.js new file mode 100644 index 00000000..58264449 --- /dev/null +++ b/utils/resolve-file.js @@ -0,0 +1,11 @@ +import path from "node:path"; + +/** + * Convert a local file path to a file URL. + * @param {string} filePath - local file's path. + * @returns {string} file URL + */ +export const toFileURL = filePath => { + const resolvedPath = path.resolve(filePath); + return "file://" + resolvedPath.replace(/\\\\|\\/g, "/"); +};