diff --git a/.gitignore b/.gitignore index 2b86767f..d4bb0e3d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ Thumbs.db # Bot Configuration -/config.js +/config.json # DB /giveaways.json 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 7c6f0eb0..d1e4303d 100644 --- a/README.md +++ b/README.md @@ -57,6 +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. ## License diff --git a/base/Guild.js b/base/Guild.js deleted file mode 100644 index 634cfdd9..00000000 --- a/base/Guild.js +++ /dev/null @@ -1,55 +0,0 @@ -const mongoose = require("mongoose"), - Schema = mongoose.Schema, - languages = require("../languages/language-meta.json"); - -module.exports = mongoose.model("Guild", new Schema({ - id: { type: String }, - - 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, - }, - 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 deleted file mode 100644 index d494f72c..00000000 --- a/base/Member.js +++ /dev/null @@ -1,33 +0,0 @@ -const mongoose = require("mongoose"); - -module.exports = mongoose.model("Member", new mongoose.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: [] }, - - registeredAt: { type: Number, default: Date.now() }, - - cooldowns: { - type: Object, - default: { - work: 0, - rob: 0, - }, - }, - - sanctions: { type: Array, default: [] }, - mute: { - type: Object, - default: { - muted: false, - case: null, - endDate: null, - }, - }, -})); diff --git a/config.sample.js b/config.sample.js deleted file mode 100644 index 4102afe6..00000000 --- a/config.sample.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = { - /* The token of your Discord Bot */ - token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", - /* UserID of your Discord Bot */ - userId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", - /* The URL of the MongoDB database */ - mongoDB: "mongodb://127.0.0.1:27017/discordbot", - /* Set to true for production */ - /* If set to false, commands only will be registered on the support.id server */ - production: true, - /* Spotify */ - spotify: { - clientId: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", - clientSecret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", - }, - /* YouTube Cookie */ - youtubeCookie: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", - /* Support server */ - support: { - id: "123456789098765432", // The ID of the support server - logs: "123456789098765432", // The channel's ID for logs on the support server (when bot joins or leaves a guild) - invite: "https://discord.gg/discord", // Invite link to the support server - }, - /* Embeds defaults */ - embed: { - color: "#00FF00", // Color - footer: { - text: "My Discord Bot | v" + require("./package.json").version, // Footer text - }, - }, - /* Bot's owner informations */ - owner: { - 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 */, - }, -}; diff --git a/config.sample.json b/config.sample.json new file mode 100644 index 00000000..46c97555 --- /dev/null +++ b/config.sample.json @@ -0,0 +1,32 @@ +{ + "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "userId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "mongoDB": "mongodb://127.0.0.1:27017/discordbot", + "production": true, + "spotify": { + "clientId": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "clientSecret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX" + }, + "youtubeCookie": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "support": { + "id": "123456789098765432", + "logs": "123456789098765432", + "invite": "https://discord.gg/discord" + }, + "embed": { + "color": "#00FF00", + "footer": { + "text": "My Discord Bot | v1.0.0" + } + }, + "owner": { + "id": "123456789098765432" + }, + "apiKeys": {}, + "paths": { + "commands": "./src/commands", + "events": "./src/events", + "locales": "./src/services/languages/locales" + }, + "defaultLang": "en-US" +} \ No newline at end of file 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/helpers/functions.js b/helpers/functions.js deleted file mode 100644 index 923885cc..00000000 --- a/helpers/functions.js +++ /dev/null @@ -1,147 +0,0 @@ -const moment = require("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); - }); - - 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; - }); - }, - - /** - * 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 = []; - - pArray.forEach(element => array.push(element)); - - let currentIndex = array.length, - temporaryValue, - randomIndex; - - while (currentIndex !== 0) { - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; - - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } - - 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. - */ - 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. - */ - 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; - }, -}; diff --git a/helpers/logger.js b/helpers/logger.js deleted file mode 100644 index 86f02925..00000000 --- a/helpers/logger.js +++ /dev/null @@ -1,52 +0,0 @@ -const { bgBlue, black, green } = require("chalk"); - -function dateTimePad(value, digits) { - let number = value; - while (number.toString().length < digits) number = "0" + number; - - return number; -} - -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) - ); -} - -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}`); - } -}; diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js deleted file mode 100644 index a7c44a33..00000000 --- a/helpers/tictactoe.js +++ /dev/null @@ -1,599 +0,0 @@ -// Thanks to simply-djs for this =) -// TODO: Refactor this please... - -const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require("discord.js"); - -/** - * @param {import("discord.js").ChatInputCommandInteraction} interaction - * @param {any[]} options Array with options (everything is optional) - * @param {string} options.userSlash Name of the user option in the interaction - * @param {string} options.embedFooter Game's embed footer - * @param {string} options.embedColor Game's embed color - * @param {string} options.timeoutEmbedColor Game's embed timeout color - * @param {string} options.xEmoji Emoji for X - * @param {string} options.oEmoji Emoji for O - * @param {string} options.idleEmoji Emoji for "nothing" - * @returns {Promise} - */ -async function tictactoe(interaction, options = {}) { - // eslint-disable-next-line no-async-promise-executor - return new Promise(async resolve => { - try { - const { client } = interaction; - let opponent; - - if (interaction.commandId) { - opponent = interaction.options.getUser(options.userSlash || "user"); - - if (!opponent) - return interaction.reply({ - content: interaction.translate("fun/tictactoe:NO_USER"), - ephemeral: true, - }); - - 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) - return interaction.reply({ - content: interaction.translate("misc:CANT_YOURSELF"), - ephemeral: true, - }); - } else if (!interaction.commandId) { - opponent = interaction.mentions.members.first()?.user; - - if (!opponent) - return interaction.reply({ - content: interaction.translate("fun/tictactoe:NO_USER"), - }); - - if (opponent.bot) - return interaction.reply({ - content: interaction.translate("fun/tictactoe:BOT_USER"), - ephemeral: true, - }); - - if (opponent.id === interaction.member.id) - return interaction.reply({ - content: interaction.translate("misc:CANT_YOURSELF"), - }); - } - - const footer = options.embedFooter || client.config.embed.footer, - color = options.embedColor || client.config.embed.color, - user = interaction.user ? interaction.user : interaction.author; - - const acceptEmbed = client.embed({ - author: { - name: user.getUsername(), - iconURL: user.displayAvatarURL(), - }, - title: interaction.translate("fun/tictactoe:REQUEST_WAIT", { - user: opponent.getUsername(), - }), - color, - footer, - }); - - const accept = new ButtonBuilder().setLabel(interaction.translate("common:ACCEPT")).setStyle(ButtonStyle.Success).setCustomId("acceptttt"); - const decline = new ButtonBuilder().setLabel(interaction.translate("common:DECLINE")).setStyle(ButtonStyle.Danger).setCustomId("declinettt"); - const accep = new ActionRowBuilder().addComponents([accept, decline]); - - const m = await interaction.reply({ - content: interaction.translate("fun/tictactoe:INVITE_USER", { - opponent: opponent.id, - }), - embeds: [acceptEmbed], - components: [accep], - fetchReply: true, - }); - - const collector = m.createMessageComponentCollector({ - componentType: ComponentType.Button, - time: 30 * 1000, - }); - - collector.on("collect", async button => { - 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") { - button.deferUpdate(); - return collector.stop("decline"); - } 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 dashmoji = options.idleEmoji || "➖"; - - const Args = { - user: 0, - a1: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - a2: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - a3: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - b1: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - b2: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - b3: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - c1: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - c2: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - c3: { - style: ButtonStyle.Secondary, - emoji: dashmoji, - disabled: false, - }, - }; - - const epm = client.embed({ - title: interaction.translate("fun/tictactoe:DESCRIPTION"), - color, - footer, - }); - - let msg; - 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) || "⭕", - }), - ), - ], - }); - 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) || "⭕", - }), - ), - ], - }); - - await ttt(msg); - - // eslint-disable-next-line no-inner-declarations - async function ttt(m) { - Args.userid = fighters[Args.user]; - const won = { - "<:O_:863314110560993340>": false, - "<:X_:863314044781723668>": false, - }; - - const a1 = new ButtonBuilder().setStyle(Args.a1.style).setEmoji(Args.a1.emoji).setCustomId("a1").setDisabled(Args.a1.disabled); - const a2 = new ButtonBuilder().setStyle(Args.a2.style).setEmoji(Args.a2.emoji).setCustomId("a2").setDisabled(Args.a2.disabled); - const a3 = new ButtonBuilder().setStyle(Args.a3.style).setEmoji(Args.a3.emoji).setCustomId("a3").setDisabled(Args.a3.disabled); - const b1 = new ButtonBuilder().setStyle(Args.b1.style).setEmoji(Args.b1.emoji).setCustomId("b1").setDisabled(Args.b1.disabled); - const b2 = new ButtonBuilder().setStyle(Args.b2.style).setEmoji(Args.b2.emoji).setCustomId("b2").setDisabled(Args.b2.disabled); - const b3 = new ButtonBuilder().setStyle(Args.b3.style).setEmoji(Args.b3.emoji).setCustomId("b3").setDisabled(Args.b3.disabled); - const c1 = new ButtonBuilder().setStyle(Args.c1.style).setEmoji(Args.c1.emoji).setCustomId("c1").setDisabled(Args.c1.disabled); - const c2 = new ButtonBuilder().setStyle(Args.c2.style).setEmoji(Args.c2.emoji).setCustomId("c2").setDisabled(Args.c2.disabled); - const c3 = new ButtonBuilder().setStyle(Args.c3.style).setEmoji(Args.c3.emoji).setCustomId("c3").setDisabled(Args.c3.disabled); - const a = new ActionRowBuilder().addComponents([a1, a2, a3]); - const b = new ActionRowBuilder().addComponents([b1, b2, b3]); - 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.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 (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, - - 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) { - 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) || "⭕", - }), - - 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 (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) { - 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) { - 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: [], - }); - } - - m.edit({ - content: `<@${Args.userid}>`, - embeds: [ - 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) || "❌"}`, - }), - ), - ], - components: [a, b, c], - }); - - const collector = m.createMessageComponentCollector({ - componentType: ComponentType.Button, - max: 1, - }); - - collector.on("collect", b => { - if (b.user.id !== Args.userid) { - b.reply({ - content: interaction.translate("fun/tictactoe:CANT_PLAY"), - ephemeral: true, - }); - - ttt(m); - } else { - if (Args.user == 0) { - Args.user = 1; - Args[b.customId] = { - style: ButtonStyle.Success, - emoji: o_emoji, - disabled: true, - }; - } else { - Args.user = 0; - Args[b.customId] = { - style: ButtonStyle.Danger, - emoji: x_emoji, - disabled: true, - }; - } - b.deferUpdate(); - const map = (obj, fun) => - Object.entries(obj).reduce( - (prev, [key, value]) => ({ - ...prev, - [key]: fun(key, value), - }), - {}, - ); - const objectFilter = (obj, predicate) => - Object.keys(obj) - .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, - ); - - 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 (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 - 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, "➖"), - ), - ], - components: [], - }) - .catch(() => {}); - } - } - - ttt(m); - } - }); - collector.on("end", (collected, reason) => { - 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") { - const embed = client.embed({ - author: { - name: user.getUsername(), - iconURL: user.displayAvatarURL(), - }, - title: interaction.translate("fun/tictactoe:NO_ANSWER_TITLE"), - description: interaction.translate("misc:TIMED_OUT"), - color: options.timeoutEmbedColor || "#C90000", - footer, - }); - - m.interaction.editReply({ - content: interaction.translate("fun/tictactoe:NOT_ANSWERED", { - user: opponent.id, - }), - embeds: [embed], - components: [], - }); - } - if (reason == "decline") { - const embed = client.embed({ - author: { - name: user.getUsername(), - iconURL: user.displayAvatarURL(), - }, - title: interaction.translate("fun/tictactoe:CANCELED"), - description: interaction.translate("fun/tictactoe:CANCELED_DESC", { - user: opponent.id, - }), - color: options.timeoutEmbedColor || "#C90000", - footer, - }); - - m.interaction.editReply({ - embeds: [embed], - components: [], - }); - } - }); - } catch (e) { - console.log("TicTacToe errored:", e); - } - }); -} - -module.exports = tictactoe; diff --git a/index.js b/index.js deleted file mode 100644 index a38734d5..00000000 --- a/index.js +++ /dev/null @@ -1,29 +0,0 @@ -require("./helpers/extenders"); - -const { GatewayIntentBits } = require("discord.js"), - Client = require("./base/Client"); - -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 ], - allowedMentions: { parse: ["everyone", "roles", "users"] }, -}); - -(async () => { - console.time("botReady"); - - client.translations = await require("./helpers/languages")(); - - 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)); \ No newline at end of file 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/package.json b/package.json index b1e79467..ef00a397 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,15 @@ "name": "jaba", "version": "4.6.7", "description": "My Discord Bot", - "main": "index.js", + "main": "src/index.js", + "type": "module", "scripts": { - "start": "node ." + "start": "node src/index.js" }, "author": "https://github.com/JonnyBro", "dependencies": { "@discord-player/extractor": "^4.5.1", "@discordjs/opus": "^0.9.0", - "@discordjs/rest": "^2.4.0", "@discordjs/voice": "^0.18.0", "@napi-rs/canvas": "^0.1.63", "chalk": "^4.1.2", @@ -24,99 +24,16 @@ "i18next": "^24.0.0", "i18next-fs-backend": "^2.6.0", "md5": "^2.3.0", - "moment": "^2.29.4", "mongoose": "^8.8.2", "ms": "^2.1.3", "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..f6f96a07 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: '@discordjs/opus': specifier: ^0.9.0 version: 0.9.0 - '@discordjs/rest': - specifier: ^2.4.0 - version: 2.4.0 '@discordjs/voice': specifier: ^0.18.0 version: 0.18.0(@discordjs/opus@0.9.0) @@ -49,16 +46,13 @@ 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 md5: specifier: ^2.3.0 version: 2.3.0 - moment: - specifier: ^2.29.4 - version: 2.30.1 mongoose: specifier: ^8.8.2 version: 8.8.2(socks@2.8.3) @@ -69,9 +63,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 +152,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 +213,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 +316,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 +336,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 +360,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 +415,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 +427,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 +461,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 +477,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 +500,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 +537,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 +553,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 +602,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 +641,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 +668,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 +680,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 +739,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 +760,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 +780,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 +823,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 +839,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 +858,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 +920,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 +950,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 +1019,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 +1050,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 +1069,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==} @@ -861,9 +1093,6 @@ packages: engines: {node: '>=10'} hasBin: true - moment@2.30.1: - resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} - mongodb-connection-string-url@3.0.1: resolution: {integrity: sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==} @@ -996,14 +1225,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 +1296,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 +1316,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 +1390,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 +1435,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 +1451,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 +1469,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 +1484,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 +1504,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 +1536,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 +1729,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 +1762,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 +1807,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 +1883,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 +1921,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 +1969,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 +1990,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 +2013,8 @@ snapshots: argparse@2.0.1: {} + array-union@2.1.0: {} + balanced-match@1.0.2: {} barse@0.4.3: @@ -1615,6 +2028,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 +2052,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 +2098,8 @@ snapshots: commander@6.2.1: {} + common-tags@1.8.2: {} + concat-map@0.0.1: {} console-control-strings@1.1.0: {} @@ -1680,7 +2111,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 +2149,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 +2225,8 @@ snapshots: - bufferutil - utf-8-validate + dlv@1.1.3: {} + doctrine@3.0.0: dependencies: esutils: 2.0.3 @@ -1816,6 +2253,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 +2262,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 +2283,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 +2314,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 +2381,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 +2406,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 +2431,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 +2488,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 +2509,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 +2538,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 +2573,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 +2594,8 @@ snapshots: imurmurhash@0.1.4: {} + indent-string@4.0.0: {} + inflight@1.0.6: dependencies: once: 1.4.0 @@ -2082,6 +2619,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 +2678,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 +2705,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 +2720,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: @@ -2182,8 +2739,6 @@ snapshots: mkdirp@1.0.4: {} - moment@2.30.1: {} - mongodb-connection-string-url@3.0.1: dependencies: '@types/whatwg-url': 11.0.5 @@ -2308,10 +2863,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 +2912,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 +2943,8 @@ snapshots: regenerator-runtime@0.14.1: {} + require-relative@0.8.7: {} + resolve-alpn@1.2.1: {} resolve-from@4.0.0: {} @@ -2413,6 +3001,8 @@ snapshots: signal-exit@3.0.7: {} + slash@3.0.0: {} + smart-buffer@4.2.0: optional: true @@ -2461,6 +3051,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 +3066,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 +3085,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 +3100,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 +3114,8 @@ snapshots: type-fest@0.20.2: {} + typescript@5.7.2: {} + undici-types@6.19.8: {} undici@5.28.4: @@ -2530,6 +3136,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/src/adapters/database/IDatabaseAdapter.js b/src/adapters/database/IDatabaseAdapter.js new file mode 100644 index 00000000..f844d775 --- /dev/null +++ b/src/adapters/database/IDatabaseAdapter.js @@ -0,0 +1,25 @@ +export default class IDatabaseAdapter { + async connect() { + throw new Error("Method `connect` not implemented."); + } + + async disconnect() { + throw new Error("Method `disconnect` not implemented."); + } + + async find() { + throw new Error("Method \"find\" must be implemented"); + } + + async findOne() { + throw new Error("Method \"findOne\" must be implemented"); + } + + async updateOne() { + throw new Error("Method \"updateOne\" must be implemented"); + } + + async deleteOne() { + throw new Error("Method \"deleteOne\" must be implemented"); + } +} diff --git a/src/adapters/database/MongooseAdapter.js b/src/adapters/database/MongooseAdapter.js new file mode 100644 index 00000000..56215eba --- /dev/null +++ b/src/adapters/database/MongooseAdapter.js @@ -0,0 +1,48 @@ +import mongoose from "mongoose"; +import IDatabaseAdapter from "./IDatabaseAdapter.js"; +import logger from "../../helpers/logger.js"; + +export default class MongooseAdapter extends IDatabaseAdapter { + /** + * + * @param {string} uri - database url connect + * @param {mongoose.ConnectOptions} options - database connect options + */ + constructor(uri, options = {}) { + super(); + + if (!uri) { + throw new Error("MongooseAdapter: URI is required."); + } + + this.uri = uri; + + this.options = options; + } + + async connect() { + await mongoose.connect(this.uri, this.options); + logger.log("Database connected."); + } + + async disconnect() { + await mongoose.disconnect(); + logger.warn("Database disconnected."); + } + + async find(model, query = {}, options = {}) { + return model.find(query, null, options).exec(); + } + + async findOne(model, query = {}, options = {}) { + return model.findOne(query, null, options).exec(); + } + + async updateOne(model, filter, update, options = {}) { + return model.updateOne(filter, update, options).exec(); + } + + async deleteOne(model, filter) { + return model.deleteOne(filter).exec(); + } +} diff --git a/assets/fonts/KeepCalm-Medium.ttf b/src/assets/fonts/KeepCalm-Medium.ttf similarity index 100% rename from assets/fonts/KeepCalm-Medium.ttf rename to src/assets/fonts/KeepCalm-Medium.ttf diff --git a/assets/fonts/RubikMonoOne-Regular.ttf b/src/assets/fonts/RubikMonoOne-Regular.ttf similarity index 100% rename from assets/fonts/RubikMonoOne-Regular.ttf rename to src/assets/fonts/RubikMonoOne-Regular.ttf diff --git a/assets/img/achievements/achievement1.png b/src/assets/img/achievements/achievement1.png similarity index 100% rename from assets/img/achievements/achievement1.png rename to src/assets/img/achievements/achievement1.png diff --git a/assets/img/achievements/achievement2.png b/src/assets/img/achievements/achievement2.png similarity index 100% rename from assets/img/achievements/achievement2.png rename to src/assets/img/achievements/achievement2.png diff --git a/assets/img/achievements/achievement3.png b/src/assets/img/achievements/achievement3.png similarity index 100% rename from assets/img/achievements/achievement3.png rename to src/assets/img/achievements/achievement3.png diff --git a/assets/img/achievements/achievement4.png b/src/assets/img/achievements/achievement4.png similarity index 100% rename from assets/img/achievements/achievement4.png rename to src/assets/img/achievements/achievement4.png diff --git a/assets/img/achievements/achievement5.png b/src/assets/img/achievements/achievement5.png similarity index 100% rename from assets/img/achievements/achievement5.png rename to src/assets/img/achievements/achievement5.png diff --git a/assets/img/achievements/achievement6.png b/src/assets/img/achievements/achievement6.png similarity index 100% rename from assets/img/achievements/achievement6.png rename to src/assets/img/achievements/achievement6.png diff --git a/assets/img/achievements/achievement7.png b/src/assets/img/achievements/achievement7.png similarity index 100% rename from assets/img/achievements/achievement7.png rename to src/assets/img/achievements/achievement7.png diff --git a/assets/img/achievements/achievement_colored1.png b/src/assets/img/achievements/achievement_colored1.png similarity index 100% rename from assets/img/achievements/achievement_colored1.png rename to src/assets/img/achievements/achievement_colored1.png diff --git a/assets/img/achievements/achievement_colored2.png b/src/assets/img/achievements/achievement_colored2.png similarity index 100% rename from assets/img/achievements/achievement_colored2.png rename to src/assets/img/achievements/achievement_colored2.png diff --git a/assets/img/achievements/achievement_colored3.png b/src/assets/img/achievements/achievement_colored3.png similarity index 100% rename from assets/img/achievements/achievement_colored3.png rename to src/assets/img/achievements/achievement_colored3.png diff --git a/assets/img/achievements/achievement_colored4.png b/src/assets/img/achievements/achievement_colored4.png similarity index 100% rename from assets/img/achievements/achievement_colored4.png rename to src/assets/img/achievements/achievement_colored4.png diff --git a/assets/img/achievements/achievement_colored5.png b/src/assets/img/achievements/achievement_colored5.png similarity index 100% rename from assets/img/achievements/achievement_colored5.png rename to src/assets/img/achievements/achievement_colored5.png diff --git a/assets/img/achievements/achievement_colored6.png b/src/assets/img/achievements/achievement_colored6.png similarity index 100% rename from assets/img/achievements/achievement_colored6.png rename to src/assets/img/achievements/achievement_colored6.png diff --git a/assets/img/achievements/achievement_colored7.png b/src/assets/img/achievements/achievement_colored7.png similarity index 100% rename from assets/img/achievements/achievement_colored7.png rename to src/assets/img/achievements/achievement_colored7.png diff --git a/assets/img/achievements/achievement_unlocked1.png b/src/assets/img/achievements/achievement_unlocked1.png similarity index 100% rename from assets/img/achievements/achievement_unlocked1.png rename to src/assets/img/achievements/achievement_unlocked1.png diff --git a/assets/img/achievements/achievement_unlocked2.png b/src/assets/img/achievements/achievement_unlocked2.png similarity index 100% rename from assets/img/achievements/achievement_unlocked2.png rename to src/assets/img/achievements/achievement_unlocked2.png diff --git a/assets/img/achievements/achievement_unlocked3.png b/src/assets/img/achievements/achievement_unlocked3.png similarity index 100% rename from assets/img/achievements/achievement_unlocked3.png rename to src/assets/img/achievements/achievement_unlocked3.png diff --git a/assets/img/achievements/achievement_unlocked4.png b/src/assets/img/achievements/achievement_unlocked4.png similarity index 100% rename from assets/img/achievements/achievement_unlocked4.png rename to src/assets/img/achievements/achievement_unlocked4.png diff --git a/assets/img/achievements/achievement_unlocked5.png b/src/assets/img/achievements/achievement_unlocked5.png similarity index 100% rename from assets/img/achievements/achievement_unlocked5.png rename to src/assets/img/achievements/achievement_unlocked5.png diff --git a/assets/img/achievements/achievement_unlocked6.png b/src/assets/img/achievements/achievement_unlocked6.png similarity index 100% rename from assets/img/achievements/achievement_unlocked6.png rename to src/assets/img/achievements/achievement_unlocked6.png diff --git a/assets/img/achievements/achievement_unlocked7.png b/src/assets/img/achievements/achievement_unlocked7.png similarity index 100% rename from assets/img/achievements/achievement_unlocked7.png rename to src/assets/img/achievements/achievement_unlocked7.png diff --git a/assets/img/greetings_background.png b/src/assets/img/greetings_background.png similarity index 100% rename from assets/img/greetings_background.png rename to src/assets/img/greetings_background.png diff --git a/base/BaseCommand.js b/src/base_OLD/BaseCommand.js similarity index 71% rename from base/BaseCommand.js rename to src/base_OLD/BaseCommand.js index 7abc79a0..2e5fd642 100644 --- a/base/BaseCommand.js +++ b/src/base_OLD/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/src/base_OLD/BaseEvent.js similarity index 85% rename from base/BaseEvent.js rename to src/base_OLD/BaseEvent.js index bd69c478..2fa28085 100644 --- a/base/BaseEvent.js +++ b/src/base_OLD/BaseEvent.js @@ -11,4 +11,4 @@ class BaseEvent { } } -module.exports = BaseEvent; +export default BaseEvent; diff --git a/base/Client.js b/src/base_OLD/Client.js similarity index 79% rename from base/Client.js rename to src/base_OLD/Client.js index 9cead419..db50e763 100644 --- a/base/Client.js +++ b/src/base_OLD/Client.js @@ -1,31 +1,40 @@ -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 * 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.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(); @@ -42,7 +51,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, @@ -62,25 +71,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))); @@ -105,9 +122,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}`); }); @@ -126,8 +141,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) { @@ -136,7 +151,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; @@ -157,8 +172,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); } } @@ -170,7 +185,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"`); @@ -182,8 +197,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); } } @@ -194,7 +209,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; } @@ -205,15 +220,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; } @@ -236,8 +251,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); } } } @@ -290,7 +305,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; } @@ -311,7 +326,7 @@ class JaBaClient extends Client { /** * Returns a User data from the database. * @param {string} userID - The ID of the user to find or create. - * @returns {Promise} The user data object, either retrieved from the database or newly created. + * @returns {Promise} The user data object, either retrieved from the database or newly created. */ async getUserData(userID) { let userData = await this.usersData.findOne({ id: userID }); @@ -330,7 +345,7 @@ class JaBaClient extends Client { * Returns a Member data from the database. * @param {string} memberId - The ID of the member to find or create. * @param {string} guildId - The ID of the guild the member belongs to. - * @returns {Promise} The member data object, either retrieved from the database or newly created. + * @returns {Promise} The member data object, either retrieved from the database or newly created. */ async getMemberData(memberId, guildId) { let memberData = await this.membersData.findOne({ guildID: guildId, id: memberId }); @@ -340,6 +355,7 @@ class JaBaClient extends Client { await memberData.save(); const guildData = await this.getGuildData(guildId); + if (guildData) { guildData.members.push(memberData._id); await guildData.save(); @@ -353,7 +369,7 @@ class JaBaClient extends Client { /** * Returns a Guild data from the database. * @param {string} guildId - The ID of the guild to find or create. - * @returns {Promise} The guild data object, either retrieved from the database or newly created. + * @returns {Promise} The guild data object, either retrieved from the database or newly created. */ async getGuildData(guildId) { let guildData = await this.guildsData.findOne({ id: guildId }).populate("members"); @@ -369,4 +385,4 @@ class JaBaClient extends Client { } } -module.exports = JaBaClient; +export default JaBaClient; diff --git a/src/commands/Fun/8ball.js b/src/commands/Fun/8ball.js new file mode 100644 index 00000000..7600c06c --- /dev/null +++ b/src/commands/Fun/8ball.js @@ -0,0 +1,8 @@ +export const data = { + name: "8ball", + description: "8ball", +}; + +export const run = () => { + console.log("8ball"); +}; diff --git a/commands/Administration/addemoji.js b/src/commands_OLD/Administration/addemoji.js similarity index 100% rename from commands/Administration/addemoji.js rename to src/commands_OLD/Administration/addemoji.js diff --git a/commands/Administration/automod.js b/src/commands_OLD/Administration/automod.js similarity index 100% rename from commands/Administration/automod.js rename to src/commands_OLD/Administration/automod.js diff --git a/commands/Administration/autorole.js b/src/commands_OLD/Administration/autorole.js similarity index 100% rename from commands/Administration/autorole.js rename to src/commands_OLD/Administration/autorole.js diff --git a/commands/Administration/config.js b/src/commands_OLD/Administration/config.js similarity index 96% rename from commands/Administration/config.js rename to src/commands_OLD/Administration/config.js index e4b5236a..d4f5f0df 100644 --- a/commands/Administration/config.js +++ b/src/commands_OLD/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"), @@ -211,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) { @@ -241,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/Administration/goodbye.js b/src/commands_OLD/Administration/goodbye.js similarity index 100% rename from commands/Administration/goodbye.js rename to src/commands_OLD/Administration/goodbye.js diff --git a/commands/Administration/selectroles.js b/src/commands_OLD/Administration/selectroles.js similarity index 100% rename from commands/Administration/selectroles.js rename to src/commands_OLD/Administration/selectroles.js diff --git a/commands/Administration/set.js b/src/commands_OLD/Administration/set.js similarity index 100% rename from commands/Administration/set.js rename to src/commands_OLD/Administration/set.js diff --git a/commands/Administration/setlang.js b/src/commands_OLD/Administration/setlang.js similarity index 100% rename from commands/Administration/setlang.js rename to src/commands_OLD/Administration/setlang.js diff --git a/commands/Administration/stealemoji.js b/src/commands_OLD/Administration/stealemoji.js similarity index 100% rename from commands/Administration/stealemoji.js rename to src/commands_OLD/Administration/stealemoji.js diff --git a/commands/Administration/welcome.js b/src/commands_OLD/Administration/welcome.js similarity index 100% rename from commands/Administration/welcome.js rename to src/commands_OLD/Administration/welcome.js diff --git a/commands/Beatrun/courses.js b/src/commands_OLD/Beatrun/courses.js similarity index 100% rename from commands/Beatrun/courses.js rename to src/commands_OLD/Beatrun/courses.js diff --git a/commands/Economy/achievements.js b/src/commands_OLD/Economy/achievements.js similarity index 100% rename from commands/Economy/achievements.js rename to src/commands_OLD/Economy/achievements.js diff --git a/commands/Economy/bank.js b/src/commands_OLD/Economy/bank.js similarity index 100% rename from commands/Economy/bank.js rename to src/commands_OLD/Economy/bank.js diff --git a/commands/Economy/birthdate.js b/src/commands_OLD/Economy/birthdate.js similarity index 100% rename from commands/Economy/birthdate.js rename to src/commands_OLD/Economy/birthdate.js diff --git a/commands/Economy/divorce.js b/src/commands_OLD/Economy/divorce.js similarity index 100% rename from commands/Economy/divorce.js rename to src/commands_OLD/Economy/divorce.js diff --git a/commands/Economy/leaderboard.js b/src/commands_OLD/Economy/leaderboard.js similarity index 100% rename from commands/Economy/leaderboard.js rename to src/commands_OLD/Economy/leaderboard.js diff --git a/commands/Economy/marry.js b/src/commands_OLD/Economy/marry.js similarity index 100% rename from commands/Economy/marry.js rename to src/commands_OLD/Economy/marry.js diff --git a/commands/Economy/money.js b/src/commands_OLD/Economy/money.js similarity index 100% rename from commands/Economy/money.js rename to src/commands_OLD/Economy/money.js diff --git a/commands/Economy/pay.js b/src/commands_OLD/Economy/pay.js similarity index 100% rename from commands/Economy/pay.js rename to src/commands_OLD/Economy/pay.js diff --git a/commands/Economy/profile.js b/src/commands_OLD/Economy/profile.js similarity index 100% rename from commands/Economy/profile.js rename to src/commands_OLD/Economy/profile.js diff --git a/commands/Economy/rep.js b/src/commands_OLD/Economy/rep.js similarity index 100% rename from commands/Economy/rep.js rename to src/commands_OLD/Economy/rep.js diff --git a/commands/Economy/rob.js b/src/commands_OLD/Economy/rob.js similarity index 100% rename from commands/Economy/rob.js rename to src/commands_OLD/Economy/rob.js diff --git a/commands/Economy/setbio.js b/src/commands_OLD/Economy/setbio.js similarity index 100% rename from commands/Economy/setbio.js rename to src/commands_OLD/Economy/setbio.js diff --git a/commands/Economy/slots.js b/src/commands_OLD/Economy/slots.js similarity index 100% rename from commands/Economy/slots.js rename to src/commands_OLD/Economy/slots.js diff --git a/commands/Economy/transactions.js b/src/commands_OLD/Economy/transactions.js similarity index 100% rename from commands/Economy/transactions.js rename to src/commands_OLD/Economy/transactions.js diff --git a/commands/Economy/work.js b/src/commands_OLD/Economy/work.js similarity index 100% rename from commands/Economy/work.js rename to src/commands_OLD/Economy/work.js diff --git a/commands/Fun/8ball.js b/src/commands_OLD/Fun/8ball.js similarity index 100% rename from commands/Fun/8ball.js rename to src/commands_OLD/Fun/8ball.js diff --git a/commands/Fun/cat.js b/src/commands_OLD/Fun/cat.js similarity index 100% rename from commands/Fun/cat.js rename to src/commands_OLD/Fun/cat.js diff --git a/commands/Fun/dog.js b/src/commands_OLD/Fun/dog.js similarity index 100% rename from commands/Fun/dog.js rename to src/commands_OLD/Fun/dog.js diff --git a/commands/Fun/lmgtfy.js b/src/commands_OLD/Fun/lmgtfy.js similarity index 100% rename from commands/Fun/lmgtfy.js rename to src/commands_OLD/Fun/lmgtfy.js diff --git a/commands/Fun/lovecalc.js b/src/commands_OLD/Fun/lovecalc.js similarity index 100% rename from commands/Fun/lovecalc.js rename to src/commands_OLD/Fun/lovecalc.js diff --git a/commands/Fun/number.js b/src/commands_OLD/Fun/number.js similarity index 100% rename from commands/Fun/number.js rename to src/commands_OLD/Fun/number.js diff --git a/commands/Fun/tictactoe.js b/src/commands_OLD/Fun/tictactoe.js similarity index 100% rename from commands/Fun/tictactoe.js rename to src/commands_OLD/Fun/tictactoe.js diff --git a/commands/General/afk.js b/src/commands_OLD/General/afk.js similarity index 100% rename from commands/General/afk.js rename to src/commands_OLD/General/afk.js diff --git a/commands/General/avatar.c.js b/src/commands_OLD/General/avatar.c.js similarity index 100% rename from commands/General/avatar.c.js rename to src/commands_OLD/General/avatar.c.js diff --git a/commands/General/avatar.js b/src/commands_OLD/General/avatar.js similarity index 100% rename from commands/General/avatar.js rename to src/commands_OLD/General/avatar.js diff --git a/commands/General/boosters.js b/src/commands_OLD/General/boosters.js similarity index 100% rename from commands/General/boosters.js rename to src/commands_OLD/General/boosters.js diff --git a/commands/General/emoji.js b/src/commands_OLD/General/emoji.js similarity index 100% rename from commands/General/emoji.js rename to src/commands_OLD/General/emoji.js diff --git a/commands/General/help.js b/src/commands_OLD/General/help.js similarity index 100% rename from commands/General/help.js rename to src/commands_OLD/General/help.js diff --git a/commands/General/info.js b/src/commands_OLD/General/info.js similarity index 100% rename from commands/General/info.js rename to src/commands_OLD/General/info.js diff --git a/commands/General/minecraft.js b/src/commands_OLD/General/minecraft.js similarity index 100% rename from commands/General/minecraft.js rename to src/commands_OLD/General/minecraft.js diff --git a/commands/General/ping.js b/src/commands_OLD/General/ping.js similarity index 100% rename from commands/General/ping.js rename to src/commands_OLD/General/ping.js diff --git a/commands/General/remindme.js b/src/commands_OLD/General/remindme.js similarity index 100% rename from commands/General/remindme.js rename to src/commands_OLD/General/remindme.js diff --git a/commands/General/reminds.js b/src/commands_OLD/General/reminds.js similarity index 100% rename from commands/General/reminds.js rename to src/commands_OLD/General/reminds.js diff --git a/commands/General/report.js b/src/commands_OLD/General/report.js similarity index 100% rename from commands/General/report.js rename to src/commands_OLD/General/report.js diff --git a/commands/General/shorturl.js b/src/commands_OLD/General/shorturl.js similarity index 97% rename from commands/General/shorturl.js rename to src/commands_OLD/General/shorturl.js index 06da073d..ee60eb44 100644 --- a/commands/General/shorturl.js +++ b/src/commands_OLD/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/src/commands_OLD/General/stats.js similarity index 100% rename from commands/General/stats.js rename to src/commands_OLD/General/stats.js diff --git a/commands/General/suggest.js b/src/commands_OLD/General/suggest.js similarity index 100% rename from commands/General/suggest.js rename to src/commands_OLD/General/suggest.js diff --git a/commands/General/whois.js b/src/commands_OLD/General/whois.js similarity index 100% rename from commands/General/whois.js rename to src/commands_OLD/General/whois.js diff --git a/commands/IAT/checkjar.js b/src/commands_OLD/IAT/checkjar.js similarity index 95% rename from commands/IAT/checkjar.js rename to src/commands_OLD/IAT/checkjar.js index 8618c3f4..2aeb8965 100644 --- a/commands/IAT/checkjar.js +++ b/src/commands_OLD/IAT/checkjar.js @@ -1,7 +1,6 @@ const { SlashCommandBuilder, InteractionContextType, ApplicationIntegrationType } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), - fetch = require("node-fetch"), - moment = require("moment"); + fetch = require("node-fetch"); class Checkjar extends BaseCommand { /** @@ -56,7 +55,7 @@ class Checkjar extends BaseCommand { jarTransactions.length = 10; jarTransactions.forEach(t => { - const time = moment.unix(t.time); + const time = new Intl.DateTimeFormat("ru-RU").format(t.time); embed.data.fields.push([ { diff --git a/commands/Moderation/clear.js b/src/commands_OLD/Moderation/clear.js similarity index 100% rename from commands/Moderation/clear.js rename to src/commands_OLD/Moderation/clear.js diff --git a/commands/Moderation/clearwarns.js b/src/commands_OLD/Moderation/clearwarns.js similarity index 100% rename from commands/Moderation/clearwarns.js rename to src/commands_OLD/Moderation/clearwarns.js diff --git a/commands/Moderation/giveaway.js b/src/commands_OLD/Moderation/giveaway.js similarity index 100% rename from commands/Moderation/giveaway.js rename to src/commands_OLD/Moderation/giveaway.js diff --git a/commands/Moderation/unban.js b/src/commands_OLD/Moderation/unban.js similarity index 100% rename from commands/Moderation/unban.js rename to src/commands_OLD/Moderation/unban.js diff --git a/commands/Moderation/untimeout.js b/src/commands_OLD/Moderation/untimeout.js similarity index 100% rename from commands/Moderation/untimeout.js rename to src/commands_OLD/Moderation/untimeout.js diff --git a/commands/Moderation/warn.c.js b/src/commands_OLD/Moderation/warn.c.js similarity index 100% rename from commands/Moderation/warn.c.js rename to src/commands_OLD/Moderation/warn.c.js diff --git a/commands/Moderation/warns.js b/src/commands_OLD/Moderation/warns.js similarity index 100% rename from commands/Moderation/warns.js rename to src/commands_OLD/Moderation/warns.js diff --git a/commands/Music/back.js b/src/commands_OLD/Music/back.js similarity index 100% rename from commands/Music/back.js rename to src/commands_OLD/Music/back.js diff --git a/commands/Music/loop.js b/src/commands_OLD/Music/loop.js similarity index 100% rename from commands/Music/loop.js rename to src/commands_OLD/Music/loop.js diff --git a/commands/Music/nowplaying.js b/src/commands_OLD/Music/nowplaying.js similarity index 99% rename from commands/Music/nowplaying.js rename to src/commands_OLD/Music/nowplaying.js index d4667b1a..f5efe5e1 100644 --- a/commands/Music/nowplaying.js +++ b/src/commands_OLD/Music/nowplaying.js @@ -270,7 +270,7 @@ async function updateEmbed(interaction, queue) { { name: "\u200B", value: "\u200B", inline: true }, { name: interaction.translate("common:VIEWS"), - value: track.raw.live ? "Live" : new Intl.NumberFormat(interaction.client.defaultLanguage.moment, { notation: "standard" }).format(track.raw.views), + value: track.raw.live ? "Live" : new Intl.NumberFormat(interaction.client.defaultLanguage.locale, { notation: "standard" }).format(track.raw.views), inline: true, }, { diff --git a/commands/Music/play.c.js b/src/commands_OLD/Music/play.c.js similarity index 100% rename from commands/Music/play.c.js rename to src/commands_OLD/Music/play.c.js diff --git a/commands/Music/play.js b/src/commands_OLD/Music/play.js similarity index 100% rename from commands/Music/play.js rename to src/commands_OLD/Music/play.js diff --git a/commands/Music/queue.js b/src/commands_OLD/Music/queue.js similarity index 100% rename from commands/Music/queue.js rename to src/commands_OLD/Music/queue.js diff --git a/commands/Music/seek.js b/src/commands_OLD/Music/seek.js similarity index 100% rename from commands/Music/seek.js rename to src/commands_OLD/Music/seek.js diff --git a/commands/Music/shuffle.js b/src/commands_OLD/Music/shuffle.js similarity index 100% rename from commands/Music/shuffle.js rename to src/commands_OLD/Music/shuffle.js diff --git a/commands/Music/skip.js b/src/commands_OLD/Music/skip.js similarity index 100% rename from commands/Music/skip.js rename to src/commands_OLD/Music/skip.js diff --git a/commands/Music/stop.js b/src/commands_OLD/Music/stop.js similarity index 100% rename from commands/Music/stop.js rename to src/commands_OLD/Music/stop.js diff --git a/commands/Music/volume.js b/src/commands_OLD/Music/volume.js similarity index 100% rename from commands/Music/volume.js rename to src/commands_OLD/Music/volume.js diff --git a/commands/Owner/debug.js b/src/commands_OLD/Owner/debug.js similarity index 100% rename from commands/Owner/debug.js rename to src/commands_OLD/Owner/debug.js diff --git a/commands/Owner/eval.js b/src/commands_OLD/Owner/eval.js similarity index 100% rename from commands/Owner/eval.js rename to src/commands_OLD/Owner/eval.js diff --git a/commands/Owner/reload.js b/src/commands_OLD/Owner/reload.js similarity index 100% rename from commands/Owner/reload.js rename to src/commands_OLD/Owner/reload.js diff --git a/commands/Owner/say.js b/src/commands_OLD/Owner/say.js similarity index 100% rename from commands/Owner/say.js rename to src/commands_OLD/Owner/say.js diff --git a/commands/Owner/servers.js b/src/commands_OLD/Owner/servers.js similarity index 100% rename from commands/Owner/servers.js rename to src/commands_OLD/Owner/servers.js diff --git a/commands/Tickets/adduser.js b/src/commands_OLD/Tickets/adduser.js similarity index 100% rename from commands/Tickets/adduser.js rename to src/commands_OLD/Tickets/adduser.js diff --git a/commands/Tickets/closeticket.js b/src/commands_OLD/Tickets/closeticket.js similarity index 100% rename from commands/Tickets/closeticket.js rename to src/commands_OLD/Tickets/closeticket.js diff --git a/commands/Tickets/createticketembed.js b/src/commands_OLD/Tickets/createticketembed.js similarity index 100% rename from commands/Tickets/createticketembed.js rename to src/commands_OLD/Tickets/createticketembed.js diff --git a/commands/Tickets/removeuser.js b/src/commands_OLD/Tickets/removeuser.js similarity index 100% rename from commands/Tickets/removeuser.js rename to src/commands_OLD/Tickets/removeuser.js diff --git a/src/constants/index.js b/src/constants/index.js new file mode 100644 index 00000000..9aaae42a --- /dev/null +++ b/src/constants/index.js @@ -0,0 +1,26 @@ +import path from "node:path"; +import { GatewayIntentBits } from "discord.js"; +import { AsyncLocalStorage } from "node:async_hooks"; + +export const PROJECT_ROOT = path.join(import.meta.dirname, ".."); +export const CONFIG_PATH = path.join(PROJECT_ROOT, "..", "config.json"); +export const 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, +]; +export const CLIENT_ALLOWED_MENTIONS = { parse: ["everyone", "roles", "users"] }; + +export const SUPER_CONTEXT = new AsyncLocalStorage(); diff --git a/src/events/Ready.js b/src/events/Ready.js new file mode 100644 index 00000000..474bc760 --- /dev/null +++ b/src/events/Ready.js @@ -0,0 +1,14 @@ +import logger from "../helpers/logger.js"; + +export const data = { + name: "ready", + once: true, +}; + +/** + * + * @param {import("../structures/client.js").ExtendedClient} client + */ +export async function run(client) { + logger.ready(client.user.tag + " is online!"); +} diff --git a/events/CommandHandler.js b/src/events_OLD/CommandHandler.js similarity index 87% rename from events/CommandHandler.js rename to src/events_OLD/CommandHandler.js index 0337da0c..4923eec7 100644 --- a/events/CommandHandler.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildBanAdd.js similarity index 84% rename from events/Guild/guildBanAdd.js rename to src/events_OLD/Guild/guildBanAdd.js index be02d479..dd92d904 100644 --- a/events/Guild/guildBanAdd.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildCreate.js similarity index 95% rename from events/Guild/guildCreate.js rename to src/events_OLD/Guild/guildCreate.js index ffa6a96f..0856149d 100644 --- a/events/Guild/guildCreate.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildDelete.js similarity index 77% rename from events/Guild/guildDelete.js rename to src/events_OLD/Guild/guildDelete.js index 20b795cc..b87299c0 100644 --- a/events/Guild/guildDelete.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildMemberAdd.js similarity index 93% rename from events/Guild/guildMemberAdd.js rename to src/events_OLD/Guild/guildMemberAdd.js index 0112ae64..8bad2c4c 100644 --- a/events/Guild/guildMemberAdd.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildMemberRemove.js similarity index 92% rename from events/Guild/guildMemberRemove.js rename to src/events_OLD/Guild/guildMemberRemove.js index c3e1499a..9726d708 100644 --- a/events/Guild/guildMemberRemove.js +++ b/src/events_OLD/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/src/events_OLD/Guild/guildMemberUpdate.js similarity index 93% rename from events/Guild/guildMemberUpdate.js rename to src/events_OLD/Guild/guildMemberUpdate.js index 2c48d1a9..fd8d1e3b 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/src/events_OLD/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/src/events_OLD/MessageHandler.js similarity index 95% rename from events/MessageHandler.js rename to src/events_OLD/MessageHandler.js index fd1abac8..6ef06e6a 100644 --- a/events/MessageHandler.js +++ b/src/events_OLD/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/src/events_OLD/Monitoring/messageDelete.js similarity index 93% rename from events/Monitoring/messageDelete.js rename to src/events_OLD/Monitoring/messageDelete.js index 5b760cd1..643bf78d 100644 --- a/events/Monitoring/messageDelete.js +++ b/src/events_OLD/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/src/events_OLD/Monitoring/messageUpdate.js similarity index 94% rename from events/Monitoring/messageUpdate.js rename to src/events_OLD/Monitoring/messageUpdate.js index 72bc91df..38fa9521 100644 --- a/events/Monitoring/messageUpdate.js +++ b/src/events_OLD/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/src/events_OLD/Ready.js similarity index 94% rename from events/Ready.js rename to src/events_OLD/Ready.js index aa105f17..315bb033 100644 --- a/events/Ready.js +++ b/src/events_OLD/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() { @@ -60,4 +60,4 @@ class Ready extends BaseEvent { } } -module.exports = Ready; +export default Ready; diff --git a/events/TicketsButton.js b/src/events_OLD/TicketsButton.js similarity index 85% rename from events/TicketsButton.js rename to src/events_OLD/TicketsButton.js index dbbf7340..9aa95547 100644 --- a/events/TicketsButton.js +++ b/src/events_OLD/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/src/handlers/command-handler/functions/registerCommands.js b/src/handlers/command-handler/functions/registerCommands.js new file mode 100644 index 00000000..c7fe5ef9 --- /dev/null +++ b/src/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/src/handlers/command-handler/index.js b/src/handlers/command-handler/index.js new file mode 100644 index 00000000..53b6271f --- /dev/null +++ b/src/handlers/command-handler/index.js @@ -0,0 +1,40 @@ +import { resolve } from "node:path"; +import logger from "../../helpers/logger.js"; +import useClient from "../../utils/use-client.js"; +import { getFilePaths } from "../../utils/index.js"; +import { toFileURL } from "../../utils/resolve-file.js"; +import registerCommands from "./functions/registerCommands.js"; + +export const commands = []; + +export const init = async () => { + const client = useClient(); + await buildCommands(); + + await registerCommands({ + client, + commands, + }); +}; + +const buildCommands = async () => { + const client = useClient(); + const cmdPath = resolve(client.configService.get("paths.commands")); + const commandFilePaths = (await getFilePaths(cmdPath, 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/src/handlers/command-handler/utils/differentcommands.js b/src/handlers/command-handler/utils/differentcommands.js new file mode 100644 index 00000000..bf32572c --- /dev/null +++ b/src/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/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js new file mode 100644 index 00000000..0144bbba --- /dev/null +++ b/src/handlers/event-handler/index.js @@ -0,0 +1,49 @@ +import { resolve } from "node:path"; +import logger from "../../helpers/logger.js"; +import useClient from "../../utils/use-client.js"; +import { getFilePaths } from "../../utils/index.js"; +import { toFileURL } from "../../utils/resolve-file.js"; +import { useMainPlayer } from "discord-player"; + +export const events = []; + +export const init = async () => { + await buildEvents(); + registerEvents(); +}; + +const buildEvents = async () => { + const client = useClient(); + try { + const eventPath = resolve(client.configService.get("paths.events")); + const eventFilePaths = (await getFilePaths(eventPath, 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 () => { + const client = useClient(); + const player = useMainPlayer(); + for (const { data, run } of events) { + if (data.player) player.events.on(data.name, run); + if (data.once) client.once(data.name, run); + else client.on(data.name, run); + } +}; diff --git a/helpers/birthdays.js b/src/helpers/birthdays.js similarity index 90% rename from helpers/birthdays.js rename to src/helpers/birthdays.js index 2a8a57d3..7334e6fb 100644 --- a/helpers/birthdays.js +++ b/src/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/src/helpers/checkReminds.js similarity index 89% rename from helpers/checkReminds.js rename to src/helpers/checkReminds.js index 7f0c123b..7c271c9c 100644 --- a/helpers/checkReminds.js +++ b/src/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/src/helpers/cleanup.js similarity index 97% rename from helpers/cleanup.js rename to src/helpers/cleanup.js index 159bd4e1..59cce4e0 100644 --- a/helpers/cleanup.js +++ b/src/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/src/helpers/extenders.js similarity index 97% rename from helpers/extenders.js rename to src/helpers/extenders.js index 54856c47..33cc2c01 100644 --- a/helpers/extenders.js +++ b/src/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/src/helpers/functions.js b/src/helpers/functions.js new file mode 100644 index 00000000..578d6f55 --- /dev/null +++ b/src/helpers/functions.js @@ -0,0 +1,103 @@ +/** + * 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); +} + +/** + * 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. + */ +export function shuffle(pArray) { + const array = []; + + pArray.forEach(element => array.push(element)); + + let currentIndex = array.length, + temporaryValue, + randomIndex; + + while (currentIndex !== 0) { + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + 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); + + 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 { format: languageFormat, locale: localeFormat } = client.languages.find(language => language.name === locale); + if (format === "" || format === null) format = languageFormat; + return new Intl.DateTimeFormat(localeFormat).format(date); +} + +/** + * 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/src/helpers/languages.js similarity index 52% rename from helpers/languages.js rename to src/helpers/languages.js index 78ff2445..742c648e 100644 --- a/helpers/languages.js +++ b/src/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/src/helpers/logger.js b/src/helpers/logger.js new file mode 100644 index 00000000..5352756e --- /dev/null +++ b/src/helpers/logger.js @@ -0,0 +1,47 @@ +import chalk from "chalk"; + +function format(tDate) { + 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); +} + +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.join(" ")}`); + }, + + warn(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content.join(" ")}`); + }, + + error(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content.join(" ")}`); + }, + + debug(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content.join(" ")}`); + }, + + cmd(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content.join(" ")}`); + }, + + ready(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content.join(" ")}`); + }, +}; diff --git a/src/helpers/tictactoe.js b/src/helpers/tictactoe.js new file mode 100644 index 00000000..c3d238b9 --- /dev/null +++ b/src/helpers/tictactoe.js @@ -0,0 +1,603 @@ +// Thanks to simply-djs for this =) +// TODO: Refactor this please... + +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } from "discord.js"; + +/** + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {any[]} options Array with options (everything is optional) + * @param {string} options.userSlash Name of the user option in the interaction + * @param {string} options.embedFooter Game's embed footer + * @param {string} options.embedColor Game's embed color + * @param {string} options.timeoutEmbedColor Game's embed timeout color + * @param {string} options.xEmoji Emoji for X + * @param {string} options.oEmoji Emoji for O + * @param {string} options.idleEmoji Emoji for "nothing" + * @returns {Promise} + */ +export async function tictactoe(interaction, options = {}) { + // eslint-disable-next-line no-async-promise-executor + return new Promise(async resolve => { + try { + const { client } = interaction; + let opponent; + + if (interaction.commandId) { + opponent = interaction.options.getUser(options.userSlash || "user"); + + if (!opponent) { + return interaction.reply({ + content: interaction.translate("fun/tictactoe:NO_USER"), + ephemeral: true, + }); + } + + 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) { + return interaction.reply({ + content: interaction.translate("misc:CANT_YOURSELF"), + ephemeral: true, + }); + } + } else if (!interaction.commandId) { + opponent = interaction.mentions.members.first()?.user; + + if (!opponent) { + return interaction.reply({ + content: interaction.translate("fun/tictactoe:NO_USER"), + }); + } + + if (opponent.bot) { + return interaction.reply({ + content: interaction.translate("fun/tictactoe:BOT_USER"), + ephemeral: true, + }); + } + + if (opponent.id === interaction.member.id) { + return interaction.reply({ + content: interaction.translate("misc:CANT_YOURSELF"), + }); + } + } + + const footer = options.embedFooter || client.config.embed.footer, + color = options.embedColor || client.config.embed.color, + user = interaction.user ? interaction.user : interaction.author; + + const acceptEmbed = client.embed({ + author: { + name: user.getUsername(), + iconURL: user.displayAvatarURL(), + }, + title: interaction.translate("fun/tictactoe:REQUEST_WAIT", { + user: opponent.getUsername(), + }), + color, + footer, + }); + + const accept = new ButtonBuilder().setLabel(interaction.translate("common:ACCEPT")).setStyle(ButtonStyle.Success).setCustomId("acceptttt"); + const decline = new ButtonBuilder().setLabel(interaction.translate("common:DECLINE")).setStyle(ButtonStyle.Danger).setCustomId("declinettt"); + const accep = new ActionRowBuilder().addComponents([accept, decline]); + + const m = await interaction.reply({ + content: interaction.translate("fun/tictactoe:INVITE_USER", { + opponent: opponent.id, + }), + embeds: [acceptEmbed], + components: [accep], + fetchReply: true, + }); + + const collector = m.createMessageComponentCollector({ + componentType: ComponentType.Button, + time: 30 * 1000, + }); + + collector.on("collect", async button => { + 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") { + button.deferUpdate(); + return collector.stop("decline"); + } 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 xEmoji = options.xEmoji || "❌"; + const oEmoji = options.oEmoji || "⭕"; + + const dashmoji = options.idleEmoji || "➖"; + + const Args = { + user: 0, + a1: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + a2: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + a3: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + b1: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + b2: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + b3: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + c1: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + c2: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + c3: { + style: ButtonStyle.Secondary, + emoji: dashmoji, + disabled: false, + }, + }; + + const epm = client.embed({ + title: interaction.translate("fun/tictactoe:DESCRIPTION"), + color, + footer, + }); + + let msg; + if (interaction.commandId) { + msg = await interaction.editReply({ + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WAITING", { + user: Args.userid, + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } 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(oEmoji) || "⭕", + }), + ), + ], + }); + } + + await ttt(msg); + + async function ttt(m) { + Args.userid = fighters[Args.user]; + const won = { + "<:O_:863314110560993340>": false, + "<:X_:863314044781723668>": false, + }; + + const a1 = new ButtonBuilder().setStyle(Args.a1.style).setEmoji(Args.a1.emoji).setCustomId("a1").setDisabled(Args.a1.disabled); + const a2 = new ButtonBuilder().setStyle(Args.a2.style).setEmoji(Args.a2.emoji).setCustomId("a2").setDisabled(Args.a2.disabled); + const a3 = new ButtonBuilder().setStyle(Args.a3.style).setEmoji(Args.a3.emoji).setCustomId("a3").setDisabled(Args.a3.disabled); + const b1 = new ButtonBuilder().setStyle(Args.b1.style).setEmoji(Args.b1.emoji).setCustomId("b1").setDisabled(Args.b1.disabled); + const b2 = new ButtonBuilder().setStyle(Args.b2.style).setEmoji(Args.b2.emoji).setCustomId("b2").setDisabled(Args.b2.disabled); + const b3 = new ButtonBuilder().setStyle(Args.b3.style).setEmoji(Args.b3.emoji).setCustomId("b3").setDisabled(Args.b3.disabled); + const c1 = new ButtonBuilder().setStyle(Args.c1.style).setEmoji(Args.c1.emoji).setCustomId("c1").setDisabled(Args.c1.disabled); + const c2 = new ButtonBuilder().setStyle(Args.c2.style).setEmoji(Args.c2.emoji).setCustomId("c2").setDisabled(Args.c2.disabled); + const c3 = new ButtonBuilder().setStyle(Args.c3.style).setEmoji(Args.c3.emoji).setCustomId("c3").setDisabled(Args.c3.disabled); + const a = new ActionRowBuilder().addComponents([a1, a2, a3]); + const b = new ActionRowBuilder().addComponents([b1, b2, b3]); + const c = new ActionRowBuilder().addComponents([c1, c2, c3]); + const buttons = [a, b, c]; + + 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>"] !== 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(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(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(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 === 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(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(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}>`, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WAITING", { + user: Args.userid, + emoji: Args.user === 0 ? `${client.emojis.cache.get(oEmoji) || "⭕"}` : `${client.emojis.cache.get(xEmoji) || "❌"}`, + }), + ), + ], + components: [a, b, c], + }); + + const collector = m.createMessageComponentCollector({ + componentType: ComponentType.Button, + max: 1, + }); + + collector.on("collect", b => { + if (b.user.id !== Args.userid) { + b.reply({ + content: interaction.translate("fun/tictactoe:CANT_PLAY"), + ephemeral: true, + }); + + ttt(m); + } else { + if (Args.user === 0) { + Args.user = 1; + Args[b.customId] = { + style: ButtonStyle.Success, + emoji: oEmoji, + disabled: true, + }; + } else { + Args.user = 0; + Args[b.customId] = { + style: ButtonStyle.Danger, + emoji: xEmoji, + disabled: true, + }; + } + b.deferUpdate(); + const map = (obj, fun) => + Object.entries(obj).reduce( + (prev, [key, value]) => ({ + ...prev, + [key]: fun(key, value), + }), + {}, + ); + const objectFilter = (obj, predicate) => + Object.keys(obj) + .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, + ); + + 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; + 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 { + return m + .edit({ + content: interaction.translate("fun/tictactoe:TIE"), + embeds: [ + epm.setDescription( + `${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(() => {}); + } + } + } + + ttt(m); + } + }); + collector.on("end", (collected, reason) => { + 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") { + const embed = client.embed({ + author: { + name: user.getUsername(), + iconURL: user.displayAvatarURL(), + }, + title: interaction.translate("fun/tictactoe:NO_ANSWER_TITLE"), + description: interaction.translate("misc:TIMED_OUT"), + color: options.timeoutEmbedColor || "#C90000", + footer, + }); + + m.interaction.editReply({ + content: interaction.translate("fun/tictactoe:NOT_ANSWERED", { + user: opponent.id, + }), + embeds: [embed], + components: [], + }); + } + if (reason === "decline") { + const embed = client.embed({ + author: { + name: user.getUsername(), + iconURL: user.displayAvatarURL(), + }, + title: interaction.translate("fun/tictactoe:CANCELED"), + description: interaction.translate("fun/tictactoe:CANCELED_DESC", { + user: opponent.id, + }), + color: options.timeoutEmbedColor || "#C90000", + footer, + }); + + m.interaction.editReply({ + embeds: [embed], + components: [], + }); + } + }); + } catch (e) { + console.log("TicTacToe errored:", e); + } + }); +}; diff --git a/src/index.js b/src/index.js new file mode 100644 index 00000000..70f4de55 --- /dev/null +++ b/src/index.js @@ -0,0 +1,18 @@ +import { ExtendedClient } from "./structures/client.js"; +import logger from "./helpers/logger.js"; +import { CLIENT_INTENTS, CLIENT_ALLOWED_MENTIONS } from "./constants/index.js"; + +const client = new ExtendedClient({ + intents: CLIENT_INTENTS, + allowedMentions: CLIENT_ALLOWED_MENTIONS, +}); + +client.init(); + +client + .on("disconnect", () => logger.warn("Bot disconnected.")) + .on("reconnecting", () => logger.warn("Bot reconnecting...")) + .on("warn", logger.log) + .on("error", logger.log); + +process.on("unhandledRejection", logger.log).on("uncaughtException", logger.log); diff --git a/src/models/GuildModel.js b/src/models/GuildModel.js new file mode 100644 index 00000000..d52c2a54 --- /dev/null +++ b/src/models/GuildModel.js @@ -0,0 +1,59 @@ +import { model, Schema } from "mongoose"; +import useClient from "../utils/use-client.js"; + +const client = useClient(); + +export default model( + "Guild", + new Schema({ + id: { type: String }, + + membersData: { type: Object, default: {} }, + members: [{ type: Schema.Types.ObjectId, ref: "Member" }], + + language: { type: String, default: client.configService.get("defaultLang") }, + 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, + }, + }, + }), +); diff --git a/src/models/MemberModel.js b/src/models/MemberModel.js new file mode 100644 index 00000000..59aeec04 --- /dev/null +++ b/src/models/MemberModel.js @@ -0,0 +1,36 @@ +import { model, Schema } from "mongoose"; + +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: [] }, + + registeredAt: { type: Number, default: Date.now() }, + + cooldowns: { + type: Object, + default: { + work: 0, + rob: 0, + }, + }, + + sanctions: { type: Array, default: [] }, + mute: { + type: Object, + default: { + muted: false, + case: null, + endDate: null, + }, + }, + }), +); diff --git a/base/User.js b/src/models/UserModel.js similarity index 58% rename from base/User.js rename to src/models/UserModel.js index c455a4c4..e86ba80b 100644 --- a/base/User.js +++ b/src/models/UserModel.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/src/services/config/index.js b/src/services/config/index.js new file mode 100644 index 00000000..d4a67192 --- /dev/null +++ b/src/services/config/index.js @@ -0,0 +1,63 @@ +import fs from "fs"; +import { CONFIG_PATH } from "../../constants/index.js"; +import logger from "../../helpers/logger.js"; + +class ConfigService { + constructor() { + this.config = this.#loadConfig(); + } + + /** + * + * @param {string} key - key of the config + * @returns {*} - value of the config + */ + get(key) { + const keys = key.split("."); + return keys.reduce((config, k) => (config && config[k] !== undefined ? config[k] : undefined), this.config); + } + + /** + * Set a config value. + * @param {string} key - key of the config to set + * @param {*} value - value to set + */ + set(key, value) { + const keys = key.split("."); + keys.reduce((config, k, i) => { + if (i === keys.length - 1) { + config[k] = value; + } else { + config[k] = config[k] || {}; + } + return config[k]; + }, this.config); + this.#saveConfig(); + } + + /** + * Load the config from the file. + * @returns {Config} - loaded config + */ + #loadConfig() { + if (fs.existsSync(CONFIG_PATH)) { + return JSON.parse(fs.readFileSync(CONFIG_PATH, "utf-8")); + } else { + logger.error("Config file not found"); + process.exit(1); + } + } + + /** + * Save the config to the file. + */ + #saveConfig() { + try { + fs.writeFileSync(CONFIG_PATH, JSON.stringify(this.config, null, 4), "utf-8"); + } catch (e) { + logger.error("Failed to save config: ", e); + } + } +} + +export default ConfigService; diff --git a/src/services/languages/index.js b/src/services/languages/index.js new file mode 100644 index 00000000..a2cd78b9 --- /dev/null +++ b/src/services/languages/index.js @@ -0,0 +1,71 @@ +import i18next from "i18next"; +import Backend from "i18next-fs-backend"; +import fs from "fs/promises"; +import { resolve, join } from "path"; +import logger from "../../helpers/logger.js"; +import supportedLanguages from "./language-meta.js"; + +export default class InternationalizationService { + /** + * Constructs an instance of the InternationalizationService. + * + * @param {import("../../index.js").client} client - The client instance. + * @param {Object} [options={}] - Optional configuration options. + */ + constructor(client, options = {}) { + this.client = client; + this.options = { + localesPath: resolve(this.client.configService.get("paths.locales")), + defaultLanguage: options.defaultLanguage || "en-US", + }; + this.i18next = this.#init(); + } + + get getSupportedLanguages() { + return supportedLanguages.map(lang => lang.locale); + } + + async #walkDirectory(dir, namespaces = [], folderName = "") { + const files = await fs.readdir(dir, { withFileTypes: true }); + + const languages = []; + for (const file of files) { + if (file.isDirectory()) { + const isLanguage = file.name.includes("-"); + if (isLanguage) languages.push(file.name); + + const folder = await this.#walkDirectory(join(dir, file.name), namespaces, isLanguage ? "" : `${file.name}/`); + + namespaces = folder.namespaces; + } else { + namespaces.push(`${folderName}${file.name.substr(0, file.name.length - 5)}`); + } + } + return { namespaces: [...new Set(namespaces)], languages }; + } + + async #init() { + const { namespaces, languages } = await this.#walkDirectory(this.options.localesPath); + + const i18n = await i18next.use(Backend).init({ + backend: { + loadPath: resolve(this.options.localesPath, "./{{lng}}/{{ns}}.json"), + }, + debug: this.client.configService.get("production") ? false : true, + fallbackLng: this.options.defaultLanguage, + preload: languages, + ns: namespaces, + defaultNS: namespaces[0], + initImmediate: false, + }); + + this.client.translate = (key, options = {}) => { + const lng = options.lng || this.options.defaultLanguage; + return i18next.t(key, { lng, ...options }); + }; + + logger.log("Internationalization initialized"); + + return i18n; + } +} diff --git a/src/services/languages/language-meta.js b/src/services/languages/language-meta.js new file mode 100644 index 00000000..b0d9bab9 --- /dev/null +++ b/src/services/languages/language-meta.js @@ -0,0 +1,20 @@ +export default [ + { + name: "en-US", + nativeName: "English", + locale: "en-US", + format: "HH:mm:ss, MMMM Do YYYY", + }, + { + name: "ru-RU", + nativeName: "Русский", + locale: "ru-RU", + format: "HH:mm:ss, Do MMMM YYYY", + }, + { + name: "uk-UA", + nativeName: "Українська", + locale: "uk-UA", + format: "HH:mm:ss, Do MMMM YYYY", + }, +]; diff --git a/languages/en-US/administration/addemoji.json b/src/services/languages/locales/en-US/administration/addemoji.json similarity index 100% rename from languages/en-US/administration/addemoji.json rename to src/services/languages/locales/en-US/administration/addemoji.json diff --git a/languages/en-US/administration/automod.json b/src/services/languages/locales/en-US/administration/automod.json similarity index 100% rename from languages/en-US/administration/automod.json rename to src/services/languages/locales/en-US/administration/automod.json diff --git a/languages/en-US/administration/autorole.json b/src/services/languages/locales/en-US/administration/autorole.json similarity index 100% rename from languages/en-US/administration/autorole.json rename to src/services/languages/locales/en-US/administration/autorole.json diff --git a/languages/en-US/administration/config.json b/src/services/languages/locales/en-US/administration/config.json similarity index 93% rename from languages/en-US/administration/config.json rename to src/services/languages/locales/en-US/administration/config.json index ec9ec653..29fc99cf 100644 --- a/languages/en-US/administration/config.json +++ b/src/services/languages/locales/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/administration/deletemod.json b/src/services/languages/locales/en-US/administration/deletemod.json similarity index 100% rename from languages/en-US/administration/deletemod.json rename to src/services/languages/locales/en-US/administration/deletemod.json diff --git a/languages/en-US/administration/goodbye.json b/src/services/languages/locales/en-US/administration/goodbye.json similarity index 100% rename from languages/en-US/administration/goodbye.json rename to src/services/languages/locales/en-US/administration/goodbye.json diff --git a/languages/en-US/administration/selectroles.json b/src/services/languages/locales/en-US/administration/selectroles.json similarity index 100% rename from languages/en-US/administration/selectroles.json rename to src/services/languages/locales/en-US/administration/selectroles.json diff --git a/languages/en-US/administration/set.json b/src/services/languages/locales/en-US/administration/set.json similarity index 100% rename from languages/en-US/administration/set.json rename to src/services/languages/locales/en-US/administration/set.json diff --git a/languages/en-US/administration/setlang.json b/src/services/languages/locales/en-US/administration/setlang.json similarity index 100% rename from languages/en-US/administration/setlang.json rename to src/services/languages/locales/en-US/administration/setlang.json diff --git a/languages/en-US/administration/stealemoji.json b/src/services/languages/locales/en-US/administration/stealemoji.json similarity index 100% rename from languages/en-US/administration/stealemoji.json rename to src/services/languages/locales/en-US/administration/stealemoji.json diff --git a/languages/en-US/administration/welcome.json b/src/services/languages/locales/en-US/administration/welcome.json similarity index 100% rename from languages/en-US/administration/welcome.json rename to src/services/languages/locales/en-US/administration/welcome.json diff --git a/languages/en-US/beatrun/courses.json b/src/services/languages/locales/en-US/beatrun/courses.json similarity index 100% rename from languages/en-US/beatrun/courses.json rename to src/services/languages/locales/en-US/beatrun/courses.json diff --git a/languages/en-US/common.json b/src/services/languages/locales/en-US/common.json similarity index 100% rename from languages/en-US/common.json rename to src/services/languages/locales/en-US/common.json diff --git a/languages/en-US/economy/achievements.json b/src/services/languages/locales/en-US/economy/achievements.json similarity index 100% rename from languages/en-US/economy/achievements.json rename to src/services/languages/locales/en-US/economy/achievements.json diff --git a/languages/en-US/economy/bank.json b/src/services/languages/locales/en-US/economy/bank.json similarity index 100% rename from languages/en-US/economy/bank.json rename to src/services/languages/locales/en-US/economy/bank.json diff --git a/languages/en-US/economy/birthdate.json b/src/services/languages/locales/en-US/economy/birthdate.json similarity index 100% rename from languages/en-US/economy/birthdate.json rename to src/services/languages/locales/en-US/economy/birthdate.json diff --git a/languages/en-US/economy/divorce.json b/src/services/languages/locales/en-US/economy/divorce.json similarity index 100% rename from languages/en-US/economy/divorce.json rename to src/services/languages/locales/en-US/economy/divorce.json diff --git a/languages/en-US/economy/importmee6.json b/src/services/languages/locales/en-US/economy/importmee6.json similarity index 100% rename from languages/en-US/economy/importmee6.json rename to src/services/languages/locales/en-US/economy/importmee6.json diff --git a/languages/en-US/economy/leaderboard.json b/src/services/languages/locales/en-US/economy/leaderboard.json similarity index 100% rename from languages/en-US/economy/leaderboard.json rename to src/services/languages/locales/en-US/economy/leaderboard.json diff --git a/languages/en-US/economy/marry.json b/src/services/languages/locales/en-US/economy/marry.json similarity index 100% rename from languages/en-US/economy/marry.json rename to src/services/languages/locales/en-US/economy/marry.json diff --git a/languages/en-US/economy/money.json b/src/services/languages/locales/en-US/economy/money.json similarity index 100% rename from languages/en-US/economy/money.json rename to src/services/languages/locales/en-US/economy/money.json diff --git a/languages/en-US/economy/pay.json b/src/services/languages/locales/en-US/economy/pay.json similarity index 100% rename from languages/en-US/economy/pay.json rename to src/services/languages/locales/en-US/economy/pay.json diff --git a/languages/en-US/economy/profile.json b/src/services/languages/locales/en-US/economy/profile.json similarity index 100% rename from languages/en-US/economy/profile.json rename to src/services/languages/locales/en-US/economy/profile.json diff --git a/languages/en-US/economy/rep.json b/src/services/languages/locales/en-US/economy/rep.json similarity index 100% rename from languages/en-US/economy/rep.json rename to src/services/languages/locales/en-US/economy/rep.json diff --git a/languages/en-US/economy/rob.json b/src/services/languages/locales/en-US/economy/rob.json similarity index 100% rename from languages/en-US/economy/rob.json rename to src/services/languages/locales/en-US/economy/rob.json diff --git a/languages/en-US/economy/setbio.json b/src/services/languages/locales/en-US/economy/setbio.json similarity index 100% rename from languages/en-US/economy/setbio.json rename to src/services/languages/locales/en-US/economy/setbio.json diff --git a/languages/en-US/economy/slots.json b/src/services/languages/locales/en-US/economy/slots.json similarity index 100% rename from languages/en-US/economy/slots.json rename to src/services/languages/locales/en-US/economy/slots.json diff --git a/languages/en-US/economy/transactions.json b/src/services/languages/locales/en-US/economy/transactions.json similarity index 100% rename from languages/en-US/economy/transactions.json rename to src/services/languages/locales/en-US/economy/transactions.json diff --git a/languages/en-US/economy/work.json b/src/services/languages/locales/en-US/economy/work.json similarity index 100% rename from languages/en-US/economy/work.json rename to src/services/languages/locales/en-US/economy/work.json diff --git a/languages/en-US/fun/8ball.json b/src/services/languages/locales/en-US/fun/8ball.json similarity index 100% rename from languages/en-US/fun/8ball.json rename to src/services/languages/locales/en-US/fun/8ball.json diff --git a/languages/en-US/fun/cat.json b/src/services/languages/locales/en-US/fun/cat.json similarity index 100% rename from languages/en-US/fun/cat.json rename to src/services/languages/locales/en-US/fun/cat.json diff --git a/languages/en-US/fun/dog.json b/src/services/languages/locales/en-US/fun/dog.json similarity index 100% rename from languages/en-US/fun/dog.json rename to src/services/languages/locales/en-US/fun/dog.json diff --git a/languages/en-US/fun/lmgtfy.json b/src/services/languages/locales/en-US/fun/lmgtfy.json similarity index 100% rename from languages/en-US/fun/lmgtfy.json rename to src/services/languages/locales/en-US/fun/lmgtfy.json diff --git a/languages/en-US/fun/lovecalc.json b/src/services/languages/locales/en-US/fun/lovecalc.json similarity index 100% rename from languages/en-US/fun/lovecalc.json rename to src/services/languages/locales/en-US/fun/lovecalc.json diff --git a/languages/en-US/fun/memes.json b/src/services/languages/locales/en-US/fun/memes.json similarity index 100% rename from languages/en-US/fun/memes.json rename to src/services/languages/locales/en-US/fun/memes.json diff --git a/languages/en-US/fun/number.json b/src/services/languages/locales/en-US/fun/number.json similarity index 100% rename from languages/en-US/fun/number.json rename to src/services/languages/locales/en-US/fun/number.json diff --git a/languages/en-US/fun/tictactoe.json b/src/services/languages/locales/en-US/fun/tictactoe.json similarity index 100% rename from languages/en-US/fun/tictactoe.json rename to src/services/languages/locales/en-US/fun/tictactoe.json diff --git a/languages/en-US/general/afk.json b/src/services/languages/locales/en-US/general/afk.json similarity index 100% rename from languages/en-US/general/afk.json rename to src/services/languages/locales/en-US/general/afk.json diff --git a/languages/en-US/general/avatar.json b/src/services/languages/locales/en-US/general/avatar.json similarity index 100% rename from languages/en-US/general/avatar.json rename to src/services/languages/locales/en-US/general/avatar.json diff --git a/languages/en-US/general/boosters.json b/src/services/languages/locales/en-US/general/boosters.json similarity index 100% rename from languages/en-US/general/boosters.json rename to src/services/languages/locales/en-US/general/boosters.json diff --git a/languages/en-US/general/emoji.json b/src/services/languages/locales/en-US/general/emoji.json similarity index 100% rename from languages/en-US/general/emoji.json rename to src/services/languages/locales/en-US/general/emoji.json diff --git a/languages/en-US/general/help.json b/src/services/languages/locales/en-US/general/help.json similarity index 100% rename from languages/en-US/general/help.json rename to src/services/languages/locales/en-US/general/help.json diff --git a/languages/en-US/general/info.json b/src/services/languages/locales/en-US/general/info.json similarity index 100% rename from languages/en-US/general/info.json rename to src/services/languages/locales/en-US/general/info.json diff --git a/languages/en-US/general/minecraft.json b/src/services/languages/locales/en-US/general/minecraft.json similarity index 100% rename from languages/en-US/general/minecraft.json rename to src/services/languages/locales/en-US/general/minecraft.json diff --git a/languages/en-US/general/ping.json b/src/services/languages/locales/en-US/general/ping.json similarity index 100% rename from languages/en-US/general/ping.json rename to src/services/languages/locales/en-US/general/ping.json diff --git a/languages/en-US/general/remindme.json b/src/services/languages/locales/en-US/general/remindme.json similarity index 100% rename from languages/en-US/general/remindme.json rename to src/services/languages/locales/en-US/general/remindme.json diff --git a/languages/en-US/general/reminds.json b/src/services/languages/locales/en-US/general/reminds.json similarity index 100% rename from languages/en-US/general/reminds.json rename to src/services/languages/locales/en-US/general/reminds.json diff --git a/languages/en-US/general/report.json b/src/services/languages/locales/en-US/general/report.json similarity index 100% rename from languages/en-US/general/report.json rename to src/services/languages/locales/en-US/general/report.json diff --git a/languages/en-US/general/shorturl.json b/src/services/languages/locales/en-US/general/shorturl.json similarity index 100% rename from languages/en-US/general/shorturl.json rename to src/services/languages/locales/en-US/general/shorturl.json diff --git a/languages/en-US/general/staff.json b/src/services/languages/locales/en-US/general/staff.json similarity index 100% rename from languages/en-US/general/staff.json rename to src/services/languages/locales/en-US/general/staff.json diff --git a/languages/en-US/general/stats.json b/src/services/languages/locales/en-US/general/stats.json similarity index 100% rename from languages/en-US/general/stats.json rename to src/services/languages/locales/en-US/general/stats.json diff --git a/languages/en-US/general/suggest.json b/src/services/languages/locales/en-US/general/suggest.json similarity index 100% rename from languages/en-US/general/suggest.json rename to src/services/languages/locales/en-US/general/suggest.json diff --git a/languages/en-US/general/whois.json b/src/services/languages/locales/en-US/general/whois.json similarity index 100% rename from languages/en-US/general/whois.json rename to src/services/languages/locales/en-US/general/whois.json diff --git a/languages/en-US/iat/checkjar.json b/src/services/languages/locales/en-US/iat/checkjar.json similarity index 100% rename from languages/en-US/iat/checkjar.json rename to src/services/languages/locales/en-US/iat/checkjar.json diff --git a/languages/en-US/misc.json b/src/services/languages/locales/en-US/misc.json similarity index 100% rename from languages/en-US/misc.json rename to src/services/languages/locales/en-US/misc.json diff --git a/languages/en-US/moderation/ban.json b/src/services/languages/locales/en-US/moderation/ban.json similarity index 100% rename from languages/en-US/moderation/ban.json rename to src/services/languages/locales/en-US/moderation/ban.json diff --git a/languages/en-US/moderation/clear.json b/src/services/languages/locales/en-US/moderation/clear.json similarity index 100% rename from languages/en-US/moderation/clear.json rename to src/services/languages/locales/en-US/moderation/clear.json diff --git a/languages/en-US/moderation/clearwarns.json b/src/services/languages/locales/en-US/moderation/clearwarns.json similarity index 100% rename from languages/en-US/moderation/clearwarns.json rename to src/services/languages/locales/en-US/moderation/clearwarns.json diff --git a/languages/en-US/moderation/giveaway.json b/src/services/languages/locales/en-US/moderation/giveaway.json similarity index 100% rename from languages/en-US/moderation/giveaway.json rename to src/services/languages/locales/en-US/moderation/giveaway.json diff --git a/languages/en-US/moderation/kick.json b/src/services/languages/locales/en-US/moderation/kick.json similarity index 100% rename from languages/en-US/moderation/kick.json rename to src/services/languages/locales/en-US/moderation/kick.json diff --git a/languages/en-US/moderation/unban.json b/src/services/languages/locales/en-US/moderation/unban.json similarity index 100% rename from languages/en-US/moderation/unban.json rename to src/services/languages/locales/en-US/moderation/unban.json diff --git a/languages/en-US/moderation/untimeout.json b/src/services/languages/locales/en-US/moderation/untimeout.json similarity index 100% rename from languages/en-US/moderation/untimeout.json rename to src/services/languages/locales/en-US/moderation/untimeout.json diff --git a/languages/en-US/moderation/warn.json b/src/services/languages/locales/en-US/moderation/warn.json similarity index 100% rename from languages/en-US/moderation/warn.json rename to src/services/languages/locales/en-US/moderation/warn.json diff --git a/languages/en-US/moderation/warns.json b/src/services/languages/locales/en-US/moderation/warns.json similarity index 100% rename from languages/en-US/moderation/warns.json rename to src/services/languages/locales/en-US/moderation/warns.json diff --git a/languages/en-US/music/back.json b/src/services/languages/locales/en-US/music/back.json similarity index 100% rename from languages/en-US/music/back.json rename to src/services/languages/locales/en-US/music/back.json diff --git a/languages/en-US/music/clips.json b/src/services/languages/locales/en-US/music/clips.json similarity index 100% rename from languages/en-US/music/clips.json rename to src/services/languages/locales/en-US/music/clips.json diff --git a/languages/en-US/music/loop.json b/src/services/languages/locales/en-US/music/loop.json similarity index 100% rename from languages/en-US/music/loop.json rename to src/services/languages/locales/en-US/music/loop.json diff --git a/languages/en-US/music/nowplaying.json b/src/services/languages/locales/en-US/music/nowplaying.json similarity index 100% rename from languages/en-US/music/nowplaying.json rename to src/services/languages/locales/en-US/music/nowplaying.json diff --git a/languages/en-US/music/play.json b/src/services/languages/locales/en-US/music/play.json similarity index 100% rename from languages/en-US/music/play.json rename to src/services/languages/locales/en-US/music/play.json diff --git a/languages/en-US/music/queue.json b/src/services/languages/locales/en-US/music/queue.json similarity index 100% rename from languages/en-US/music/queue.json rename to src/services/languages/locales/en-US/music/queue.json diff --git a/languages/en-US/music/seek.json b/src/services/languages/locales/en-US/music/seek.json similarity index 100% rename from languages/en-US/music/seek.json rename to src/services/languages/locales/en-US/music/seek.json diff --git a/languages/en-US/music/shuffle.json b/src/services/languages/locales/en-US/music/shuffle.json similarity index 100% rename from languages/en-US/music/shuffle.json rename to src/services/languages/locales/en-US/music/shuffle.json diff --git a/languages/en-US/music/skip.json b/src/services/languages/locales/en-US/music/skip.json similarity index 100% rename from languages/en-US/music/skip.json rename to src/services/languages/locales/en-US/music/skip.json diff --git a/languages/en-US/music/stop.json b/src/services/languages/locales/en-US/music/stop.json similarity index 100% rename from languages/en-US/music/stop.json rename to src/services/languages/locales/en-US/music/stop.json diff --git a/languages/en-US/music/volume.json b/src/services/languages/locales/en-US/music/volume.json similarity index 100% rename from languages/en-US/music/volume.json rename to src/services/languages/locales/en-US/music/volume.json diff --git a/languages/en-US/owner/announcement.json b/src/services/languages/locales/en-US/owner/announcement.json similarity index 100% rename from languages/en-US/owner/announcement.json rename to src/services/languages/locales/en-US/owner/announcement.json diff --git a/languages/en-US/owner/debug.json b/src/services/languages/locales/en-US/owner/debug.json similarity index 100% rename from languages/en-US/owner/debug.json rename to src/services/languages/locales/en-US/owner/debug.json diff --git a/languages/en-US/owner/eval.json b/src/services/languages/locales/en-US/owner/eval.json similarity index 100% rename from languages/en-US/owner/eval.json rename to src/services/languages/locales/en-US/owner/eval.json diff --git a/languages/en-US/owner/reload.json b/src/services/languages/locales/en-US/owner/reload.json similarity index 100% rename from languages/en-US/owner/reload.json rename to src/services/languages/locales/en-US/owner/reload.json diff --git a/languages/en-US/owner/say.json b/src/services/languages/locales/en-US/owner/say.json similarity index 100% rename from languages/en-US/owner/say.json rename to src/services/languages/locales/en-US/owner/say.json diff --git a/languages/en-US/owner/servers.json b/src/services/languages/locales/en-US/owner/servers.json similarity index 100% rename from languages/en-US/owner/servers.json rename to src/services/languages/locales/en-US/owner/servers.json diff --git a/languages/en-US/tickets/adduser.json b/src/services/languages/locales/en-US/tickets/adduser.json similarity index 100% rename from languages/en-US/tickets/adduser.json rename to src/services/languages/locales/en-US/tickets/adduser.json diff --git a/languages/en-US/tickets/closeticket.json b/src/services/languages/locales/en-US/tickets/closeticket.json similarity index 100% rename from languages/en-US/tickets/closeticket.json rename to src/services/languages/locales/en-US/tickets/closeticket.json diff --git a/languages/en-US/tickets/createticketembed.json b/src/services/languages/locales/en-US/tickets/createticketembed.json similarity index 100% rename from languages/en-US/tickets/createticketembed.json rename to src/services/languages/locales/en-US/tickets/createticketembed.json diff --git a/languages/en-US/tickets/removeuser.json b/src/services/languages/locales/en-US/tickets/removeuser.json similarity index 100% rename from languages/en-US/tickets/removeuser.json rename to src/services/languages/locales/en-US/tickets/removeuser.json diff --git a/languages/ru-RU/administration/addemoji.json b/src/services/languages/locales/ru-RU/administration/addemoji.json similarity index 100% rename from languages/ru-RU/administration/addemoji.json rename to src/services/languages/locales/ru-RU/administration/addemoji.json diff --git a/languages/ru-RU/administration/automod.json b/src/services/languages/locales/ru-RU/administration/automod.json similarity index 100% rename from languages/ru-RU/administration/automod.json rename to src/services/languages/locales/ru-RU/administration/automod.json diff --git a/languages/ru-RU/administration/autorole.json b/src/services/languages/locales/ru-RU/administration/autorole.json similarity index 100% rename from languages/ru-RU/administration/autorole.json rename to src/services/languages/locales/ru-RU/administration/autorole.json diff --git a/languages/ru-RU/administration/config.json b/src/services/languages/locales/ru-RU/administration/config.json similarity index 91% rename from languages/ru-RU/administration/config.json rename to src/services/languages/locales/ru-RU/administration/config.json index 277325d3..eb229e73 100644 --- a/languages/ru-RU/administration/config.json +++ b/src/services/languages/locales/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/administration/deletemod.json b/src/services/languages/locales/ru-RU/administration/deletemod.json similarity index 100% rename from languages/ru-RU/administration/deletemod.json rename to src/services/languages/locales/ru-RU/administration/deletemod.json diff --git a/languages/ru-RU/administration/goodbye.json b/src/services/languages/locales/ru-RU/administration/goodbye.json similarity index 100% rename from languages/ru-RU/administration/goodbye.json rename to src/services/languages/locales/ru-RU/administration/goodbye.json diff --git a/languages/ru-RU/administration/selectroles.json b/src/services/languages/locales/ru-RU/administration/selectroles.json similarity index 100% rename from languages/ru-RU/administration/selectroles.json rename to src/services/languages/locales/ru-RU/administration/selectroles.json diff --git a/languages/ru-RU/administration/set.json b/src/services/languages/locales/ru-RU/administration/set.json similarity index 100% rename from languages/ru-RU/administration/set.json rename to src/services/languages/locales/ru-RU/administration/set.json diff --git a/languages/ru-RU/administration/setlang.json b/src/services/languages/locales/ru-RU/administration/setlang.json similarity index 100% rename from languages/ru-RU/administration/setlang.json rename to src/services/languages/locales/ru-RU/administration/setlang.json diff --git a/languages/ru-RU/administration/stealemoji.json b/src/services/languages/locales/ru-RU/administration/stealemoji.json similarity index 100% rename from languages/ru-RU/administration/stealemoji.json rename to src/services/languages/locales/ru-RU/administration/stealemoji.json diff --git a/languages/ru-RU/administration/welcome.json b/src/services/languages/locales/ru-RU/administration/welcome.json similarity index 100% rename from languages/ru-RU/administration/welcome.json rename to src/services/languages/locales/ru-RU/administration/welcome.json diff --git a/languages/ru-RU/beatrun/courses.json b/src/services/languages/locales/ru-RU/beatrun/courses.json similarity index 100% rename from languages/ru-RU/beatrun/courses.json rename to src/services/languages/locales/ru-RU/beatrun/courses.json diff --git a/languages/ru-RU/common.json b/src/services/languages/locales/ru-RU/common.json similarity index 100% rename from languages/ru-RU/common.json rename to src/services/languages/locales/ru-RU/common.json diff --git a/languages/ru-RU/economy/achievements.json b/src/services/languages/locales/ru-RU/economy/achievements.json similarity index 100% rename from languages/ru-RU/economy/achievements.json rename to src/services/languages/locales/ru-RU/economy/achievements.json diff --git a/languages/ru-RU/economy/bank.json b/src/services/languages/locales/ru-RU/economy/bank.json similarity index 100% rename from languages/ru-RU/economy/bank.json rename to src/services/languages/locales/ru-RU/economy/bank.json diff --git a/languages/ru-RU/economy/birthdate.json b/src/services/languages/locales/ru-RU/economy/birthdate.json similarity index 100% rename from languages/ru-RU/economy/birthdate.json rename to src/services/languages/locales/ru-RU/economy/birthdate.json diff --git a/languages/ru-RU/economy/divorce.json b/src/services/languages/locales/ru-RU/economy/divorce.json similarity index 100% rename from languages/ru-RU/economy/divorce.json rename to src/services/languages/locales/ru-RU/economy/divorce.json diff --git a/languages/ru-RU/economy/importmee6.json b/src/services/languages/locales/ru-RU/economy/importmee6.json similarity index 100% rename from languages/ru-RU/economy/importmee6.json rename to src/services/languages/locales/ru-RU/economy/importmee6.json diff --git a/languages/ru-RU/economy/leaderboard.json b/src/services/languages/locales/ru-RU/economy/leaderboard.json similarity index 100% rename from languages/ru-RU/economy/leaderboard.json rename to src/services/languages/locales/ru-RU/economy/leaderboard.json diff --git a/languages/ru-RU/economy/marry.json b/src/services/languages/locales/ru-RU/economy/marry.json similarity index 100% rename from languages/ru-RU/economy/marry.json rename to src/services/languages/locales/ru-RU/economy/marry.json diff --git a/languages/ru-RU/economy/money.json b/src/services/languages/locales/ru-RU/economy/money.json similarity index 100% rename from languages/ru-RU/economy/money.json rename to src/services/languages/locales/ru-RU/economy/money.json diff --git a/languages/ru-RU/economy/pay.json b/src/services/languages/locales/ru-RU/economy/pay.json similarity index 100% rename from languages/ru-RU/economy/pay.json rename to src/services/languages/locales/ru-RU/economy/pay.json diff --git a/languages/ru-RU/economy/profile.json b/src/services/languages/locales/ru-RU/economy/profile.json similarity index 100% rename from languages/ru-RU/economy/profile.json rename to src/services/languages/locales/ru-RU/economy/profile.json diff --git a/languages/ru-RU/economy/rep.json b/src/services/languages/locales/ru-RU/economy/rep.json similarity index 100% rename from languages/ru-RU/economy/rep.json rename to src/services/languages/locales/ru-RU/economy/rep.json diff --git a/languages/ru-RU/economy/rob.json b/src/services/languages/locales/ru-RU/economy/rob.json similarity index 100% rename from languages/ru-RU/economy/rob.json rename to src/services/languages/locales/ru-RU/economy/rob.json diff --git a/languages/ru-RU/economy/setbio.json b/src/services/languages/locales/ru-RU/economy/setbio.json similarity index 100% rename from languages/ru-RU/economy/setbio.json rename to src/services/languages/locales/ru-RU/economy/setbio.json diff --git a/languages/ru-RU/economy/slots.json b/src/services/languages/locales/ru-RU/economy/slots.json similarity index 100% rename from languages/ru-RU/economy/slots.json rename to src/services/languages/locales/ru-RU/economy/slots.json diff --git a/languages/ru-RU/economy/transactions.json b/src/services/languages/locales/ru-RU/economy/transactions.json similarity index 100% rename from languages/ru-RU/economy/transactions.json rename to src/services/languages/locales/ru-RU/economy/transactions.json diff --git a/languages/ru-RU/economy/work.json b/src/services/languages/locales/ru-RU/economy/work.json similarity index 100% rename from languages/ru-RU/economy/work.json rename to src/services/languages/locales/ru-RU/economy/work.json diff --git a/languages/ru-RU/fun/8ball.json b/src/services/languages/locales/ru-RU/fun/8ball.json similarity index 100% rename from languages/ru-RU/fun/8ball.json rename to src/services/languages/locales/ru-RU/fun/8ball.json diff --git a/languages/ru-RU/fun/cat.json b/src/services/languages/locales/ru-RU/fun/cat.json similarity index 100% rename from languages/ru-RU/fun/cat.json rename to src/services/languages/locales/ru-RU/fun/cat.json diff --git a/languages/ru-RU/fun/dog.json b/src/services/languages/locales/ru-RU/fun/dog.json similarity index 100% rename from languages/ru-RU/fun/dog.json rename to src/services/languages/locales/ru-RU/fun/dog.json diff --git a/languages/ru-RU/fun/lmgtfy.json b/src/services/languages/locales/ru-RU/fun/lmgtfy.json similarity index 100% rename from languages/ru-RU/fun/lmgtfy.json rename to src/services/languages/locales/ru-RU/fun/lmgtfy.json diff --git a/languages/ru-RU/fun/lovecalc.json b/src/services/languages/locales/ru-RU/fun/lovecalc.json similarity index 100% rename from languages/ru-RU/fun/lovecalc.json rename to src/services/languages/locales/ru-RU/fun/lovecalc.json diff --git a/languages/ru-RU/fun/memes.json b/src/services/languages/locales/ru-RU/fun/memes.json similarity index 100% rename from languages/ru-RU/fun/memes.json rename to src/services/languages/locales/ru-RU/fun/memes.json diff --git a/languages/ru-RU/fun/number.json b/src/services/languages/locales/ru-RU/fun/number.json similarity index 100% rename from languages/ru-RU/fun/number.json rename to src/services/languages/locales/ru-RU/fun/number.json diff --git a/languages/ru-RU/fun/tictactoe.json b/src/services/languages/locales/ru-RU/fun/tictactoe.json similarity index 100% rename from languages/ru-RU/fun/tictactoe.json rename to src/services/languages/locales/ru-RU/fun/tictactoe.json diff --git a/languages/ru-RU/general/afk.json b/src/services/languages/locales/ru-RU/general/afk.json similarity index 100% rename from languages/ru-RU/general/afk.json rename to src/services/languages/locales/ru-RU/general/afk.json diff --git a/languages/ru-RU/general/avatar.json b/src/services/languages/locales/ru-RU/general/avatar.json similarity index 100% rename from languages/ru-RU/general/avatar.json rename to src/services/languages/locales/ru-RU/general/avatar.json diff --git a/languages/ru-RU/general/boosters.json b/src/services/languages/locales/ru-RU/general/boosters.json similarity index 100% rename from languages/ru-RU/general/boosters.json rename to src/services/languages/locales/ru-RU/general/boosters.json diff --git a/languages/ru-RU/general/emoji.json b/src/services/languages/locales/ru-RU/general/emoji.json similarity index 100% rename from languages/ru-RU/general/emoji.json rename to src/services/languages/locales/ru-RU/general/emoji.json diff --git a/languages/ru-RU/general/help.json b/src/services/languages/locales/ru-RU/general/help.json similarity index 100% rename from languages/ru-RU/general/help.json rename to src/services/languages/locales/ru-RU/general/help.json diff --git a/languages/ru-RU/general/info.json b/src/services/languages/locales/ru-RU/general/info.json similarity index 100% rename from languages/ru-RU/general/info.json rename to src/services/languages/locales/ru-RU/general/info.json diff --git a/languages/ru-RU/general/minecraft.json b/src/services/languages/locales/ru-RU/general/minecraft.json similarity index 100% rename from languages/ru-RU/general/minecraft.json rename to src/services/languages/locales/ru-RU/general/minecraft.json diff --git a/languages/ru-RU/general/ping.json b/src/services/languages/locales/ru-RU/general/ping.json similarity index 100% rename from languages/ru-RU/general/ping.json rename to src/services/languages/locales/ru-RU/general/ping.json diff --git a/languages/ru-RU/general/remindme.json b/src/services/languages/locales/ru-RU/general/remindme.json similarity index 100% rename from languages/ru-RU/general/remindme.json rename to src/services/languages/locales/ru-RU/general/remindme.json diff --git a/languages/ru-RU/general/reminds.json b/src/services/languages/locales/ru-RU/general/reminds.json similarity index 100% rename from languages/ru-RU/general/reminds.json rename to src/services/languages/locales/ru-RU/general/reminds.json diff --git a/languages/ru-RU/general/report.json b/src/services/languages/locales/ru-RU/general/report.json similarity index 100% rename from languages/ru-RU/general/report.json rename to src/services/languages/locales/ru-RU/general/report.json diff --git a/languages/ru-RU/general/shorturl.json b/src/services/languages/locales/ru-RU/general/shorturl.json similarity index 100% rename from languages/ru-RU/general/shorturl.json rename to src/services/languages/locales/ru-RU/general/shorturl.json diff --git a/languages/ru-RU/general/staff.json b/src/services/languages/locales/ru-RU/general/staff.json similarity index 100% rename from languages/ru-RU/general/staff.json rename to src/services/languages/locales/ru-RU/general/staff.json diff --git a/languages/ru-RU/general/stats.json b/src/services/languages/locales/ru-RU/general/stats.json similarity index 100% rename from languages/ru-RU/general/stats.json rename to src/services/languages/locales/ru-RU/general/stats.json diff --git a/languages/ru-RU/general/suggest.json b/src/services/languages/locales/ru-RU/general/suggest.json similarity index 100% rename from languages/ru-RU/general/suggest.json rename to src/services/languages/locales/ru-RU/general/suggest.json diff --git a/languages/ru-RU/general/whois.json b/src/services/languages/locales/ru-RU/general/whois.json similarity index 100% rename from languages/ru-RU/general/whois.json rename to src/services/languages/locales/ru-RU/general/whois.json diff --git a/languages/ru-RU/iat/checkjar.json b/src/services/languages/locales/ru-RU/iat/checkjar.json similarity index 100% rename from languages/ru-RU/iat/checkjar.json rename to src/services/languages/locales/ru-RU/iat/checkjar.json diff --git a/languages/ru-RU/misc.json b/src/services/languages/locales/ru-RU/misc.json similarity index 100% rename from languages/ru-RU/misc.json rename to src/services/languages/locales/ru-RU/misc.json diff --git a/languages/ru-RU/moderation/ban.json b/src/services/languages/locales/ru-RU/moderation/ban.json similarity index 100% rename from languages/ru-RU/moderation/ban.json rename to src/services/languages/locales/ru-RU/moderation/ban.json diff --git a/languages/ru-RU/moderation/clear.json b/src/services/languages/locales/ru-RU/moderation/clear.json similarity index 100% rename from languages/ru-RU/moderation/clear.json rename to src/services/languages/locales/ru-RU/moderation/clear.json diff --git a/languages/ru-RU/moderation/clearwarns.json b/src/services/languages/locales/ru-RU/moderation/clearwarns.json similarity index 100% rename from languages/ru-RU/moderation/clearwarns.json rename to src/services/languages/locales/ru-RU/moderation/clearwarns.json diff --git a/languages/ru-RU/moderation/giveaway.json b/src/services/languages/locales/ru-RU/moderation/giveaway.json similarity index 100% rename from languages/ru-RU/moderation/giveaway.json rename to src/services/languages/locales/ru-RU/moderation/giveaway.json diff --git a/languages/ru-RU/moderation/kick.json b/src/services/languages/locales/ru-RU/moderation/kick.json similarity index 100% rename from languages/ru-RU/moderation/kick.json rename to src/services/languages/locales/ru-RU/moderation/kick.json diff --git a/languages/ru-RU/moderation/unban.json b/src/services/languages/locales/ru-RU/moderation/unban.json similarity index 100% rename from languages/ru-RU/moderation/unban.json rename to src/services/languages/locales/ru-RU/moderation/unban.json diff --git a/languages/ru-RU/moderation/untimeout.json b/src/services/languages/locales/ru-RU/moderation/untimeout.json similarity index 100% rename from languages/ru-RU/moderation/untimeout.json rename to src/services/languages/locales/ru-RU/moderation/untimeout.json diff --git a/languages/ru-RU/moderation/warn.json b/src/services/languages/locales/ru-RU/moderation/warn.json similarity index 100% rename from languages/ru-RU/moderation/warn.json rename to src/services/languages/locales/ru-RU/moderation/warn.json diff --git a/languages/ru-RU/moderation/warns.json b/src/services/languages/locales/ru-RU/moderation/warns.json similarity index 100% rename from languages/ru-RU/moderation/warns.json rename to src/services/languages/locales/ru-RU/moderation/warns.json diff --git a/languages/ru-RU/music/back.json b/src/services/languages/locales/ru-RU/music/back.json similarity index 100% rename from languages/ru-RU/music/back.json rename to src/services/languages/locales/ru-RU/music/back.json diff --git a/languages/ru-RU/music/clips.json b/src/services/languages/locales/ru-RU/music/clips.json similarity index 100% rename from languages/ru-RU/music/clips.json rename to src/services/languages/locales/ru-RU/music/clips.json diff --git a/languages/ru-RU/music/loop.json b/src/services/languages/locales/ru-RU/music/loop.json similarity index 100% rename from languages/ru-RU/music/loop.json rename to src/services/languages/locales/ru-RU/music/loop.json diff --git a/languages/ru-RU/music/nowplaying.json b/src/services/languages/locales/ru-RU/music/nowplaying.json similarity index 100% rename from languages/ru-RU/music/nowplaying.json rename to src/services/languages/locales/ru-RU/music/nowplaying.json diff --git a/languages/ru-RU/music/play.json b/src/services/languages/locales/ru-RU/music/play.json similarity index 100% rename from languages/ru-RU/music/play.json rename to src/services/languages/locales/ru-RU/music/play.json diff --git a/languages/ru-RU/music/queue.json b/src/services/languages/locales/ru-RU/music/queue.json similarity index 100% rename from languages/ru-RU/music/queue.json rename to src/services/languages/locales/ru-RU/music/queue.json diff --git a/languages/ru-RU/music/seek.json b/src/services/languages/locales/ru-RU/music/seek.json similarity index 100% rename from languages/ru-RU/music/seek.json rename to src/services/languages/locales/ru-RU/music/seek.json diff --git a/languages/ru-RU/music/shuffle.json b/src/services/languages/locales/ru-RU/music/shuffle.json similarity index 100% rename from languages/ru-RU/music/shuffle.json rename to src/services/languages/locales/ru-RU/music/shuffle.json diff --git a/languages/ru-RU/music/skip.json b/src/services/languages/locales/ru-RU/music/skip.json similarity index 100% rename from languages/ru-RU/music/skip.json rename to src/services/languages/locales/ru-RU/music/skip.json diff --git a/languages/ru-RU/music/stop.json b/src/services/languages/locales/ru-RU/music/stop.json similarity index 100% rename from languages/ru-RU/music/stop.json rename to src/services/languages/locales/ru-RU/music/stop.json diff --git a/languages/ru-RU/music/volume.json b/src/services/languages/locales/ru-RU/music/volume.json similarity index 100% rename from languages/ru-RU/music/volume.json rename to src/services/languages/locales/ru-RU/music/volume.json diff --git a/languages/ru-RU/owner/announcement.json b/src/services/languages/locales/ru-RU/owner/announcement.json similarity index 100% rename from languages/ru-RU/owner/announcement.json rename to src/services/languages/locales/ru-RU/owner/announcement.json diff --git a/languages/ru-RU/owner/debug.json b/src/services/languages/locales/ru-RU/owner/debug.json similarity index 100% rename from languages/ru-RU/owner/debug.json rename to src/services/languages/locales/ru-RU/owner/debug.json diff --git a/languages/ru-RU/owner/eval.json b/src/services/languages/locales/ru-RU/owner/eval.json similarity index 100% rename from languages/ru-RU/owner/eval.json rename to src/services/languages/locales/ru-RU/owner/eval.json diff --git a/languages/ru-RU/owner/reload.json b/src/services/languages/locales/ru-RU/owner/reload.json similarity index 100% rename from languages/ru-RU/owner/reload.json rename to src/services/languages/locales/ru-RU/owner/reload.json diff --git a/languages/ru-RU/owner/say.json b/src/services/languages/locales/ru-RU/owner/say.json similarity index 100% rename from languages/ru-RU/owner/say.json rename to src/services/languages/locales/ru-RU/owner/say.json diff --git a/languages/ru-RU/owner/servers.json b/src/services/languages/locales/ru-RU/owner/servers.json similarity index 100% rename from languages/ru-RU/owner/servers.json rename to src/services/languages/locales/ru-RU/owner/servers.json diff --git a/languages/ru-RU/tickets/adduser.json b/src/services/languages/locales/ru-RU/tickets/adduser.json similarity index 100% rename from languages/ru-RU/tickets/adduser.json rename to src/services/languages/locales/ru-RU/tickets/adduser.json diff --git a/languages/ru-RU/tickets/closeticket.json b/src/services/languages/locales/ru-RU/tickets/closeticket.json similarity index 100% rename from languages/ru-RU/tickets/closeticket.json rename to src/services/languages/locales/ru-RU/tickets/closeticket.json diff --git a/languages/ru-RU/tickets/createticketembed.json b/src/services/languages/locales/ru-RU/tickets/createticketembed.json similarity index 100% rename from languages/ru-RU/tickets/createticketembed.json rename to src/services/languages/locales/ru-RU/tickets/createticketembed.json diff --git a/languages/ru-RU/tickets/removeuser.json b/src/services/languages/locales/ru-RU/tickets/removeuser.json similarity index 100% rename from languages/ru-RU/tickets/removeuser.json rename to src/services/languages/locales/ru-RU/tickets/removeuser.json diff --git a/languages/uk-UA/administration/addemoji.json b/src/services/languages/locales/uk-UA/administration/addemoji.json similarity index 100% rename from languages/uk-UA/administration/addemoji.json rename to src/services/languages/locales/uk-UA/administration/addemoji.json diff --git a/languages/uk-UA/administration/automod.json b/src/services/languages/locales/uk-UA/administration/automod.json similarity index 100% rename from languages/uk-UA/administration/automod.json rename to src/services/languages/locales/uk-UA/administration/automod.json diff --git a/languages/uk-UA/administration/autorole.json b/src/services/languages/locales/uk-UA/administration/autorole.json similarity index 100% rename from languages/uk-UA/administration/autorole.json rename to src/services/languages/locales/uk-UA/administration/autorole.json diff --git a/languages/uk-UA/administration/config.json b/src/services/languages/locales/uk-UA/administration/config.json similarity index 91% rename from languages/uk-UA/administration/config.json rename to src/services/languages/locales/uk-UA/administration/config.json index 23667af3..63c4c186 100644 --- a/languages/uk-UA/administration/config.json +++ b/src/services/languages/locales/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/administration/deletemod.json b/src/services/languages/locales/uk-UA/administration/deletemod.json similarity index 100% rename from languages/uk-UA/administration/deletemod.json rename to src/services/languages/locales/uk-UA/administration/deletemod.json diff --git a/languages/uk-UA/administration/goodbye.json b/src/services/languages/locales/uk-UA/administration/goodbye.json similarity index 100% rename from languages/uk-UA/administration/goodbye.json rename to src/services/languages/locales/uk-UA/administration/goodbye.json diff --git a/languages/uk-UA/administration/selectroles.json b/src/services/languages/locales/uk-UA/administration/selectroles.json similarity index 100% rename from languages/uk-UA/administration/selectroles.json rename to src/services/languages/locales/uk-UA/administration/selectroles.json diff --git a/languages/uk-UA/administration/set.json b/src/services/languages/locales/uk-UA/administration/set.json similarity index 100% rename from languages/uk-UA/administration/set.json rename to src/services/languages/locales/uk-UA/administration/set.json diff --git a/languages/uk-UA/administration/setlang.json b/src/services/languages/locales/uk-UA/administration/setlang.json similarity index 100% rename from languages/uk-UA/administration/setlang.json rename to src/services/languages/locales/uk-UA/administration/setlang.json diff --git a/languages/uk-UA/administration/stealemoji.json b/src/services/languages/locales/uk-UA/administration/stealemoji.json similarity index 100% rename from languages/uk-UA/administration/stealemoji.json rename to src/services/languages/locales/uk-UA/administration/stealemoji.json diff --git a/languages/uk-UA/administration/welcome.json b/src/services/languages/locales/uk-UA/administration/welcome.json similarity index 100% rename from languages/uk-UA/administration/welcome.json rename to src/services/languages/locales/uk-UA/administration/welcome.json diff --git a/languages/uk-UA/beatrun/courses.json b/src/services/languages/locales/uk-UA/beatrun/courses.json similarity index 100% rename from languages/uk-UA/beatrun/courses.json rename to src/services/languages/locales/uk-UA/beatrun/courses.json diff --git a/languages/uk-UA/common.json b/src/services/languages/locales/uk-UA/common.json similarity index 100% rename from languages/uk-UA/common.json rename to src/services/languages/locales/uk-UA/common.json diff --git a/languages/uk-UA/economy/achievements.json b/src/services/languages/locales/uk-UA/economy/achievements.json similarity index 100% rename from languages/uk-UA/economy/achievements.json rename to src/services/languages/locales/uk-UA/economy/achievements.json diff --git a/languages/uk-UA/economy/bank.json b/src/services/languages/locales/uk-UA/economy/bank.json similarity index 100% rename from languages/uk-UA/economy/bank.json rename to src/services/languages/locales/uk-UA/economy/bank.json diff --git a/languages/uk-UA/economy/birthdate.json b/src/services/languages/locales/uk-UA/economy/birthdate.json similarity index 100% rename from languages/uk-UA/economy/birthdate.json rename to src/services/languages/locales/uk-UA/economy/birthdate.json diff --git a/languages/uk-UA/economy/divorce.json b/src/services/languages/locales/uk-UA/economy/divorce.json similarity index 100% rename from languages/uk-UA/economy/divorce.json rename to src/services/languages/locales/uk-UA/economy/divorce.json diff --git a/languages/uk-UA/economy/importmee6.json b/src/services/languages/locales/uk-UA/economy/importmee6.json similarity index 100% rename from languages/uk-UA/economy/importmee6.json rename to src/services/languages/locales/uk-UA/economy/importmee6.json diff --git a/languages/uk-UA/economy/leaderboard.json b/src/services/languages/locales/uk-UA/economy/leaderboard.json similarity index 100% rename from languages/uk-UA/economy/leaderboard.json rename to src/services/languages/locales/uk-UA/economy/leaderboard.json diff --git a/languages/uk-UA/economy/marry.json b/src/services/languages/locales/uk-UA/economy/marry.json similarity index 100% rename from languages/uk-UA/economy/marry.json rename to src/services/languages/locales/uk-UA/economy/marry.json diff --git a/languages/uk-UA/economy/money.json b/src/services/languages/locales/uk-UA/economy/money.json similarity index 100% rename from languages/uk-UA/economy/money.json rename to src/services/languages/locales/uk-UA/economy/money.json diff --git a/languages/uk-UA/economy/pay.json b/src/services/languages/locales/uk-UA/economy/pay.json similarity index 100% rename from languages/uk-UA/economy/pay.json rename to src/services/languages/locales/uk-UA/economy/pay.json diff --git a/languages/uk-UA/economy/profile.json b/src/services/languages/locales/uk-UA/economy/profile.json similarity index 100% rename from languages/uk-UA/economy/profile.json rename to src/services/languages/locales/uk-UA/economy/profile.json diff --git a/languages/uk-UA/economy/rep.json b/src/services/languages/locales/uk-UA/economy/rep.json similarity index 100% rename from languages/uk-UA/economy/rep.json rename to src/services/languages/locales/uk-UA/economy/rep.json diff --git a/languages/uk-UA/economy/rob.json b/src/services/languages/locales/uk-UA/economy/rob.json similarity index 100% rename from languages/uk-UA/economy/rob.json rename to src/services/languages/locales/uk-UA/economy/rob.json diff --git a/languages/uk-UA/economy/setbio.json b/src/services/languages/locales/uk-UA/economy/setbio.json similarity index 100% rename from languages/uk-UA/economy/setbio.json rename to src/services/languages/locales/uk-UA/economy/setbio.json diff --git a/languages/uk-UA/economy/slots.json b/src/services/languages/locales/uk-UA/economy/slots.json similarity index 100% rename from languages/uk-UA/economy/slots.json rename to src/services/languages/locales/uk-UA/economy/slots.json diff --git a/languages/uk-UA/economy/transactions.json b/src/services/languages/locales/uk-UA/economy/transactions.json similarity index 100% rename from languages/uk-UA/economy/transactions.json rename to src/services/languages/locales/uk-UA/economy/transactions.json diff --git a/languages/uk-UA/economy/work.json b/src/services/languages/locales/uk-UA/economy/work.json similarity index 100% rename from languages/uk-UA/economy/work.json rename to src/services/languages/locales/uk-UA/economy/work.json diff --git a/languages/uk-UA/fun/8ball.json b/src/services/languages/locales/uk-UA/fun/8ball.json similarity index 100% rename from languages/uk-UA/fun/8ball.json rename to src/services/languages/locales/uk-UA/fun/8ball.json diff --git a/languages/uk-UA/fun/cat.json b/src/services/languages/locales/uk-UA/fun/cat.json similarity index 100% rename from languages/uk-UA/fun/cat.json rename to src/services/languages/locales/uk-UA/fun/cat.json diff --git a/languages/uk-UA/fun/dog.json b/src/services/languages/locales/uk-UA/fun/dog.json similarity index 100% rename from languages/uk-UA/fun/dog.json rename to src/services/languages/locales/uk-UA/fun/dog.json diff --git a/languages/uk-UA/fun/lmgtfy.json b/src/services/languages/locales/uk-UA/fun/lmgtfy.json similarity index 100% rename from languages/uk-UA/fun/lmgtfy.json rename to src/services/languages/locales/uk-UA/fun/lmgtfy.json diff --git a/languages/uk-UA/fun/lovecalc.json b/src/services/languages/locales/uk-UA/fun/lovecalc.json similarity index 100% rename from languages/uk-UA/fun/lovecalc.json rename to src/services/languages/locales/uk-UA/fun/lovecalc.json diff --git a/languages/uk-UA/fun/memes.json b/src/services/languages/locales/uk-UA/fun/memes.json similarity index 100% rename from languages/uk-UA/fun/memes.json rename to src/services/languages/locales/uk-UA/fun/memes.json diff --git a/languages/uk-UA/fun/number.json b/src/services/languages/locales/uk-UA/fun/number.json similarity index 100% rename from languages/uk-UA/fun/number.json rename to src/services/languages/locales/uk-UA/fun/number.json diff --git a/languages/uk-UA/fun/tictactoe.json b/src/services/languages/locales/uk-UA/fun/tictactoe.json similarity index 100% rename from languages/uk-UA/fun/tictactoe.json rename to src/services/languages/locales/uk-UA/fun/tictactoe.json diff --git a/languages/uk-UA/general/afk.json b/src/services/languages/locales/uk-UA/general/afk.json similarity index 100% rename from languages/uk-UA/general/afk.json rename to src/services/languages/locales/uk-UA/general/afk.json diff --git a/languages/uk-UA/general/avatar.json b/src/services/languages/locales/uk-UA/general/avatar.json similarity index 100% rename from languages/uk-UA/general/avatar.json rename to src/services/languages/locales/uk-UA/general/avatar.json diff --git a/languages/uk-UA/general/boosters.json b/src/services/languages/locales/uk-UA/general/boosters.json similarity index 100% rename from languages/uk-UA/general/boosters.json rename to src/services/languages/locales/uk-UA/general/boosters.json diff --git a/languages/uk-UA/general/emoji.json b/src/services/languages/locales/uk-UA/general/emoji.json similarity index 100% rename from languages/uk-UA/general/emoji.json rename to src/services/languages/locales/uk-UA/general/emoji.json diff --git a/languages/uk-UA/general/help.json b/src/services/languages/locales/uk-UA/general/help.json similarity index 100% rename from languages/uk-UA/general/help.json rename to src/services/languages/locales/uk-UA/general/help.json diff --git a/languages/uk-UA/general/info.json b/src/services/languages/locales/uk-UA/general/info.json similarity index 100% rename from languages/uk-UA/general/info.json rename to src/services/languages/locales/uk-UA/general/info.json diff --git a/languages/uk-UA/general/minecraft.json b/src/services/languages/locales/uk-UA/general/minecraft.json similarity index 100% rename from languages/uk-UA/general/minecraft.json rename to src/services/languages/locales/uk-UA/general/minecraft.json diff --git a/languages/uk-UA/general/ping.json b/src/services/languages/locales/uk-UA/general/ping.json similarity index 100% rename from languages/uk-UA/general/ping.json rename to src/services/languages/locales/uk-UA/general/ping.json diff --git a/languages/uk-UA/general/remindme.json b/src/services/languages/locales/uk-UA/general/remindme.json similarity index 100% rename from languages/uk-UA/general/remindme.json rename to src/services/languages/locales/uk-UA/general/remindme.json diff --git a/languages/uk-UA/general/reminds.json b/src/services/languages/locales/uk-UA/general/reminds.json similarity index 100% rename from languages/uk-UA/general/reminds.json rename to src/services/languages/locales/uk-UA/general/reminds.json diff --git a/languages/uk-UA/general/report.json b/src/services/languages/locales/uk-UA/general/report.json similarity index 100% rename from languages/uk-UA/general/report.json rename to src/services/languages/locales/uk-UA/general/report.json diff --git a/languages/uk-UA/general/shorturl.json b/src/services/languages/locales/uk-UA/general/shorturl.json similarity index 100% rename from languages/uk-UA/general/shorturl.json rename to src/services/languages/locales/uk-UA/general/shorturl.json diff --git a/languages/uk-UA/general/staff.json b/src/services/languages/locales/uk-UA/general/staff.json similarity index 100% rename from languages/uk-UA/general/staff.json rename to src/services/languages/locales/uk-UA/general/staff.json diff --git a/languages/uk-UA/general/stats.json b/src/services/languages/locales/uk-UA/general/stats.json similarity index 100% rename from languages/uk-UA/general/stats.json rename to src/services/languages/locales/uk-UA/general/stats.json diff --git a/languages/uk-UA/general/suggest.json b/src/services/languages/locales/uk-UA/general/suggest.json similarity index 100% rename from languages/uk-UA/general/suggest.json rename to src/services/languages/locales/uk-UA/general/suggest.json diff --git a/languages/uk-UA/general/whois.json b/src/services/languages/locales/uk-UA/general/whois.json similarity index 100% rename from languages/uk-UA/general/whois.json rename to src/services/languages/locales/uk-UA/general/whois.json diff --git a/languages/uk-UA/iat/checkjar.json b/src/services/languages/locales/uk-UA/iat/checkjar.json similarity index 100% rename from languages/uk-UA/iat/checkjar.json rename to src/services/languages/locales/uk-UA/iat/checkjar.json diff --git a/languages/uk-UA/misc.json b/src/services/languages/locales/uk-UA/misc.json similarity index 100% rename from languages/uk-UA/misc.json rename to src/services/languages/locales/uk-UA/misc.json diff --git a/languages/uk-UA/moderation/ban.json b/src/services/languages/locales/uk-UA/moderation/ban.json similarity index 100% rename from languages/uk-UA/moderation/ban.json rename to src/services/languages/locales/uk-UA/moderation/ban.json diff --git a/languages/uk-UA/moderation/clear.json b/src/services/languages/locales/uk-UA/moderation/clear.json similarity index 100% rename from languages/uk-UA/moderation/clear.json rename to src/services/languages/locales/uk-UA/moderation/clear.json diff --git a/languages/uk-UA/moderation/clearwarns.json b/src/services/languages/locales/uk-UA/moderation/clearwarns.json similarity index 100% rename from languages/uk-UA/moderation/clearwarns.json rename to src/services/languages/locales/uk-UA/moderation/clearwarns.json diff --git a/languages/uk-UA/moderation/giveaway.json b/src/services/languages/locales/uk-UA/moderation/giveaway.json similarity index 100% rename from languages/uk-UA/moderation/giveaway.json rename to src/services/languages/locales/uk-UA/moderation/giveaway.json diff --git a/languages/uk-UA/moderation/kick.json b/src/services/languages/locales/uk-UA/moderation/kick.json similarity index 100% rename from languages/uk-UA/moderation/kick.json rename to src/services/languages/locales/uk-UA/moderation/kick.json diff --git a/languages/uk-UA/moderation/unban.json b/src/services/languages/locales/uk-UA/moderation/unban.json similarity index 100% rename from languages/uk-UA/moderation/unban.json rename to src/services/languages/locales/uk-UA/moderation/unban.json diff --git a/languages/uk-UA/moderation/untimeout.json b/src/services/languages/locales/uk-UA/moderation/untimeout.json similarity index 100% rename from languages/uk-UA/moderation/untimeout.json rename to src/services/languages/locales/uk-UA/moderation/untimeout.json diff --git a/languages/uk-UA/moderation/warn.json b/src/services/languages/locales/uk-UA/moderation/warn.json similarity index 100% rename from languages/uk-UA/moderation/warn.json rename to src/services/languages/locales/uk-UA/moderation/warn.json diff --git a/languages/uk-UA/moderation/warns.json b/src/services/languages/locales/uk-UA/moderation/warns.json similarity index 100% rename from languages/uk-UA/moderation/warns.json rename to src/services/languages/locales/uk-UA/moderation/warns.json diff --git a/languages/uk-UA/music/back.json b/src/services/languages/locales/uk-UA/music/back.json similarity index 100% rename from languages/uk-UA/music/back.json rename to src/services/languages/locales/uk-UA/music/back.json diff --git a/languages/uk-UA/music/clips.json b/src/services/languages/locales/uk-UA/music/clips.json similarity index 100% rename from languages/uk-UA/music/clips.json rename to src/services/languages/locales/uk-UA/music/clips.json diff --git a/languages/uk-UA/music/loop.json b/src/services/languages/locales/uk-UA/music/loop.json similarity index 100% rename from languages/uk-UA/music/loop.json rename to src/services/languages/locales/uk-UA/music/loop.json diff --git a/languages/uk-UA/music/nowplaying.json b/src/services/languages/locales/uk-UA/music/nowplaying.json similarity index 100% rename from languages/uk-UA/music/nowplaying.json rename to src/services/languages/locales/uk-UA/music/nowplaying.json diff --git a/languages/uk-UA/music/play.json b/src/services/languages/locales/uk-UA/music/play.json similarity index 100% rename from languages/uk-UA/music/play.json rename to src/services/languages/locales/uk-UA/music/play.json diff --git a/languages/uk-UA/music/queue.json b/src/services/languages/locales/uk-UA/music/queue.json similarity index 100% rename from languages/uk-UA/music/queue.json rename to src/services/languages/locales/uk-UA/music/queue.json diff --git a/languages/uk-UA/music/seek.json b/src/services/languages/locales/uk-UA/music/seek.json similarity index 100% rename from languages/uk-UA/music/seek.json rename to src/services/languages/locales/uk-UA/music/seek.json diff --git a/languages/uk-UA/music/shuffle.json b/src/services/languages/locales/uk-UA/music/shuffle.json similarity index 100% rename from languages/uk-UA/music/shuffle.json rename to src/services/languages/locales/uk-UA/music/shuffle.json diff --git a/languages/uk-UA/music/skip.json b/src/services/languages/locales/uk-UA/music/skip.json similarity index 100% rename from languages/uk-UA/music/skip.json rename to src/services/languages/locales/uk-UA/music/skip.json diff --git a/languages/uk-UA/music/stop.json b/src/services/languages/locales/uk-UA/music/stop.json similarity index 100% rename from languages/uk-UA/music/stop.json rename to src/services/languages/locales/uk-UA/music/stop.json diff --git a/languages/uk-UA/music/volume.json b/src/services/languages/locales/uk-UA/music/volume.json similarity index 100% rename from languages/uk-UA/music/volume.json rename to src/services/languages/locales/uk-UA/music/volume.json diff --git a/languages/uk-UA/owner/announcement.json b/src/services/languages/locales/uk-UA/owner/announcement.json similarity index 100% rename from languages/uk-UA/owner/announcement.json rename to src/services/languages/locales/uk-UA/owner/announcement.json diff --git a/languages/uk-UA/owner/debug.json b/src/services/languages/locales/uk-UA/owner/debug.json similarity index 100% rename from languages/uk-UA/owner/debug.json rename to src/services/languages/locales/uk-UA/owner/debug.json diff --git a/languages/uk-UA/owner/eval.json b/src/services/languages/locales/uk-UA/owner/eval.json similarity index 100% rename from languages/uk-UA/owner/eval.json rename to src/services/languages/locales/uk-UA/owner/eval.json diff --git a/languages/uk-UA/owner/reload.json b/src/services/languages/locales/uk-UA/owner/reload.json similarity index 100% rename from languages/uk-UA/owner/reload.json rename to src/services/languages/locales/uk-UA/owner/reload.json diff --git a/languages/uk-UA/owner/say.json b/src/services/languages/locales/uk-UA/owner/say.json similarity index 100% rename from languages/uk-UA/owner/say.json rename to src/services/languages/locales/uk-UA/owner/say.json diff --git a/languages/uk-UA/owner/servers.json b/src/services/languages/locales/uk-UA/owner/servers.json similarity index 100% rename from languages/uk-UA/owner/servers.json rename to src/services/languages/locales/uk-UA/owner/servers.json diff --git a/languages/uk-UA/tickets/adduser.json b/src/services/languages/locales/uk-UA/tickets/adduser.json similarity index 100% rename from languages/uk-UA/tickets/adduser.json rename to src/services/languages/locales/uk-UA/tickets/adduser.json diff --git a/languages/uk-UA/tickets/closeticket.json b/src/services/languages/locales/uk-UA/tickets/closeticket.json similarity index 100% rename from languages/uk-UA/tickets/closeticket.json rename to src/services/languages/locales/uk-UA/tickets/closeticket.json diff --git a/languages/uk-UA/tickets/createticketembed.json b/src/services/languages/locales/uk-UA/tickets/createticketembed.json similarity index 100% rename from languages/uk-UA/tickets/createticketembed.json rename to src/services/languages/locales/uk-UA/tickets/createticketembed.json diff --git a/languages/uk-UA/tickets/removeuser.json b/src/services/languages/locales/uk-UA/tickets/removeuser.json similarity index 100% rename from languages/uk-UA/tickets/removeuser.json rename to src/services/languages/locales/uk-UA/tickets/removeuser.json diff --git a/src/structures/client.js b/src/structures/client.js new file mode 100644 index 00000000..b875e1d7 --- /dev/null +++ b/src/structures/client.js @@ -0,0 +1,40 @@ +import { Client } from "discord.js"; +import { Player } from "discord-player"; +import MongooseAdapter from "../adapters/database/MongooseAdapter.js"; +import { init as initCommands } from "../handlers/command-handler/index.js"; +import { init as initEvents } from "../handlers/event-handler/index.js"; +import logger from "../helpers/logger.js"; +import ConfigService from "../services/config/index.js"; +import InternationalizationService from "../services/languages/index.js"; +import { SUPER_CONTEXT } from "../constants/index.js"; + +export class ExtendedClient extends Client { + /** + * @param {import("discord.js").ClientOptions} options + */ + constructor(options) { + if (SUPER_CONTEXT.getStore()) { + return SUPER_CONTEXT.getStore(); + } + super(options); + + this.configService = new ConfigService(); + this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); + this.i18n = new InternationalizationService(this); + new Player(this); + + SUPER_CONTEXT.enterWith(this); + } + + async init() { + try { + await this.adapter.connect(); + + return this.login(this.configService.get("token")) + .then(async () => await Promise.all([initCommands(), initEvents()])) + .catch(console.error); + } catch (error) { + logger.error(error); + } + } +} diff --git a/src/utils/create-embed.js b/src/utils/create-embed.js new file mode 100644 index 00000000..27199569 --- /dev/null +++ b/src/utils/create-embed.js @@ -0,0 +1,15 @@ +import { EmbedBuilder } from "discord.js"; +import useClient from "../utils/use-client.js"; +/** + * + * @param {import("discord.js").EmbedData} data - embed data + * @returns The generated EmbedBuilder instance. + */ +export const createEmbed = data => { + const client = useClient(); + new EmbedBuilder({ + footer: typeof data.footer === "object" ? data.footer : data.footer ? { text: data.footer } : client.configService.get("embed.footer"), + color: data.color ?? client.configService.get("embed.color"), + ...data, + }); +}; diff --git a/src/utils/get-path.js b/src/utils/get-path.js new file mode 100644 index 00000000..805847d7 --- /dev/null +++ b/src/utils/get-path.js @@ -0,0 +1,27 @@ +import fs from "node:fs/promises"; +import path from "node:path"; +import { PROJECT_ROOT } from "../constants/index.js"; + +export const getFilePaths = async (directory, nesting) => { + let filePaths = []; + + if (!directory) return; + + const absoluteDirectory = path.isAbsolute(directory) ? directory : path.join(PROJECT_ROOT, directory); + + const files = await fs.readdir(absoluteDirectory, { 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/src/utils/index.js b/src/utils/index.js new file mode 100644 index 00000000..0a323cbb --- /dev/null +++ b/src/utils/index.js @@ -0,0 +1,3 @@ +export * from "./create-embed.js"; +export * from "./get-path.js"; +export * from "./resolve-file.js"; diff --git a/src/utils/resolve-file.js b/src/utils/resolve-file.js new file mode 100644 index 00000000..4f2727d9 --- /dev/null +++ b/src/utils/resolve-file.js @@ -0,0 +1,12 @@ +import path from "node:path"; +import { PROJECT_ROOT } from "../constants/index.js"; + +/** + * 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.isAbsolute(filePath) ? filePath : path.resolve(PROJECT_ROOT, filePath); + return "file://" + resolvedPath.replace(/\\\\|\\/g, "/"); +}; diff --git a/src/utils/use-client.js b/src/utils/use-client.js new file mode 100644 index 00000000..3514ce05 --- /dev/null +++ b/src/utils/use-client.js @@ -0,0 +1,16 @@ +import { SUPER_CONTEXT } from "../constants/index.js"; + +/** + * Returns the instance of the client. + * + * @throws {Error} Client is not initialized. Please initialize it first. + * + * @returns {import("../structures/client.js").ExtendedClient} The client instance. + */ +export default function useClient() { + const store = SUPER_CONTEXT.getStore(); + if (!store) { + throw new Error("Client is not initialized. Please initialize it first."); + } + return store; +}