From 04552202dfe6d0c5d37fa70f21ddfc0483356272 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 5 Dec 2024 19:16:01 +0500 Subject: [PATCH 01/37] start conversion tro esm modules --- .prettierrc | 2 +- base/BaseCommand.js | 6 +- base/Client.js | 27 +- config.sample.js | 6 +- eslint.config.js | 50 ++++ index.js | 28 +- package.json | 95 +------ pnpm-lock.yaml | 662 ++++++++++++++++++++++++++++++++++++++++++-- 8 files changed, 747 insertions(+), 129 deletions(-) create mode 100644 eslint.config.js 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/base/BaseCommand.js b/base/BaseCommand.js index 7abc79a0..2e5fd642 100644 --- a/base/BaseCommand.js +++ b/base/BaseCommand.js @@ -1,5 +1,5 @@ /* eslint-disable no-unused-vars */ -const path = require("path"); +import { sep } from "path"; class BaseCommand { constructor(options, client) { @@ -15,8 +15,8 @@ class BaseCommand { /** * @type {String} */ - this.category = this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other"; + this.category = this.dirname ? this.dirname.split(sep)[parseInt(this.dirname.split(sep).length - 1, 10)] : "Other"; } } -module.exports = BaseCommand; +export default BaseCommand; diff --git a/base/Client.js b/base/Client.js index d5e50f83..d2b21f14 100644 --- a/base/Client.js +++ b/base/Client.js @@ -7,7 +7,7 @@ const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, Embe { Routes } = require("discord-api-types/v10"); const BaseEvent = require("./BaseEvent.js"), - BaseCommand = require("./BaseCommand.js"), + BaseCommand = require("./BaseCommand.js").default, path = require("path"), fs = require("fs").promises, mongoose = require("mongoose"); @@ -63,10 +63,14 @@ 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; @@ -77,11 +81,14 @@ class JaBaClient extends Client { if (message && message.deletable) message.delete(); }, track.durationMS); else - setTimeout(() => { - const message = queue.metadata.channel.messages.cache.get(m); + 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))); @@ -291,7 +298,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; } diff --git a/config.sample.js b/config.sample.js index fd73d453..6257bd15 100644 --- a/config.sample.js +++ b/config.sample.js @@ -1,4 +1,4 @@ -module.exports = { +export const config = { /* The token of your Discord Bot */ token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", /* UserID of your Discord Bot */ @@ -42,7 +42,5 @@ module.exports = { id: "123456789098765432", // The ID of the bot's owner }, /* Add your own API keys here */ - apiKeys: { - shlink: "12345678-1234-1234-1234-123456789098" /* Shlink.io REST API key */, - }, + apiKeys: {}, }; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..d36eda08 --- /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", + 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/index.js b/index.js index a38734d5..93a36e3d 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,26 @@ -require("./helpers/extenders"); +import "./helpers/extenders.js"; -const { GatewayIntentBits } = require("discord.js"), - Client = require("./base/Client"); +import { GatewayIntentBits } from "discord.js"; +import Client from "./base/Client.js"; const client = new Client({ - intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildModeration, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions ], + 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"] }, }); @@ -24,6 +40,4 @@ client .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 +process.on("unhandledRejection", e => console.log(e)).on("uncaughtException", e => console.log(e)); diff --git a/package.json b/package.json index b1e79467..f69dbec3 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "4.6.7", "description": "My Discord Bot", "main": "index.js", + "type": "module", "scripts": { "start": "node ." }, @@ -30,93 +31,11 @@ "node-fetch": "^2.7.0" }, "devDependencies": { - "eslint": "^8.57.1" - }, - "eslintConfig": { - "extends": "eslint:recommended", - "env": { - "commonjs": true, - "es6": true, - "es2020": true, - "node": true - }, - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaVersion": 2020 - }, - "rules": { - "arrow-spacing": [ - "warn", - { - "before": true, - "after": true - } - ], - "comma-dangle": [ - "error", - "always-multiline" - ], - "comma-spacing": "error", - "comma-style": "error", - "dot-location": [ - "error", - "property" - ], - "handle-callback-err": "off", - "indent": [ - "error", - "tab", - { - "SwitchCase": 1 - } - ], - "keyword-spacing": "error", - "max-nested-callbacks": [ - "error", - { - "max": 4 - } - ], - "max-statements-per-line": [ - "error", - { - "max": 2 - } - ], - "no-console": "off", - "no-multi-spaces": "error", - "no-multiple-empty-lines": [ - "error", - { - "max": 2, - "maxEOF": 1, - "maxBOF": 0 - } - ], - "no-trailing-spaces": [ - "error" - ], - "no-var": "error", - "object-curly-spacing": [ - "error", - "always" - ], - "prefer-const": "error", - "quotes": [ - "error", - "double" - ], - "semi": [ - "error", - "always" - ], - "space-in-parens": "error", - "space-infix-ops": "error", - "space-unary-ops": "error", - "yoda": "error" - } + "@eslint/js": "^9.16.0", + "@stylistic/eslint-plugin-js": "^2.11.0", + "eslint": "^9.16.0", + "globals": "^15.13.0", + "prettier": "^3.4.2", + "prettier-eslint": "^16.3.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 260d182c..c6b4d075 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: version: 5.1.4 i18next: specifier: ^24.0.0 - version: 24.0.0 + version: 24.0.0(typescript@5.7.2) i18next-fs-backend: specifier: ^2.6.0 version: 2.6.0 @@ -69,9 +69,24 @@ importers: specifier: ^2.7.0 version: 2.7.0 devDependencies: + '@eslint/js': + specifier: ^9.16.0 + version: 9.16.0 + '@stylistic/eslint-plugin-js': + specifier: ^2.11.0 + version: 2.11.0(eslint@9.16.0) eslint: - specifier: ^8.57.1 - version: 8.57.1 + specifier: ^9.16.0 + version: 9.16.0 + globals: + specifier: ^15.13.0 + version: 15.13.0 + prettier: + specifier: ^3.4.2 + version: 3.4.2 + prettier-eslint: + specifier: ^16.3.0 + version: 16.3.0 packages: @@ -143,22 +158,54 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.11.0': - resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/config-array@0.19.1': + resolution: {integrity: sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/core@0.9.1': + resolution: {integrity: sha512-GuUdqkyyzQI5RMIWkHhvTWLCyLo1jNK3vzkSyaExH5kHPDHcuL2VOpHjmMY+y3+NC69qAKToBqldTBgYeLSr9Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/eslintrc@2.1.4': resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/eslintrc@3.2.0': + resolution: {integrity: sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/js@8.57.1': resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@eslint/js@9.16.0': + resolution: {integrity: sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/object-schema@2.1.5': + resolution: {integrity: sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/plugin-kit@0.2.4': + resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@fastify/busboy@2.1.1': resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} engines: {node: '>=14'} + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} @@ -172,6 +219,18 @@ packages: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} deprecated: Use @eslint/object-schema instead + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@humanwhocodes/retry@0.4.1': + resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} + engines: {node: '>=18.18'} + + '@jest/schemas@29.6.3': + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + '@mongodb-js/saslprep@1.1.9': resolution: {integrity: sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==} @@ -263,10 +322,19 @@ packages: resolution: {integrity: sha512-jjmJywLAFoWeBi1W7994zZyiNWPIiqRRNAmSERxyg93xRGzNYvGjlZ0gR6x0F4gPRi2+0O6S71kOZYyr3cxaIQ==} engines: {node: '>=v14.0.0', npm: '>=7.0.0'} + '@sinclair/typebox@0.27.8': + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@sindresorhus/is@5.6.0': resolution: {integrity: sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g==} engines: {node: '>=14.16'} + '@stylistic/eslint-plugin-js@2.11.0': + resolution: {integrity: sha512-btchD0P3iij6cIk5RR5QMdEhtCCV0+L6cNheGhGCd//jaHILZMTi/EOqgEDAf1s4ZoViyExoToM+S2Iwa3U9DA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + '@szmarczak/http-timer@5.0.1': resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} engines: {node: '>=14.16'} @@ -274,9 +342,15 @@ packages: '@tokenizer/token@0.3.0': resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/http-cache-semantics@4.0.4': resolution: {integrity: sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==} + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/luxon@3.4.2': resolution: {integrity: sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA==} @@ -292,6 +366,37 @@ packages: '@types/ws@8.5.12': resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} + '@typescript-eslint/parser@6.21.0': + resolution: {integrity: sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/scope-manager@6.21.0': + resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} + engines: {node: ^16.0.0 || >=18.0.0} + + '@typescript-eslint/types@6.21.0': + resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} + engines: {node: ^16.0.0 || >=18.0.0} + + '@typescript-eslint/typescript-estree@6.21.0': + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/visitor-keys@6.21.0': + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} + engines: {node: ^16.0.0 || >=18.0.0} + '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -316,6 +421,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} + engines: {node: '>=0.4.0'} + hasBin: true + agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} @@ -323,14 +433,26 @@ packages: ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + ansi-regex@2.1.1: + resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} + engines: {node: '>=0.10.0'} + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + ansi-styles@2.2.1: + resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} + engines: {node: '>=0.10.0'} + ansi-styles@4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} engines: {node: '>=8'} + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -345,6 +467,10 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + array-union@2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -357,6 +483,13 @@ packages: brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + bson@6.9.0: resolution: {integrity: sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig==} engines: {node: '>=16.20.1'} @@ -373,6 +506,10 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + chalk@1.1.3: + resolution: {integrity: sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==} + engines: {node: '>=0.10.0'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -406,6 +543,10 @@ packages: resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} engines: {node: '>= 6'} + common-tags@1.8.2: + resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} + engines: {node: '>=4.0.0'} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -418,8 +559,8 @@ packages: cron@3.2.1: resolution: {integrity: sha512-w2n5l49GMmmkBFEsH9FIDhjZ1n1QgTMOCMGuQtOXs5veNiosZmso6bQGuqOJSYAXXrG84WQFVneNk+Yt0Ua9iw==} - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} crypt@0.0.2: @@ -467,6 +608,10 @@ packages: resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} engines: {node: '>=8'} + dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + discord-api-types@0.37.100: resolution: {integrity: sha512-a8zvUI0GYYwDtScfRd/TtaNBDTXwP5DiDVX7K5OmE+DRT57gBqKnwtOC5Ol8z0mRW8KQfETIgiB8U0YZ9NXiCA==} @@ -502,6 +647,9 @@ packages: resolution: {integrity: sha512-EPCWE9OkA9DnFFNrO7Kl1WHHDYFXu3CNVFJg63bfU7hVtjZGyhShwZtSBImINQRWxWP2tgo2XI+QhdXx28r0aA==} engines: {node: '>=18'} + dlv@1.1.3: + resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} + doctrine@3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -526,6 +674,10 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -534,15 +686,38 @@ packages: resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-scope@8.2.0: + resolution: {integrity: sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-visitor-keys@4.2.0: + resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@8.57.1: resolution: {integrity: sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true + eslint@9.16.0: + resolution: {integrity: sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@10.3.0: + resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -570,6 +745,10 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} @@ -587,10 +766,18 @@ packages: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + file-type@16.5.4: resolution: {integrity: sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==} engines: {node: '>=10'} + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + find-up@5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} engines: {node: '>=10'} @@ -599,6 +786,10 @@ packages: resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} @@ -638,6 +829,10 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + glob-parent@6.0.2: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} @@ -650,6 +845,18 @@ packages: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + + globals@15.13.0: + resolution: {integrity: sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==} + engines: {node: '>=18'} + + globby@11.1.0: + resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} + engines: {node: '>=10'} + got@13.0.0: resolution: {integrity: sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA==} engines: {node: '>=16'} @@ -657,6 +864,10 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + has-ansi@2.0.0: + resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} + engines: {node: '>=0.10.0'} + has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} @@ -715,6 +926,10 @@ packages: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. @@ -741,6 +956,10 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} @@ -806,6 +1025,13 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + loglevel-colored-level-prefix@1.0.0: + resolution: {integrity: sha512-u45Wcxxc+SdAlh4yeF/uKlC1SPUPCy0gullSNKXod5I4bmifzk+Q4lSLExNEVn19tGaJipbZ4V4jbFn79/6mVA==} + + loglevel@1.9.2: + resolution: {integrity: sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==} + engines: {node: '>= 0.6.0'} + long@5.2.3: resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} @@ -830,6 +1056,14 @@ packages: memory-pager@1.5.0: resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} @@ -841,6 +1075,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -996,14 +1234,43 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + peek-readable@4.1.0: resolution: {integrity: sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==} engines: {node: '>=8'} + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-eslint@16.3.0: + resolution: {integrity: sha512-Lh102TIFCr11PJKUMQ2kwNmxGhTsv/KzUg9QYF2Gkw259g/kPgndZDWavk7/ycbRvj2oz4BPZ1gCU8bhfZH/Xg==} + engines: {node: '>=16.10.0'} + peerDependencies: + prettier-plugin-svelte: ^3.0.0 + svelte-eslint-parser: '*' + peerDependenciesMeta: + prettier-plugin-svelte: + optional: true + svelte-eslint-parser: + optional: true + + prettier@3.4.2: + resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==} + engines: {node: '>=14'} + hasBin: true + + pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + prism-media@1.3.5: resolution: {integrity: sha512-IQdl0Q01m4LrkN1EGIE9lphov5Hy7WWlH6ulf5QdGePLlPas9p2mhgddTEHrlaXYjjFToM1/rWuwF37VF4taaA==} peerDependencies: @@ -1038,6 +1305,9 @@ packages: randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + readable-stream@1.0.34: resolution: {integrity: sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==} @@ -1055,6 +1325,9 @@ packages: regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + require-relative@0.8.7: + resolution: {integrity: sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==} + resolve-alpn@1.2.1: resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} @@ -1126,6 +1399,10 @@ packages: signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + smart-buffer@4.2.0: resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} @@ -1167,6 +1444,10 @@ packages: string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + strip-ansi@3.0.1: + resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} + engines: {node: '>=0.10.0'} + strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -1179,6 +1460,10 @@ packages: resolution: {integrity: sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==} engines: {node: '>=10'} + supports-color@2.0.0: + resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} + engines: {node: '>=0.8.0'} + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1193,6 +1478,10 @@ packages: tiny-typed-emitter@2.1.0: resolution: {integrity: sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==} + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + token-types@4.2.1: resolution: {integrity: sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==} engines: {node: '>=10'} @@ -1204,6 +1493,12 @@ packages: resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} engines: {node: '>=14'} + ts-api-utils@1.4.3: + resolution: {integrity: sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + ts-mixer@6.0.4: resolution: {integrity: sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==} @@ -1218,6 +1513,11 @@ packages: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} @@ -1245,6 +1545,12 @@ packages: varint@6.0.0: resolution: {integrity: sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==} + vue-eslint-parser@9.4.3: + resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} + engines: {node: ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '>=6.0.0' + web-streams-polyfill@3.3.3: resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} engines: {node: '>= 8'} @@ -1432,7 +1738,24 @@ snapshots: eslint: 8.57.1 eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.11.0': {} + '@eslint-community/eslint-utils@4.4.0(eslint@9.16.0)': + dependencies: + eslint: 9.16.0 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/config-array@0.19.1': + dependencies: + '@eslint/object-schema': 2.1.5 + debug: 4.3.7 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/core@0.9.1': + dependencies: + '@types/json-schema': 7.0.15 '@eslint/eslintrc@2.1.4': dependencies: @@ -1448,10 +1771,39 @@ snapshots: transitivePeerDependencies: - supports-color + '@eslint/eslintrc@3.2.0': + dependencies: + ajv: 6.12.6 + debug: 4.3.7 + espree: 10.3.0 + globals: 14.0.0 + ignore: 5.3.2 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + '@eslint/js@8.57.1': {} + '@eslint/js@9.16.0': {} + + '@eslint/object-schema@2.1.5': {} + + '@eslint/plugin-kit@0.2.4': + dependencies: + levn: 0.4.1 + '@fastify/busboy@2.1.1': {} + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -1464,6 +1816,14 @@ snapshots: '@humanwhocodes/object-schema@2.0.3': {} + '@humanwhocodes/retry@0.3.1': {} + + '@humanwhocodes/retry@0.4.1': {} + + '@jest/schemas@29.6.3': + dependencies: + '@sinclair/typebox': 0.27.8 + '@mongodb-js/saslprep@1.1.9': dependencies: sparse-bitfield: 3.0.3 @@ -1532,16 +1892,28 @@ snapshots: '@sapphire/snowflake@3.5.3': {} + '@sinclair/typebox@0.27.8': {} + '@sindresorhus/is@5.6.0': {} + '@stylistic/eslint-plugin-js@2.11.0(eslint@9.16.0)': + dependencies: + eslint: 9.16.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + '@szmarczak/http-timer@5.0.1': dependencies: defer-to-connect: 2.0.1 '@tokenizer/token@0.3.0': {} + '@types/estree@1.0.6': {} + '@types/http-cache-semantics@4.0.4': {} + '@types/json-schema@7.0.15': {} + '@types/luxon@3.4.2': {} '@types/node@22.5.5': @@ -1558,6 +1930,46 @@ snapshots: dependencies: '@types/node': 22.5.5 + '@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2)': + dependencies: + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.7.2) + '@typescript-eslint/visitor-keys': 6.21.0 + debug: 4.3.7 + eslint: 8.57.1 + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@6.21.0': + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + + '@typescript-eslint/types@6.21.0': {} + + '@typescript-eslint/typescript-estree@6.21.0(typescript@5.7.2)': + dependencies: + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 + debug: 4.3.7 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.3 + ts-api-utils: 1.4.3(typescript@5.7.2) + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/visitor-keys@6.21.0': + dependencies: + '@typescript-eslint/types': 6.21.0 + eslint-visitor-keys: 3.4.3 + '@ungap/structured-clone@1.2.0': {} '@vladfrangu/async_event_emitter@2.4.6': {} @@ -1566,12 +1978,14 @@ snapshots: abbrev@1.1.1: {} - acorn-jsx@5.3.2(acorn@8.12.1): + acorn-jsx@5.3.2(acorn@8.14.0): dependencies: - acorn: 8.12.1 + acorn: 8.14.0 acorn@8.12.1: {} + acorn@8.14.0: {} + agent-base@6.0.2: dependencies: debug: 4.3.7 @@ -1585,12 +1999,18 @@ snapshots: json-schema-traverse: 0.4.1 uri-js: 4.4.1 + ansi-regex@2.1.1: {} + ansi-regex@5.0.1: {} + ansi-styles@2.2.1: {} + ansi-styles@4.3.0: dependencies: color-convert: 2.0.1 + ansi-styles@5.2.0: {} + any-promise@1.3.0: {} aproba@2.0.0: {} @@ -1602,6 +2022,8 @@ snapshots: argparse@2.0.1: {} + array-union@2.1.0: {} + balanced-match@1.0.2: {} barse@0.4.3: @@ -1615,6 +2037,14 @@ snapshots: balanced-match: 1.0.2 concat-map: 0.0.1 + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + bson@6.9.0: {} cacheable-lookup@7.0.0: {} @@ -1631,6 +2061,14 @@ snapshots: callsites@3.1.0: {} + chalk@1.1.3: + dependencies: + ansi-styles: 2.2.1 + escape-string-regexp: 1.0.5 + has-ansi: 2.0.0 + strip-ansi: 3.0.1 + supports-color: 2.0.0 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -1669,6 +2107,8 @@ snapshots: commander@6.2.1: {} + common-tags@1.8.2: {} + concat-map@0.0.1: {} console-control-strings@1.1.0: {} @@ -1680,7 +2120,7 @@ snapshots: '@types/luxon': 3.4.2 luxon: 3.5.0 - cross-spawn@7.0.3: + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 shebang-command: 2.0.0 @@ -1718,6 +2158,10 @@ snapshots: detect-libc@2.0.3: {} + dir-glob@3.0.1: + dependencies: + path-type: 4.0.0 + discord-api-types@0.37.100: {} discord-api-types@0.37.107: {} @@ -1790,6 +2234,8 @@ snapshots: - bufferutil - utf-8-validate + dlv@1.1.3: {} + doctrine@3.0.0: dependencies: esutils: 2.0.3 @@ -1816,6 +2262,8 @@ snapshots: entities@4.5.0: {} + escape-string-regexp@1.0.5: {} + escape-string-regexp@4.0.0: {} eslint-scope@7.2.2: @@ -1823,12 +2271,19 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 + eslint-scope@8.2.0: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + eslint-visitor-keys@3.4.3: {} + eslint-visitor-keys@4.2.0: {} + eslint@8.57.1: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.1) - '@eslint-community/regexpp': 4.11.0 + '@eslint-community/regexpp': 4.12.1 '@eslint/eslintrc': 2.1.4 '@eslint/js': 8.57.1 '@humanwhocodes/config-array': 0.13.0 @@ -1837,7 +2292,7 @@ snapshots: '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 - cross-spawn: 7.0.3 + cross-spawn: 7.0.6 debug: 4.3.7 doctrine: 3.0.0 escape-string-regexp: 4.0.0 @@ -1868,10 +2323,55 @@ snapshots: transitivePeerDependencies: - supports-color + eslint@9.16.0: + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.16.0) + '@eslint-community/regexpp': 4.12.1 + '@eslint/config-array': 0.19.1 + '@eslint/core': 0.9.1 + '@eslint/eslintrc': 3.2.0 + '@eslint/js': 9.16.0 + '@eslint/plugin-kit': 0.2.4 + '@humanfs/node': 0.16.6 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.1 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.3.7 + escape-string-regexp: 4.0.0 + eslint-scope: 8.2.0 + eslint-visitor-keys: 4.2.0 + espree: 10.3.0 + esquery: 1.6.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.4 + transitivePeerDependencies: + - supports-color + + espree@10.3.0: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.2.0 + espree@9.6.1: dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) eslint-visitor-keys: 3.4.3 esquery@1.6.0: @@ -1890,6 +2390,14 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-glob@3.3.2: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + fast-json-stable-stringify@2.1.0: {} fast-levenshtein@2.0.6: {} @@ -1907,12 +2415,20 @@ snapshots: dependencies: flat-cache: 3.2.0 + file-entry-cache@8.0.0: + dependencies: + flat-cache: 4.0.1 + file-type@16.5.4: dependencies: readable-web-to-node-stream: 3.0.2 strtok3: 6.3.0 token-types: 4.2.1 + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + find-up@5.0.0: dependencies: locate-path: 6.0.0 @@ -1924,6 +2440,11 @@ snapshots: keyv: 4.5.4 rimraf: 3.0.2 + flat-cache@4.0.1: + dependencies: + flatted: 3.3.1 + keyv: 4.5.4 + flatted@3.3.1: {} form-data-encoder@2.1.4: {} @@ -1976,6 +2497,10 @@ snapshots: get-stream@6.0.1: {} + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + glob-parent@6.0.2: dependencies: is-glob: 4.0.3 @@ -1993,6 +2518,19 @@ snapshots: dependencies: type-fest: 0.20.2 + globals@14.0.0: {} + + globals@15.13.0: {} + + globby@11.1.0: + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.3.2 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 3.0.0 + got@13.0.0: dependencies: '@sindresorhus/is': 5.6.0 @@ -2009,6 +2547,10 @@ snapshots: graphemer@1.4.0: {} + has-ansi@2.0.0: + dependencies: + ansi-regex: 2.1.1 + has-flag@4.0.0: {} has-unicode@2.0.1: {} @@ -2040,9 +2582,11 @@ snapshots: i18next-fs-backend@2.6.0: {} - i18next@24.0.0: + i18next@24.0.0(typescript@5.7.2): dependencies: '@babel/runtime': 7.25.6 + optionalDependencies: + typescript: 5.7.2 iconv-lite@0.6.3: dependencies: @@ -2059,6 +2603,8 @@ snapshots: imurmurhash@0.1.4: {} + indent-string@4.0.0: {} + inflight@1.0.6: dependencies: once: 1.4.0 @@ -2082,6 +2628,8 @@ snapshots: dependencies: is-extglob: 2.1.1 + is-number@7.0.0: {} + is-path-inside@3.0.3: {} isarray@0.0.1: {} @@ -2139,6 +2687,13 @@ snapshots: lodash@4.17.21: {} + loglevel-colored-level-prefix@1.0.0: + dependencies: + chalk: 1.1.3 + loglevel: 1.9.2 + + loglevel@1.9.2: {} + long@5.2.3: {} lowercase-keys@3.0.0: {} @@ -2159,6 +2714,13 @@ snapshots: memory-pager@1.5.0: {} + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + mimic-response@3.1.0: {} mimic-response@4.0.0: {} @@ -2167,6 +2729,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@9.0.3: + dependencies: + brace-expansion: 2.0.1 + minimist@1.2.8: {} minipass@3.3.6: @@ -2308,10 +2874,39 @@ snapshots: path-key@3.1.1: {} + path-type@4.0.0: {} + peek-readable@4.1.0: {} + picomatch@2.3.1: {} + prelude-ls@1.2.1: {} + prettier-eslint@16.3.0: + dependencies: + '@typescript-eslint/parser': 6.21.0(eslint@8.57.1)(typescript@5.7.2) + common-tags: 1.8.2 + dlv: 1.1.3 + eslint: 8.57.1 + indent-string: 4.0.0 + lodash.merge: 4.6.2 + loglevel-colored-level-prefix: 1.0.0 + prettier: 3.4.2 + pretty-format: 29.7.0 + require-relative: 0.8.7 + typescript: 5.7.2 + vue-eslint-parser: 9.4.3(eslint@8.57.1) + transitivePeerDependencies: + - supports-color + + prettier@3.4.2: {} + + pretty-format@29.7.0: + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.3.1 + prism-media@1.3.5(@discordjs/opus@0.9.0): optionalDependencies: '@discordjs/opus': 0.9.0 @@ -2328,6 +2923,8 @@ snapshots: dependencies: safe-buffer: 5.2.1 + react-is@18.3.1: {} + readable-stream@1.0.34: dependencies: core-util-is: 1.0.3 @@ -2357,6 +2954,8 @@ snapshots: regenerator-runtime@0.14.1: {} + require-relative@0.8.7: {} + resolve-alpn@1.2.1: {} resolve-from@4.0.0: {} @@ -2413,6 +3012,8 @@ snapshots: signal-exit@3.0.7: {} + slash@3.0.0: {} + smart-buffer@4.2.0: optional: true @@ -2461,6 +3062,10 @@ snapshots: dependencies: safe-buffer: 5.2.1 + strip-ansi@3.0.1: + dependencies: + ansi-regex: 2.1.1 + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -2472,6 +3077,8 @@ snapshots: '@tokenizer/token': 0.3.0 peek-readable: 4.1.0 + supports-color@2.0.0: {} + supports-color@7.2.0: dependencies: has-flag: 4.0.0 @@ -2489,6 +3096,10 @@ snapshots: tiny-typed-emitter@2.1.0: {} + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + token-types@4.2.1: dependencies: '@tokenizer/token': 0.3.0 @@ -2500,6 +3111,10 @@ snapshots: dependencies: punycode: 2.3.1 + ts-api-utils@1.4.3(typescript@5.7.2): + dependencies: + typescript: 5.7.2 + ts-mixer@6.0.4: {} tslib@2.7.0: {} @@ -2510,6 +3125,8 @@ snapshots: type-fest@0.20.2: {} + typescript@5.7.2: {} + undici-types@6.19.8: {} undici@5.28.4: @@ -2530,6 +3147,19 @@ snapshots: varint@6.0.0: {} + vue-eslint-parser@9.4.3(eslint@8.57.1): + dependencies: + debug: 4.3.7 + eslint: 8.57.1 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.6.0 + lodash: 4.17.21 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + web-streams-polyfill@3.3.3: {} webidl-conversions@3.0.1: {} From 484364ba8f60c42bbcebc89ad1b659515d7f5f91 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 5 Dec 2024 20:15:07 +0500 Subject: [PATCH 02/37] modules yipee --- .gitignore | 3 - .gitmodules | 4 - README.md | 8 +- base/BaseEvent.js | 2 +- base/Client.js | 95 ++-- base/Guild.js | 102 ++--- base/Member.js | 55 +-- base/User.js | 26 +- commands/Administration/config.js | 25 +- commands/General/stats.js | 1 - config.sample.js | 6 +- dashboard/dashboard-core | 1 - dashboard/dashboard.js | 221 ---------- dashboard/settings.js | 459 -------------------- eslint.config.js | 2 +- events/CommandHandler.js | 12 +- events/Guild/guildBanAdd.js | 8 +- events/Guild/guildCreate.js | 7 +- events/Guild/guildDelete.js | 8 +- events/Guild/guildMemberAdd.js | 4 +- events/Guild/guildMemberRemove.js | 4 +- events/Guild/guildMemberUpdate.js | 4 +- events/MessageHandler.js | 11 +- events/Monitoring/messageDelete.js | 4 +- events/Monitoring/messageUpdate.js | 4 +- events/Ready.js | 8 +- events/TicketsButton.js | 36 +- helpers/birthdays.js | 10 +- helpers/checkReminds.js | 10 +- helpers/cleanup.js | 5 +- helpers/extenders.js | 2 +- helpers/functions.js | 260 ++++++----- helpers/languages.js | 24 +- helpers/logger.js | 28 +- helpers/tictactoe.js | 478 +++++++++++---------- index.js | 7 +- languages/en-US/administration/config.json | 2 - languages/en-US/dashboard.json | 102 ----- languages/en-US/misc.json | 2 +- languages/language-meta.js | 23 + languages/language-meta.json | 23 - languages/ru-RU/administration/config.json | 2 - languages/ru-RU/dashboard.json | 102 ----- languages/ru-RU/misc.json | 2 +- languages/uk-UA/administration/config.json | 2 - languages/uk-UA/dashboard.json | 102 ----- languages/uk-UA/misc.json | 2 +- 47 files changed, 661 insertions(+), 1647 deletions(-) delete mode 100644 .gitmodules delete mode 160000 dashboard/dashboard-core delete mode 100644 dashboard/dashboard.js delete mode 100644 dashboard/settings.js delete mode 100644 languages/en-US/dashboard.json create mode 100644 languages/language-meta.js delete mode 100644 languages/language-meta.json delete mode 100644 languages/ru-RU/dashboard.json delete mode 100644 languages/uk-UA/dashboard.json diff --git a/.gitignore b/.gitignore index d81631d1..2b86767f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,3 @@ Thumbs.db # Node node_modules - -# Dashboard DB -/json.sqlite diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f1ab3994..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "dashboard/dashboard-core"] - path = dashboard/dashboard-core - url = https://git.jonnybro.ru/jonny_bro/dashboard-core - branch = main diff --git a/README.md b/README.md index 9a5387ff..87ce7928 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ JaBa offers: * Slash and Context commands. * Supports commands in DMs. * Localization support (any language; English, Russian and Ukrainian for now). -* Dashboard for changing various settings. * Basic messages monitoring (updating and deletion). ## Commands @@ -30,10 +29,6 @@ JaBa does many thing, here is **8 main categories**: * **General**: `afk`, `avatar`, `boosters`, `minecraft`, `remindme`, `shorturl`, `serverinfo`, `userinfo`, `whois` and **7** more! * **Bot's owner commands**: `eval`, `servers`, `reload` and **2** more! -## *Kinda* Cool Dashboard - -JaBa has it's own dashboard to change server's settings! - ## Get The Bot ### Ready To Use @@ -54,7 +49,6 @@ Use [this instruction](https://github.com/JonnyBro/JaBa/wiki/Self-Hosting) to le * [Full commands list](https://dash.jababot.ru/commands) * [Discord](https://discord.gg/Ptkj2n9nzZ) * [Github](https://github.com/JonnyBro/JaBa/) -* [Dashboard](https://dash.jababot.ru) ## Support @@ -64,7 +58,7 @@ If you want to contribute, feel free to fork this repo and making a pull request ## TODO * [ ] Refactor [tictactoe](./helpers/tictactoe.js). -* [ ] Finish and release *dashboard-core* submodule. +* [ ] Rewrite dashboard. ## License diff --git a/base/BaseEvent.js b/base/BaseEvent.js index bd69c478..2fa28085 100644 --- a/base/BaseEvent.js +++ b/base/BaseEvent.js @@ -11,4 +11,4 @@ class BaseEvent { } } -module.exports = BaseEvent; +export default BaseEvent; diff --git a/base/Client.js b/base/Client.js index d2b21f14..b8217352 100644 --- a/base/Client.js +++ b/base/Client.js @@ -1,32 +1,41 @@ -const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } = require("discord.js"), - { GiveawaysManager } = require("discord-giveaways"), - { REST } = require("@discordjs/rest"), - { Player: DiscordPlayer } = require("discord-player"), - { SpotifyExtractor } = require("@discord-player/extractor"), - { YoutubeiExtractor } = require("discord-player-youtubei"), - { Routes } = require("discord-api-types/v10"); +import { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } from "discord.js"; +import { GiveawaysManager } from "discord-giveaways"; +import { REST } from "@discordjs/rest"; +import { Player } from "discord-player"; +import { SpotifyExtractor } from "@discord-player/extractor"; +import { YoutubeiExtractor } from "discord-player-youtubei"; +import { Routes } from "discord-api-types/v10"; +import { join, sep } from "path"; +import { promises as fs } from "fs"; +import { setTimeout } from "timers/promises"; +import mongoose from "mongoose"; -const BaseEvent = require("./BaseEvent.js"), - BaseCommand = require("./BaseCommand.js").default, - path = require("path"), - fs = require("fs").promises, - mongoose = require("mongoose"); +import config from "../config.js"; +import * as emojis from "../emojis.json"; +import langs from "../languages/language-meta.js"; +import logger from "../helpers/logger.js"; +import * as funcs from "../helpers/functions.js"; + +import BaseEvent from "./BaseEvent.js"; +import BaseCommand from "./BaseCommand.js"; +import guild from "./Guild.js"; +import user from "./User.js"; +import member from "./Member.js"; class JaBaClient extends Client { constructor(options) { super(options); - this.config = require("../config"); - this.customEmojis = require("../emojis"); - this.languages = require("../languages/language-meta"); + this.config = config; + this.customEmojis = emojis; + this.languages = langs; this.commands = new Collection(); - this.logger = require("../helpers/logger"); - this.wait = require("node:timers/promises").setTimeout; - this.functions = require("../helpers/functions"); - this.guildsData = require("../base/Guild"); - this.usersData = require("../base/User"); - this.membersData = require("../base/Member"); - this.dashboard = require("../dashboard/dashboard"); + this.logger = logger; + this.wait = setTimeout; + this.functions = funcs; + this.guildsData = guild.default; + this.usersData = user.default; + this.membersData = member.default; this.databaseCache = {}; this.databaseCache.users = new Collection(); @@ -43,7 +52,7 @@ class JaBaClient extends Client { * @returns {Promise} A Promise that resolves when the client is fully initialized. */ async init() { - this.player = new DiscordPlayer(this); + this.player = new Player(this); await this.player.extractors.register(YoutubeiExtractor, { authentication: this.config.youtubeCookie, @@ -74,13 +83,13 @@ class JaBaClient extends Client { }) ).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 + } else { setTimeout( () => { const message = queue.metadata.channel.messages.cache.get(m); @@ -89,6 +98,7 @@ class JaBaClient extends Client { }, 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))); @@ -113,9 +123,7 @@ class JaBaClient extends Client { mongoose .connect(this.config.mongoDB) - .then(() => { - this.logger.log("Connected to the MongoDB database."); - }) + .then(this.logger.log("Connected to the MongoDB database.")) .catch(e => { this.logger.error(`Unable to connect to the MongoDB database.\nError: ${e.message}\n${e.stack}`); }); @@ -134,8 +142,8 @@ class JaBaClient extends Client { */ async loadCommands(dir) { const rest = new REST().setToken(this.config.token), - filePath = path.join(__dirname, dir), - folders = (await fs.readdir(filePath)).map(file => path.join(filePath, file)); + filePath = join(__dirname, dir), + folders = (await fs.readdir(filePath)).map(file => join(filePath, file)); const commands = []; for (const folder of folders) { @@ -144,7 +152,7 @@ class JaBaClient extends Client { for (const file of files) { if (!file.endsWith(".js")) continue; - const Command = require(path.join(folder, file)); + const Command = require(join(folder, file)); if (!(Command.prototype instanceof BaseCommand)) continue; @@ -165,8 +173,8 @@ class JaBaClient extends Client { await rest.put(route, { body: commands }); this.logger.log("Successfully registered application commands."); - } catch (err) { - this.logger.error("Error registering application commands:", err); + } catch (e) { + this.logger.error("Error registering application commands:", e); } } @@ -178,7 +186,7 @@ class JaBaClient extends Client { */ async loadCommand(dir, file) { try { - const Command = require(path.join(dir, `${file}.js`)); + const Command = require(join(dir, `${file}.js`)); if (!(Command.prototype instanceof BaseCommand)) { return this.logger.error(`Tried to load a non-command file: "${file}.js"`); @@ -190,8 +198,8 @@ class JaBaClient extends Client { if (typeof command.onLoad === "function") await command.onLoad(this); this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`); - } catch (error) { - this.logger.error(`Error loading command "${file}":`, error); + } catch (e) { + this.logger.error(`Error loading command "${file}":`, e); } } @@ -202,7 +210,7 @@ class JaBaClient extends Client { * @returns {void} This method does not return a value. */ unloadCommand(dir, name) { - delete require.cache[require.resolve(`${dir}${path.sep}${name}.js`)]; + delete require.cache[require.resolve(`${dir}${sep}${name}.js`)]; return; } @@ -213,15 +221,15 @@ class JaBaClient extends Client { * @returns {Promise} This method does not return a value. */ async loadEvents(dir) { - const filePath = path.join(__dirname, dir); + const filePath = join(__dirname, dir); const files = await fs.readdir(filePath); for (const file of files) { - const fullPath = path.join(filePath, file); + const fullPath = join(filePath, file); const stat = await fs.lstat(fullPath); if (stat.isDirectory()) { - await this.loadEvents(path.join(dir, file)); + await this.loadEvents(join(dir, file)); continue; } @@ -244,8 +252,8 @@ class JaBaClient extends Client { event.once ? this.once(event.name, event.execute.bind(event, this)) : this.on(event.name, event.execute.bind(event, this)); this.logger.log(`Successfully loaded "${file}" event. (Event: ${event.name})`); - } catch (error) { - this.logger.error(`Error loading event "${file}":`, error); + } catch (e) { + this.logger.error(`Error loading event "${file}":`, e); } } } @@ -348,6 +356,7 @@ class JaBaClient extends Client { await memberData.save(); const guildData = await this.getGuildData(guildId); + if (guildData) { guildData.members.push(memberData._id); await guildData.save(); @@ -377,4 +386,4 @@ class JaBaClient extends Client { } } -module.exports = JaBaClient; +export default JaBaClient; diff --git a/base/Guild.js b/base/Guild.js index 634cfdd9..a2b3507b 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -1,55 +1,57 @@ -const mongoose = require("mongoose"), - Schema = mongoose.Schema, - languages = require("../languages/language-meta.json"); +import { model, Schema } from "mongoose"; +import { langs } from "../languages/language-meta.js"; -module.exports = mongoose.model("Guild", new Schema({ - id: { type: String }, +export default model( + "Guild", + new Schema({ + id: { type: String }, - membersData: { type: Object, default: {} }, - members: [{ type: Schema.Types.ObjectId, ref: "Member" }], + membersData: { type: Object, default: {} }, + members: [{ type: Schema.Types.ObjectId, ref: "Member" }], - language: { type: String, default: languages.find(l => l.default).name }, - plugins: { - type: Object, - default: { - welcome: { - enabled: false, - message: null, - channel: null, - withImage: null, + language: { type: String, default: langs.find(l => l.default).name }, + plugins: { + type: Object, + default: { + welcome: { + enabled: false, + message: null, + channel: null, + withImage: null, + }, + goodbye: { + enabled: false, + message: null, + channel: null, + withImage: null, + }, + autorole: { + enabled: false, + role: null, + }, + automod: { + enabled: false, + ignored: [], + }, + warnsSanctions: { + kick: null, + ban: null, + }, + monitoring: { + messageUpdate: null, + messageDelete: null, + }, + tickets: { + count: 0, + ticketLogs: null, + transcriptionLogs: null, + ticketsCategory: null, + }, + suggestions: null, + reports: null, + birthdays: null, + modlogs: null, }, - goodbye: { - enabled: false, - message: null, - channel: null, - withImage: null, - }, - autorole: { - enabled: false, - role: null, - }, - automod: { - enabled: false, - ignored: [], - }, - warnsSanctions: { - kick: null, - ban: null, - }, - monitoring: { - messageUpdate: null, - messageDelete: null, - }, - tickets: { - count: 0, - ticketLogs: null, - transcriptionLogs: null, - ticketsCategory: null, - }, - suggestions: null, - reports: null, - birthdays: null, - modlogs: null, }, - }, -})); + }), +); diff --git a/base/Member.js b/base/Member.js index d494f72c..59aeec04 100644 --- a/base/Member.js +++ b/base/Member.js @@ -1,33 +1,36 @@ -const mongoose = require("mongoose"); +import { model, Schema } from "mongoose"; -module.exports = mongoose.model("Member", new mongoose.Schema({ - id: { type: String }, - guildID: { type: String }, +export default model( + "Member", + new Schema({ + id: { type: String }, + guildID: { type: String }, - money: { type: Number, default: 0 }, - workStreak: { type: Number, default: 0 }, - bankSold: { type: Number, default: 0 }, - exp: { type: Number, default: 0 }, - level: { type: Number, default: 0 }, - transactions: { type: Array, default: [] }, + money: { type: Number, default: 0 }, + workStreak: { type: Number, default: 0 }, + bankSold: { type: Number, default: 0 }, + exp: { type: Number, default: 0 }, + level: { type: Number, default: 0 }, + transactions: { type: Array, default: [] }, - registeredAt: { type: Number, default: Date.now() }, + registeredAt: { type: Number, default: Date.now() }, - cooldowns: { - type: Object, - default: { - work: 0, - rob: 0, + cooldowns: { + type: Object, + default: { + work: 0, + rob: 0, + }, }, - }, - sanctions: { type: Array, default: [] }, - mute: { - type: Object, - default: { - muted: false, - case: null, - endDate: null, + sanctions: { type: Array, default: [] }, + mute: { + type: Object, + default: { + muted: false, + case: null, + endDate: null, + }, }, - }, -})); + }), +); diff --git a/base/User.js b/base/User.js index c455a4c4..e86ba80b 100644 --- a/base/User.js +++ b/base/User.js @@ -1,5 +1,5 @@ -const mongoose = require("mongoose"), - Canvas = require("@napi-rs/canvas"); +import { Schema, model } from "mongoose"; +import { createCanvas, loadImage } from "@napi-rs/canvas"; const genToken = () => { let token = ""; @@ -9,7 +9,7 @@ const genToken = () => { return token; }; -const userSchema = new mongoose.Schema({ +const userSchema = new Schema({ id: { type: String }, rep: { type: Number, default: 0 }, @@ -88,17 +88,17 @@ const userSchema = new mongoose.Schema({ }); userSchema.method("getAchievements", async function () { - const canvas = Canvas.createCanvas(1800, 250), + const canvas = createCanvas(1800, 250), ctx = canvas.getContext("2d"); const images = [ - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.work.achieved ? "_colored" : ""}1.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.firstCommand.achieved ? "_colored" : ""}2.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.married.achieved ? "_colored" : ""}3.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), - await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.work.achieved ? "_colored" : ""}1.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.firstCommand.achieved ? "_colored" : ""}2.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.married.achieved ? "_colored" : ""}3.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), + await loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`), ]; let dim = 0; @@ -107,7 +107,7 @@ userSchema.method("getAchievements", async function () { dim += 200; } - return (await canvas.encode("png")); + return await canvas.encode("png"); }); -module.exports = mongoose.model("User", userSchema); +export default model("User", userSchema); diff --git a/commands/Administration/config.js b/commands/Administration/config.js index c0aa1f57..d4f5f0df 100644 --- a/commands/Administration/config.js +++ b/commands/Administration/config.js @@ -103,7 +103,8 @@ class Config extends BaseCommand { ? interaction.translate("administration/config:WELCOME_CONTENT", { channel: `<#${guildData.plugins.welcome.channel}>`, withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), inline: true, }, { @@ -112,7 +113,8 @@ class Config extends BaseCommand { ? interaction.translate("administration/config:GOODBYE_CONTENT", { channel: `<#${guildData.plugins.goodbye.channel}>`, withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), inline: true, }, { @@ -125,19 +127,22 @@ class Config extends BaseCommand { (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", { count: guildData.plugins.warnsSanctions.kick, - }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + + }) + : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", { count: guildData.plugins.warnsSanctions.ban, - }) : interaction.translate("administration/config:BAN_NOT_DEFINED")), + }) + : interaction.translate("administration/config:BAN_NOT_DEFINED")), }, { name: interaction.translate("administration/config:AUTOMOD_TITLE"), value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", { channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), - }) : interaction.translate("common:DISABLED"), + }) + : interaction.translate("common:DISABLED"), }, { name: interaction.translate("administration/config:MONITORING_CHANNELS"), @@ -156,10 +161,6 @@ class Config extends BaseCommand { `${interaction.translate("administration/config:TICKETLOGS")}: ${guildData.plugins?.tickets?.ticketLogs ? `<#${guildData.plugins?.tickets?.ticketLogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n` + `${interaction.translate("administration/config:TRANSCRIPTIONLOGS")}: ${guildData.plugins?.tickets?.transcriptionLogs ? `<#${guildData.plugins?.tickets?.transcriptionLogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`}\n`, }, - { - name: interaction.translate("administration/config:DASHBOARD_TITLE"), - value: `[${interaction.translate("administration/config:DASHBOARD_CONTENT")}](${client.config.dashboard.domain})`, - }, ], }); @@ -215,13 +216,14 @@ async function changeSetting(interaction, setting, state, channel) { content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, ephemeral: true, }); - } else + } else { return interaction.reply({ content: `${interaction.translate(`administration/config:${settingSplitted.length === 2 ? settingSplitted[1].toUpperCase() : setting.toUpperCase()}`)}: ${ data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**` }`, ephemeral: true, }); + } } } else { if (!state) { @@ -245,13 +247,14 @@ async function changeSetting(interaction, setting, state, channel) { content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, ephemeral: true, }); - } else + } else { return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${ data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**` }`, ephemeral: true, }); + } } } } diff --git a/commands/General/stats.js b/commands/General/stats.js index 7cc62b61..2813fcb2 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -91,7 +91,6 @@ class Stats extends BaseCommand { { name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"), value: interaction.translate("misc:STATS_FOOTER", { - dashboardLink: client.config.dashboard.domain, supportLink: "https://discord.gg/Ptkj2n9nzZ", inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] }), owner: client.config.owner.id, diff --git a/config.sample.js b/config.sample.js index 6257bd15..4a008270 100644 --- a/config.sample.js +++ b/config.sample.js @@ -1,4 +1,4 @@ -export const config = { +export default { /* The token of your Discord Bot */ token: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", /* UserID of your Discord Bot */ @@ -22,14 +22,14 @@ export const config = { invite: "https://discord.gg/discord", // Invite link to the support server }, /* Dashboard configuration */ - dashboard: { + /* dashboard: { enabled: false, // Whether the dashboard is enabled or not maintanceKey: "letmein", // Maintance key port: 80, // Dashboard port domain: "http://localhost", // The base URL of the dashboard without / at the end secret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Your Bot's Client Secret logs: "123456789098765432", // The channel ID for logs - }, + }, */ /* Embeds defaults */ embed: { color: "#00FF00", // Color diff --git a/dashboard/dashboard-core b/dashboard/dashboard-core deleted file mode 160000 index 42cb4400..00000000 --- a/dashboard/dashboard-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 42cb44000f844f17b0d9e12e15a45ab60f3dcdb7 diff --git a/dashboard/dashboard.js b/dashboard/dashboard.js deleted file mode 100644 index 8279623d..00000000 --- a/dashboard/dashboard.js +++ /dev/null @@ -1,221 +0,0 @@ -const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"), - DBD = require("./dashboard-core/index"), - settings = require("./settings"); - -const { PermissionsBitField } = require("discord.js"); - -const locales = { - "en-US": require("../languages/en-US/dashboard.json"), - "ru-RU": require("../languages/ru-RU/dashboard.json"), - "uk-UA": require("../languages/uk-UA/dashboard.json"), -}; - -/** - * - * @param {import("../base/Client")} client - */ -module.exports.load = async client => { - const commands = client.commands.map(v => { - return { - commandName: v.command.name, - commandDescription: client.translate(`${v.category.toLowerCase()}/${v.command.name}:DESCRIPTION`), - commandUsage: client.translate(`${v.category.toLowerCase()}/${v.command.name}:USAGE`), - commandAlias: "", - _category: v.category, - }; - }); - let categories = []; - - commands.forEach(c => { - if (!categories.includes(c._category)) categories.push(c._category); - }); - - categories = categories.map(c => { - return { - category: c, - categoryId: c.toLowerCase(), - subTitle: "", - hideAlias: true, - hideDescription: false, - hideSidebarItem: c === "Owner" || c === "IAT" ? true : false, - list: commands.filter(v => v._category === c), - }; - }); - - const Dashboard = new DBD.Dashboard({ - port: client.config.dashboard.port, - client: { - id: client.user.id, - secret: client.config.dashboard.secret, - }, - cookiesSecret: client.config.dashboard.secret, - domain: client.config.dashboard.domain, - redirectUri: `${client.config.dashboard.domain}/discord/callback`, - bot: client, - ownerIDs: [client.config.owner.id], - requiredPermissions: PermissionsBitField.Flags.ViewChannel, - invite: { - clientId: client.user.id, - scopes: ["bot", "applications.commands"], - permissions: "8", - redirectUri: `${client.config.dashboard.domain}`, - }, - supportServer: { - slash: "/support", - inviteUrl: client.config.support.invite, - }, - rateLimits: { - manage: { - windowMs: 15 * 60 * 1000, // 15 minutes - max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes) - message: "You are ratelimited!", // Message returned if user should be rate limited, could be also JSON/HTML - store: null, // - if null, new MemoryStore() - // supported stores: https://www.npmjs.com/package/express-rate-limit#store - }, - guildPage: { - windowMs: 15 * 60 * 1000, - max: 100, - message: "You are ratelimited!", - store: null, - }, - settingsUpdatePostAPI: { - windowMs: 15 * 60 * 1000, - max: 100, - message: "You are ratelimited!", - store: null, - }, - }, - useTheme404: true, - useThemeMaintenance: true, - useUnderMaintenance: false, - underMaintenanceAccessKey: client.config.dashboard.maintanceKey, - underMaintenanceAccessPage: "/get-access", - underMaintenance: { - title: "Under Maintenance", - contentTitle: "This page is under maintenance", - texts: [ - "
", - "We still want to change for the better for you.", - "Therefore, we are introducing technical updates so that we can allow you to enjoy the quality of our services.", - "
", - `Come back to us later or join our Discord Support Server`, - ], - }, - theme: SoftUI({ - customThemeOptions: { - // eslint-disable-next-line no-unused-vars - index: async ({ req, res, config }) => { - const user = req.session?.user; - const username = (user?.discriminator === "0" ? user?.username : user?.tag) || "Guest"; - - let users = 0; - client.guilds.cache.forEach(g => { - users += g.memberCount; - }); - - const cards = [ - { - title: "Current User", - icon: "single-02", - getValue: username, - }, - { - title: "Playing music in this much servers", - icon: "settings-gear-65", - getValue: client.player.nodes.cache.size, - }, - { - title: "Users Count", - icon: "favourite-28", - getValue: users, - }, - { - title: "Servers Count", - icon: "notification-70", - getValue: `${client.guilds.cache.size - 1} out of 2000`, - progressBar: { - enabled: true, - getProgress: Math.round(((client.guilds.cache.size - 1) / 2000) * 100), - }, - }, - ]; - - return { - values: [], - graph: {}, - cards, - }; - }, - }, - websiteName: `${client.user.username} Dashboard`, - colorScheme: "blue", - supporteMail: "", - icons: { - favicon: client.user.avatarURL(), - noGuildIcon: "https://pnggrid.com/wp-content/uploads/2021/05/Discord-Logo-Circle-1024x1024.png", - sidebar: { - darkUrl: client.user.avatarURL(), - lightUrl: client.user.avatarURL(), - hideName: false, - borderRadius: "1rem", - alignCenter: true, - }, - }, - index: { - card: { - category: "JaBa Bot", - title: "Simple bot made by Jonny_Bro", - description: "JaBa's dashboard", - image: "", - link: { - enabled: false, - url: "https://github.com/JonnyBro", - }, - }, - graph: { - enabled: false, - lineGraph: true, - title: "Memory Usage", - tag: "Memory (MB)", - max: 100, - }, - }, - notify: { - errors: { - settingsSave: "Failed to save setttings", - }, - success: { - settingsSave: "Successfully saved setttings.", - login: "Successfully logged in.", - logout: "Successfully logged out.", - }, - }, - preloader: { - image: "", - spinner: true, - text: "Page is loading", - }, - commands: categories, - locales: { - enUS: locales["en-US"], - ruRU: locales["ru-RU"], - ukUA: locales["uk-UA"], - }, - }), - customPages: [ - DBD.customPagesTypes.redirectToUrl("/github", () => { - return "https://github.com/JonnyBro/JaBa"; - }), - DBD.customPagesTypes.redirectToUrl("/updates", () => { - return "https://github.com/JonnyBro/JaBa/blob/main/dashboard/docs/updates.md"; - }), - ], - settings: settings(client), - }); - - await Dashboard.init().then(() => { - client.logger.ready(`Dashboard launched on port ${client.config.dashboard.port}`); - }).catch(err => { - client.logger.error(`Dashboard failed to initialize:\n${err}`); - }); -}; diff --git a/dashboard/settings.js b/dashboard/settings.js deleted file mode 100644 index 7110aba0..00000000 --- a/dashboard/settings.js +++ /dev/null @@ -1,459 +0,0 @@ -const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"), - DBD = require("./dashboard-core/index"); - -const { PermissionsBitField, ChannelType } = require("discord.js"); - -module.exports = client => [ - { - categoryId: "main", - categoryName: "Main settings", - categoryDescription: "Setup your bot here!", - categoryPermissions: PermissionsBitField.Flags.ManageGuild, - categoryOptionsList: [ - { - optionId: "lang", - optionName: "Language", - optionDescription: "Change bot's language on the server", - optionType: DBD.formTypes.select({ - English: "en-US", - Russian: "ru-RU", - Ukrainian: "uk-UA", - }), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.language; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.language = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome", - optionName: "Welcome Message", - optionDescription: "Setup welcome message on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "welcome_enable", - optionName: "Enabled", - optionDescription: "Toggle welcome messages sending", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_image", - optionName: "Add Image", - optionDescription: "Toggle sending an image with welcome message", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.withImage; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.withImage = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_message", - optionName: "Message", - optionDescription: "Change welcome message (You can use {user}, {server} and {membercount} wildcards)", - optionType: DBD.formTypes.input("Welcome, {user}!", 2, 100, false, false), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.message; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.message = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "welcome_channel", - optionName: "Channel", - optionDescription: "Select a channel for welcome messages", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.welcome.channel; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.welcome.channel = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "goodbye", - optionName: "Goodbye Message", - optionDescription: "Setup goodbye message on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "goodbye_enable", - optionName: "Enabled", - optionDescription: "Toggle goodbye messages sending", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_image", - optionName: "Add Image", - optionDescription: "Toggle sending an image with goodbye message", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.withImage; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.withImage = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_message", - optionName: "Message", - optionDescription: "Change goodbye message (You can use {user}, {server} and {membercount} wildcards)", - optionType: DBD.formTypes.input("goodbye, {user}!", 2, 100, false, false), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.message; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.message = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "goodbye_channel", - optionName: "Channel", - optionDescription: "Select a channel for goodbye messages", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.goodbye.channel; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.goodbye.channel = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "autorole", - optionName: "Auto Role", - optionDescription: "Setup auto role on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "autorole_enable", - optionName: "Enabled", - optionDescription: "Toggle auto role granting for new members", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.autorole.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.autorole.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "autorole_role", - optionName: "Role", - optionDescription: "Select a role for auto role. Select \"-\" to disable", - optionType: DBD.formTypes.rolesSelect(false, false, true), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.autorole.role; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.autorole.role = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "automod", - optionName: "Auto Mod", - optionDescription: "Setup auto mod on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "automod_enable", - optionName: "Enabled", - optionDescription: "Toggle auto mod. It will remove invite links from non-moderators", - optionType: DBD.formTypes.switch(), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.automod.enabled; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.automod.enabled = newData; - - await guildData.save(); - - return; - }, - }, - { - optionId: "automod_ignore", - optionName: "Ignore Channels", - optionDescription: "Select a channels for auto mod to ignore", - optionType: DBD.formTypes.channelsMultiSelect(false, false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.automod.ignored; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.automod.ignored = newData; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "monitoring", - optionName: "Monitoring Channels", - optionDescription: "Setup monitoring channels on the server", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "monitoring_messageupdate", - optionName: "Message Update Channel", - optionDescription: "Select a channel for messages update logs to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins?.monitoring?.messageUpdate; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; - - guildData.plugins.monitoring.messageUpdate = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "monitoring_messagedelete", - optionName: "Message Deletion Channel", - optionDescription: "Select a channel for messages deletion logs to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins?.monitoring?.messageDelete; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {}; - - guildData.plugins.monitoring.messageDelete = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - { - optionId: "channels", - optionName: "Special Channels", - optionDescription: "Setup special channels on the server. Select \"-\" to disable", - optionType: SoftUI.formTypes.multiRow([ - { - optionId: "channels_suggestions", - optionName: "Suggestions Channel", - optionDescription: "Select a channel for suggestions to go to", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.suggestions; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.suggestions = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_reports", - optionName: "Reports Channel", - optionDescription: "Select a channel for reports to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.reports; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.reports = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_birthdays", - optionName: "Birthdays Channel", - optionDescription: "Select a channel for birthdays message to go to. Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.birthdays; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.birthdays = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - { - optionId: "channels_modlogs", - optionName: "Moderation Logs Channel", - optionDescription: "Select a channel for moderation logs to go to (warns). Select \"-\" to disable", - optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]), - getActualSet: async ({ guild }) => { - const guildData = await client.getGuildData(guild.id); - - return guildData.plugins.modlogs; - }, - setNew: async ({ guild, newData }) => { - const guildData = await client.getGuildData(guild.id); - - guildData.plugins.modlogs = newData !== "" ? newData : null; - - await guildData.save(); - - return; - }, - }, - ]), - }, - ], - }, - { - categoryId: "test", - categoryName: "test settings", - categoryDescription: "ooga booga", - categoryPermissions: PermissionsBitField.Flags.ViewChannel, - categoryOptionsList: [ - { - optionType: DBD.formTypes.embedBuilder({ - username: "JaBa", - avatarURL: "https://cdn.discordapp.com/avatars/708637495054565426/af98d49ebc9bf28b40b45ed5a0a623b4.png?size=4096", - }), - }, - ], - }, -]; diff --git a/eslint.config.js b/eslint.config.js index d36eda08..eabf7207 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -18,7 +18,7 @@ export default [ rules: { "arrow-body-style": ["error", "as-needed"], camelcase: "error", - curly: "error", + curly: ["error", "multi-line"], eqeqeq: ["error", "always"], "no-console": "off", "no-var": "error", diff --git a/events/CommandHandler.js b/events/CommandHandler.js index 0337da0c..4923eec7 100644 --- a/events/CommandHandler.js +++ b/events/CommandHandler.js @@ -1,5 +1,5 @@ -const { InteractionType } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { InteractionType } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class CommandHandler extends BaseEvent { constructor() { @@ -33,12 +33,10 @@ class CommandHandler extends BaseEvent { if (interaction.type !== InteractionType.ApplicationCommand || !interaction.isCommand()) return; // IAT Guild Command Check - if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") - return interaction.reply({ content: "IAT only", ephemeral: true }); + if (command?.dirname.includes("IAT") && interaction.guildId !== "1039187019957555252") return interaction.reply({ content: "IAT only", ephemeral: true }); // Owner-only command check - if (command.ownerOnly && interaction.user.id !== client.config.owner.id) - return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true }); + if (command.ownerOnly && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { ephemeral: true }); // First command achievement check const { firstCommand } = interaction.data.user.achievements; @@ -68,4 +66,4 @@ class CommandHandler extends BaseEvent { } } -module.exports = CommandHandler; +export default CommandHandler; diff --git a/events/Guild/guildBanAdd.js b/events/Guild/guildBanAdd.js index be02d479..dd92d904 100644 --- a/events/Guild/guildBanAdd.js +++ b/events/Guild/guildBanAdd.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class guildBanAdd extends BaseEvent { constructor() { @@ -26,8 +26,10 @@ class guildBanAdd extends BaseEvent { await ban.user.send({ embeds: [embed], }); - } catch (e) { /**/ } + } catch { + /**/ + } } } -module.exports = guildBanAdd; +export default guildBanAdd; diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js index ffa6a96f..0856149d 100644 --- a/events/Guild/guildCreate.js +++ b/events/Guild/guildCreate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildCreate extends BaseEvent { constructor() { @@ -62,12 +62,13 @@ class GuildCreate extends BaseEvent { const logChannel = client.channels.cache.get(client.config.support.logs); - if (logChannel) + if (logChannel) { await logChannel.send({ embeds: [embed], }); + } } } } -module.exports = GuildCreate; +export default GuildCreate; diff --git a/events/Guild/guildDelete.js b/events/Guild/guildDelete.js index 20b795cc..b87299c0 100644 --- a/events/Guild/guildDelete.js +++ b/events/Guild/guildDelete.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildDelete extends BaseEvent { constructor() { @@ -25,13 +25,13 @@ class GuildDelete extends BaseEvent { const logChannel = client.channels.cache.get(client.config.support.logs); - if (logChannel) + if (logChannel) { await logChannel.send({ embeds: [embed], }); - else client.logger.warn(`Log channel not found for guild deletion: ${guild.name}`); + } else client.logger.warn(`Log channel not found for guild deletion: ${guild.name}`); } } } -module.exports = GuildDelete; +export default GuildDelete; diff --git a/events/Guild/guildMemberAdd.js b/events/Guild/guildMemberAdd.js index 0112ae64..8bad2c4c 100644 --- a/events/Guild/guildMemberAdd.js +++ b/events/Guild/guildMemberAdd.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberAdd extends BaseEvent { constructor() { @@ -46,4 +46,4 @@ class GuildMemberAdd extends BaseEvent { } } -module.exports = GuildMemberAdd; +export default GuildMemberAdd; diff --git a/events/Guild/guildMemberRemove.js b/events/Guild/guildMemberRemove.js index c3e1499a..9726d708 100644 --- a/events/Guild/guildMemberRemove.js +++ b/events/Guild/guildMemberRemove.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberRemove extends BaseEvent { constructor() { @@ -37,4 +37,4 @@ class GuildMemberRemove extends BaseEvent { } } -module.exports = GuildMemberRemove; +export default GuildMemberRemove; diff --git a/events/Guild/guildMemberUpdate.js b/events/Guild/guildMemberUpdate.js index 2c48d1a9..fd8d1e3b 100644 --- a/events/Guild/guildMemberUpdate.js +++ b/events/Guild/guildMemberUpdate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class GuildMemberUpdate extends BaseEvent { constructor() { @@ -44,4 +44,4 @@ class GuildMemberUpdate extends BaseEvent { } } -module.exports = GuildMemberUpdate; +export default GuildMemberUpdate; diff --git a/events/MessageHandler.js b/events/MessageHandler.js index fd1abac8..6ef06e6a 100644 --- a/events/MessageHandler.js +++ b/events/MessageHandler.js @@ -1,5 +1,5 @@ -const { PermissionsBitField, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { PermissionsBitField, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; const xpCooldown = {}; @@ -23,7 +23,7 @@ class MessageCreate extends BaseEvent { if (message.guild) { if (!message.member) await message.guild.members.fetch(message.author.id); - + data.guild = await client.getGuildData(message.guildId); data.member = await client.getMemberData(message.author.id, message.guildId); } @@ -69,8 +69,7 @@ class MessageCreate extends BaseEvent { if (msg.content) embed.addFields([{ name: message.translate("misc:QUOTE_CONTENT"), value: msg.content }]); if (msg.attachments.size > 0) { - if (msg.attachments.find(a => a.contentType.includes("image/"))) - embed.setImage(msg.attachments.find(a => a.contentType.includes("image/")).url); + if (msg.attachments.find(a => a.contentType.includes("image/"))) embed.setImage(msg.attachments.find(a => a.contentType.includes("image/")).url); embed.addFields([ { @@ -160,4 +159,4 @@ class MessageCreate extends BaseEvent { } } -module.exports = MessageCreate; +export default MessageCreate; diff --git a/events/Monitoring/messageDelete.js b/events/Monitoring/messageDelete.js index 5b760cd1..643bf78d 100644 --- a/events/Monitoring/messageDelete.js +++ b/events/Monitoring/messageDelete.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class messageDelete extends BaseEvent { constructor() { @@ -40,4 +40,4 @@ class messageDelete extends BaseEvent { } } -module.exports = messageDelete; +export default messageDelete; diff --git a/events/Monitoring/messageUpdate.js b/events/Monitoring/messageUpdate.js index 72bc91df..38fa9521 100644 --- a/events/Monitoring/messageUpdate.js +++ b/events/Monitoring/messageUpdate.js @@ -1,4 +1,4 @@ -const BaseEvent = require("../../base/BaseEvent"); +import BaseEvent from "../../base/BaseEvent"; class messageUpdate extends BaseEvent { constructor() { @@ -42,4 +42,4 @@ class messageUpdate extends BaseEvent { } } -module.exports = messageUpdate; +export default messageUpdate; diff --git a/events/Ready.js b/events/Ready.js index 41fd0645..af7fe3cb 100644 --- a/events/Ready.js +++ b/events/Ready.js @@ -1,5 +1,5 @@ -const { ActivityType } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { ActivityType } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class Ready extends BaseEvent { constructor() { @@ -28,8 +28,6 @@ class Ready extends BaseEvent { const checkReminds = require("../helpers/checkReminds"); checkReminds.init(client); - if (client.config.dashboard.enabled) await client.dashboard.load(client); - client.logger.ready(`Loaded a total of ${commands.length} command(s).`); client.logger.ready(`${client.user.getUsername()}, ready to serve ${users} members in ${servers} servers.`); console.timeEnd("botReady"); @@ -63,4 +61,4 @@ class Ready extends BaseEvent { } } -module.exports = Ready; +export default Ready; diff --git a/events/TicketsButton.js b/events/TicketsButton.js index dbbf7340..9aa95547 100644 --- a/events/TicketsButton.js +++ b/events/TicketsButton.js @@ -1,5 +1,5 @@ -const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, PermissionsBitField } = require("discord.js"); -const BaseEvent = require("../base/BaseEvent"); +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, PermissionsBitField } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; class CommandHandler extends BaseEvent { constructor() { @@ -60,9 +60,13 @@ class CommandHandler extends BaseEvent { }); await logChannel.send({ embeds: [logEmbed] }); - await interaction.success("tickets/createticketembed:TICKET_CREATED", { - channel: channel.toString(), - }, { ephemeral: true }); + await interaction.success( + "tickets/createticketembed:TICKET_CREATED", + { + channel: channel.toString(), + }, + { ephemeral: true }, + ); await channel.send(`<@${interaction.user.id}>`); @@ -75,14 +79,8 @@ class CommandHandler extends BaseEvent { description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"), }); - const closeButton = new ButtonBuilder() - .setCustomId("close_ticket") - .setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET")) - .setStyle(ButtonStyle.Danger); - const transcriptButton = new ButtonBuilder() - .setCustomId("transcript_ticket") - .setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET")) - .setStyle(ButtonStyle.Secondary); + const closeButton = new ButtonBuilder().setCustomId("close_ticket").setLabel(interaction.translate("tickets/closeticket:CLOSE_TICKET")).setStyle(ButtonStyle.Danger); + const transcriptButton = new ButtonBuilder().setCustomId("transcript_ticket").setLabel(interaction.translate("tickets/closeticket:TRANSCRIPT_TICKET")).setStyle(ButtonStyle.Secondary); const row = new ActionRowBuilder().addComponents(closeButton, transcriptButton); guildData.plugins.tickets.count++; @@ -135,14 +133,18 @@ class CommandHandler extends BaseEvent { }); transcript += "---- TICKET CLOSED ----\n"; - if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] }); + if (transcriptionLogs !== null) { + interaction.guild.channels.cache + .get(transcriptionLogs) + .send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] }); + } try { await interaction.user.send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }], }); - } catch (e) { + } catch { interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } } @@ -181,7 +183,7 @@ class CommandHandler extends BaseEvent { content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }], }); - } catch (error) { + } catch { interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } } else return; @@ -189,4 +191,4 @@ class CommandHandler extends BaseEvent { } } -module.exports = CommandHandler; +export default CommandHandler; diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 2a8a57d3..7334e6fb 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -1,4 +1,4 @@ -const { CronJob } = require("cron"); +import { CronJob } from "cron"; /** * @@ -61,5 +61,9 @@ async function checkBirthdays(client) { } } -module.exports.init = async client => new CronJob("0 5 * * *", checkBirthdays(client), null, true, "Europe/Moscow"); -module.exports.run = async client => await checkBirthdays(client); +export async function init(client) { + new CronJob("0 5 * * *", checkBirthdays(client), null, true, "Europe/Moscow"); +} +export async function run(client) { + await checkBirthdays(client); +} diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 7f0c123b..7c271c9c 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -56,5 +56,11 @@ async function checkReminds(client) { }); } -module.exports.init = async client => setInterval(async () => await checkReminds(client), 1000); -module.exports.run = async client => await checkReminds(client); +export async function init(client) { + setInterval(async () => { + await checkReminds(client); + }, 1000); +} +export async function run(client) { + await checkReminds(client); +} diff --git a/helpers/cleanup.js b/helpers/cleanup.js index 159bd4e1..59cce4e0 100644 --- a/helpers/cleanup.js +++ b/helpers/cleanup.js @@ -1,5 +1,4 @@ // Thanks Stackoverflow <3 - function setDaysTimeout(callback, days) { // 86400 seconds in a day const msInDay = 86400 * 1000; @@ -19,7 +18,7 @@ function setDaysTimeout(callback, days) { * * @param {import("../base/Client")} client */ -module.exports.init = async function (client) { +export async function init(client) { setDaysTimeout(async () => { const timestamp = Date.now() + 29 * 24 * 60 * 60 * 1000; // 29 days const members = client.membersData.find({ transactions: { $gt: [] } }); @@ -66,4 +65,4 @@ module.exports.init = async function (client) { } }); }, 30); -}; +} diff --git a/helpers/extenders.js b/helpers/extenders.js index 54856c47..33cc2c01 100644 --- a/helpers/extenders.js +++ b/helpers/extenders.js @@ -1,4 +1,4 @@ -const { Message, BaseInteraction, User, GuildMember } = require("discord.js"); +import { Message, BaseInteraction, User, GuildMember } from "discord.js"; /** * diff --git a/helpers/functions.js b/helpers/functions.js index 923885cc..9cd8623b 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -1,147 +1,137 @@ -const moment = require("moment"); +import moment from "moment"; -module.exports = { - /** - * Asynchronously iterates over a collection and executes a callback function for each item. - * - * @param {any[]} collection - The collection to iterate over. - * @param {(item: any) => Promise} callback - The async callback function to execute for each item in the collection. - * @returns {Promise} A promise that resolves when all items in the collection have been processed. - */ - async asyncForEach(collection, callback) { - const allPromises = collection.map(async key => { - await callback(key); - }); +/** + * Asynchronously iterates over a collection and executes a callback function for each item. + * + * @param {any[]} collection - The collection to iterate over. + * @param {(item: any) => Promise} callback - The async callback function to execute for each item in the collection. + * @returns {Promise} A promise that resolves when all items in the collection have been processed. + */ +export async function asyncForEach(collection, callback) { + const allPromises = collection.map(async key => { + await callback(key); + }); - return await Promise.all(allPromises); - }, + return await Promise.all(allPromises); +} - /** - * Sorts an array by the specified key in ascending order. - * - * @param {any[]} array - The array to sort. - * @param {string} key - The key to sort the array by. - * @returns {any[]} The sorted array. - */ - sortByKey(array, key) { - return array.sort(function (a, b) { - const x = a[key]; - const y = b[key]; - return x < y ? 1 : x > y ? -1 : 0; - }); - }, +/** + * Sorts an array by the specified key in ascending order. + * + * @param {any[]} array - The array to sort. + * @param {string} key - The key to sort the array by. + * @returns {any[]} The sorted array. + */ +export function sortByKey(array, key) { + return array.sort(function (a, b) { + const x = a[key]; + const y = b[key]; + return x < y ? 1 : x > y ? -1 : 0; + }); +} - /** - * Shuffles the elements of the provided array in-place. - * - * @param {any[]} pArray - The array to shuffle. - * @returns {any[]} The shuffled array. - */ - shuffle(pArray) { - const array = []; +/** + * Shuffles the elements of the provided array in-place. + * + * @param {any[]} pArray - The array to shuffle. + * @returns {any[]} The shuffled array. + */ +export function shuffle(pArray) { + const array = []; - pArray.forEach(element => array.push(element)); + pArray.forEach(element => array.push(element)); - let currentIndex = array.length, - temporaryValue, - randomIndex; + let currentIndex = array.length, + temporaryValue, + randomIndex; - while (currentIndex !== 0) { - randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; + while (currentIndex !== 0) { + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } - temporaryValue = array[currentIndex]; - array[currentIndex] = array[randomIndex]; - array[randomIndex] = temporaryValue; - } + return array; +} - return array; - }, +/** + * Generates a random integer between the specified minimum and maximum values (inclusive). + * + * @param {number} [min=0] - The minimum value (inclusive). + * @param {number} [max=100] - The maximum value (inclusive). + * @returns {number} A random integer between min and max. + */ +export function randomNum(min = 0, max = 100) { + min = Math.floor(min); + max = Math.floor(max); - /** - * Generates a random integer between the specified minimum and maximum values (inclusive). - * - * @param {number} [min=0] - The minimum value (inclusive). - * @param {number} [max=100] - The maximum value (inclusive). - * @returns {number} A random integer between min and max. - */ - randomNum(min = 0, max = 100) { - min = Math.floor(min); - max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1) + min); +} +/** + * Formats a date for the specified client and locale. + * + * @param {Object} client - The client object containing language data. + * @param {string} date - The date to format. + * @param {string} [format=null] - The date format to use. If not provided, the default format for the client's language will be used. + * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the date. + * @returns {string} The formatted date. + */ +export function printDate(client, date, format = null, locale = client.defaultLanguage.name) { + const languageData = client.languages.find(language => language.name === locale); + if (format === "" || format === null) format = languageData.defaultMomentFormat; + return moment(new Date(date)).locale(languageData.moment).format(format); +} +/** + * Formats a time value relative to the current time. + * + * @param {Object} client - The client object containing language data. + * @param {string|number|Date} time - The time value to format. + * @param {boolean} [type=false] - If true, formats the time as "X time ago", otherwise formats it as "in X time". + * @param {boolean} [prefix=true] - If true, includes a prefix like "in" or "ago" in the formatted time. + * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the time. + * @returns {string} The formatted time value. + */ +export function convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage.name) { + const languageData = client.languages.find(language => language.name === locale); + const m = moment(time).locale(languageData.moment); + return type ? m.toNow(!prefix) : m.fromNow(!prefix); +} - return Math.floor(Math.random() * (max - min + 1) + min); - }, +/** + * 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; +} - /** - * 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; - }, -}; +/** + * 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 '. + */ +export function 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/languages.js b/helpers/languages.js index 78ff2445..742c648e 100644 --- a/helpers/languages.js +++ b/helpers/languages.js @@ -1,19 +1,19 @@ -const i18next = require("i18next"), - Backend = require("i18next-fs-backend"), - path = require("path"), - fs = require("fs").promises; +import { use, init, getFixedT } from "i18next"; +import Backend from "i18next-fs-backend"; +import { join, resolve } from "path"; +import { promises as fs } from "fs"; async function walkDirectory(dir, namespaces = [], folderName = "") { const files = await fs.readdir(dir); const languages = []; for (const file of files) { - const stat = await fs.stat(path.join(dir, file)); + const stat = await fs.stat(join(dir, file)); if (stat.isDirectory()) { const isLanguage = file.includes("-"); if (isLanguage) languages.push(file); - const folder = await walkDirectory(path.join(dir, file), namespaces, isLanguage ? "" : `${file}/`); + const folder = await walkDirectory(join(dir, file), namespaces, isLanguage ? "" : `${file}/`); namespaces = folder.namespaces; } else { @@ -27,16 +27,16 @@ async function walkDirectory(dir, namespaces = [], folderName = "") { }; } -module.exports = async () => { +export default async () => { const options = { - loadPath: path.resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), + loadPath: resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), }; - const { namespaces, languages } = await walkDirectory(path.resolve(__dirname, "../languages/")); + const { namespaces, languages } = await walkDirectory(resolve(__dirname, "../languages/")); - i18next.use(Backend); + use(Backend); - await i18next.init({ + await init({ backend: options, debug: false, fallbackLng: "en-US", @@ -47,5 +47,5 @@ module.exports = async () => { preload: languages, }); - return new Map(languages.map(item => [item, i18next.getFixedT(item)])); + return new Map(languages.map(item => [item, getFixedT(item)])); }; diff --git a/helpers/logger.js b/helpers/logger.js index 86f02925..4c912908 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -1,4 +1,4 @@ -const { bgBlue, black, green } = require("chalk"); +import { bgBlue, black, green } from "chalk"; function dateTimePad(value, digits) { let number = value; @@ -25,28 +25,28 @@ function format(tDate) { ); } -module.exports = class Logger { - static log(content) { +export default { + log(content) { return console.log(`[${format(new Date(Date.now()))}]: ${bgBlue("LOG")} ${content}`); - } + }, - static warn(content) { + warn(content) { return console.log(`[${format(new Date(Date.now()))}]: ${black.bgYellow("WARN")} ${content}`); - } + }, - static error(content) { + error(content) { return console.log(`[${format(new Date(Date.now()))}]: ${black.bgRed("ERROR")} ${content}`); - } + }, - static debug(content) { + debug(content) { return console.log(`[${format(new Date(Date.now()))}]: ${green("DEBUG")} ${content}`); - } + }, - static cmd(content) { + cmd(content) { return console.log(`[${format(new Date(Date.now()))}]: ${black.bgWhite("CMD")} ${content}`); - } + }, - static ready(content) { + ready(content) { return console.log(`[${format(new Date(Date.now()))}]: ${black.bgGreen("READY")} ${content}`); - } + }, }; diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js index a7c44a33..c3d238b9 100644 --- a/helpers/tictactoe.js +++ b/helpers/tictactoe.js @@ -1,7 +1,7 @@ // Thanks to simply-djs for this =) // TODO: Refactor this please... -const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require("discord.js"); +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } from "discord.js"; /** * @param {import("discord.js").ChatInputCommandInteraction} interaction @@ -15,7 +15,7 @@ const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require( * @param {string} options.idleEmoji Emoji for "nothing" * @returns {Promise} */ -async function tictactoe(interaction, options = {}) { +export async function tictactoe(interaction, options = {}) { // eslint-disable-next-line no-async-promise-executor return new Promise(async resolve => { try { @@ -25,41 +25,47 @@ async function tictactoe(interaction, options = {}) { if (interaction.commandId) { opponent = interaction.options.getUser(options.userSlash || "user"); - if (!opponent) + if (!opponent) { return interaction.reply({ content: interaction.translate("fun/tictactoe:NO_USER"), ephemeral: true, }); + } - if (opponent.bot) + if (opponent.bot) { return interaction.reply({ content: interaction.translate("fun/tictactoe:BOT_USER"), ephemeral: true, }); + } - if (opponent.id == (interaction.user ? interaction.user : interaction.author).id) + if (opponent.id === (interaction.user ? interaction.user : interaction.author).id) { return interaction.reply({ content: interaction.translate("misc:CANT_YOURSELF"), ephemeral: true, }); + } } else if (!interaction.commandId) { opponent = interaction.mentions.members.first()?.user; - if (!opponent) + if (!opponent) { return interaction.reply({ content: interaction.translate("fun/tictactoe:NO_USER"), }); + } - if (opponent.bot) + if (opponent.bot) { return interaction.reply({ content: interaction.translate("fun/tictactoe:BOT_USER"), ephemeral: true, }); + } - if (opponent.id === interaction.member.id) + if (opponent.id === interaction.member.id) { return interaction.reply({ content: interaction.translate("misc:CANT_YOURSELF"), }); + } } const footer = options.embedFooter || client.config.embed.footer, @@ -97,25 +103,26 @@ async function tictactoe(interaction, options = {}) { }); collector.on("collect", async button => { - if (button.user.id !== opponent.id) + if (button.user.id !== opponent.id) { return button.reply({ content: interaction.translate("fun/tictactoe:REQUEST_SEND", { opponent: opponent.id, }), ephemeral: true, }); + } - if (button.customId == "declinettt") { + if (button.customId === "declinettt") { button.deferUpdate(); return collector.stop("decline"); - } else if (button.customId == "acceptttt") { + } else if (button.customId === "acceptttt") { button.deferUpdate(); collector.stop(); const fighters = [(interaction.user ? interaction.user : interaction.author).id, opponent.id].sort(() => (Math.random() > 0.5 ? 1 : -1)); - const x_emoji = options.xEmoji || "❌"; - const o_emoji = options.oEmoji || "⭕"; + const xEmoji = options.xEmoji || "❌"; + const oEmoji = options.oEmoji || "⭕"; const dashmoji = options.idleEmoji || "➖"; @@ -175,32 +182,32 @@ async function tictactoe(interaction, options = {}) { }); let msg; - if (interaction.commandId) + if (interaction.commandId) { msg = await interaction.editReply({ embeds: [ epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕", + emoji: client.emojis.cache.get(oEmoji) || "⭕", }), ), ], }); - else if (!interaction.commandId) + } else if (!interaction.commandId) { msg = await button.message.edit({ embeds: [ epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: client.emojis.cache.get(o_emoji) || "⭕", + emoji: client.emojis.cache.get(oEmoji) || "⭕", }), ), ], }); + } await ttt(msg); - // eslint-disable-next-line no-inner-declarations async function ttt(m) { Args.userid = fighters[Args.user]; const won = { @@ -222,214 +229,212 @@ async function tictactoe(interaction, options = {}) { const c = new ActionRowBuilder().addComponents([c1, c2, c3]); const buttons = [a, b, c]; - if (Args.a1.emoji == o_emoji && Args.b1.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b1.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a2.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c2.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a2.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c2.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b3.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b3.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.a2.emoji == o_emoji && Args.a3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.a2.emoji === oEmoji && Args.a3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.b1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.b3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.b1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.b3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (Args.c1.emoji == o_emoji && Args.c2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Args.c1.emoji === oEmoji && Args.c2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (won["<:O_:863314110560993340>"] != false) - if (Args.user == 0) { + if (won["<:O_:863314110560993340>"] !== false) { + if (Args.user === 0) { const won = await client.users.fetch(fighters[1]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); - } else if (Args.user == 1) { + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } + } else if (Args.user === 1) { const won = await client.users.fetch(fighters[0]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } } + } - if (Args.a1.emoji == x_emoji && Args.b1.emoji == x_emoji && Args.c1.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a2.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c2.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a3.emoji == x_emoji && Args.b3.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a1.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a3.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.c1.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.a1.emoji == x_emoji && Args.a2.emoji == x_emoji && Args.a3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.b1.emoji == x_emoji && Args.b2.emoji == x_emoji && Args.b3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (Args.c1.emoji == x_emoji && Args.c2.emoji == x_emoji && Args.c3.emoji == x_emoji) won["<:X_:863314044781723668>"] = true; - if (won["<:X_:863314044781723668>"] != false) - if (Args.user == 0) { + if (Args.a1.emoji === xEmoji && Args.b1.emoji === xEmoji && Args.c1.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a2.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c2.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a3.emoji === xEmoji && Args.b3.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a1.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a3.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.c1.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.a1.emoji === xEmoji && Args.a2.emoji === xEmoji && Args.a3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.b1.emoji === xEmoji && Args.b2.emoji === xEmoji && Args.b3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (Args.c1.emoji === xEmoji && Args.c2.emoji === xEmoji && Args.c3.emoji === xEmoji) won["<:X_:863314044781723668>"] = true; + if (won["<:X_:863314044781723668>"] !== false) { + if (Args.user === 0) { const won = await client.users.fetch(fighters[1]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else if (!options.resultBtn || options.resultBtn === false) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[1], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); - } else if (Args.user == 1) { + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else if (!options.resultBtn || options.resultBtn === false) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[1], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } + } else if (Args.user === 1) { const won = await client.users.fetch(fighters[0]).catch(console.error); resolve(won); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - components: buttons, - embeds: [ - epm.setDescription( - interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - ), - ], - }); - else - return m - .edit({ - content: interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - }), - embeds: [ - epm.setDescription( - `${interaction.translate("fun/tictactoe:WON", { - winner: fighters[0], - emoji: client.emojis.cache.get(o_emoji) || "⭕", - })}\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c3.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), - ), - ], - components: [], - }); + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + components: buttons, + embeds: [ + epm.setDescription( + interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + ), + ], + }); + } else { + return m.edit({ + content: interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + }), + embeds: [ + epm.setDescription( + `${interaction.translate("fun/tictactoe:WON", { + winner: fighters[0], + emoji: client.emojis.cache.get(oEmoji) || "⭕", + })}\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c3.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + ), + ], + components: [], + }); + } } + } m.edit({ content: `<@${Args.userid}>`, @@ -437,7 +442,7 @@ async function tictactoe(interaction, options = {}) { epm.setDescription( interaction.translate("fun/tictactoe:WAITING", { user: Args.userid, - emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`, + emoji: Args.user === 0 ? `${client.emojis.cache.get(oEmoji) || "⭕"}` : `${client.emojis.cache.get(xEmoji) || "❌"}`, }), ), ], @@ -458,18 +463,18 @@ async function tictactoe(interaction, options = {}) { ttt(m); } else { - if (Args.user == 0) { + if (Args.user === 0) { Args.user = 1; Args[b.customId] = { style: ButtonStyle.Success, - emoji: o_emoji, + emoji: oEmoji, disabled: true, }; } else { Args.user = 0; Args[b.customId] = { style: ButtonStyle.Danger, - emoji: x_emoji, + emoji: xEmoji, disabled: true, }; } @@ -487,49 +492,49 @@ async function tictactoe(interaction, options = {}) { .filter(key => predicate(obj[key])) .reduce((res, key) => ((res[key] = obj[key]), res), {}); const Brgs = objectFilter( - map(Args, (_, fruit) => fruit.emoji == dashmoji), - num => num == true, + map(Args, (_, fruit) => fruit.emoji === dashmoji), + num => num === true, ); - if (Object.keys(Brgs).length == 0) { - if (Args.a1.emoji == o_emoji && Args.b1.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a2.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c2.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b3.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a3.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.c1.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.a1.emoji == o_emoji && Args.a2.emoji == o_emoji && Args.a3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.b1.emoji == o_emoji && Args.b2.emoji == o_emoji && Args.b3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; - if (Args.c1.emoji == o_emoji && Args.c2.emoji == o_emoji && Args.c3.emoji == o_emoji) won["<:O_:863314110560993340>"] = true; + if (Object.keys(Brgs).length === 0) { + if (Args.a1.emoji === oEmoji && Args.b1.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a2.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c2.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b3.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a3.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.c1.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.a1.emoji === oEmoji && Args.a2.emoji === oEmoji && Args.a3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.b1.emoji === oEmoji && Args.b2.emoji === oEmoji && Args.b3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; + if (Args.c1.emoji === oEmoji && Args.c2.emoji === oEmoji && Args.c3.emoji === oEmoji) won["<:O_:863314110560993340>"] = true; - if (won["<:O_:863314110560993340>"] == true) return ttt(m); - else if (won["<:X_:863314044781723668>"] == true) return; + if (won["<:O_:863314110560993340>"] === true) return ttt(m); + else if (won["<:X_:863314044781723668>"] === true) return; else { ttt(m); - if (options.resultBtn === true) - return m - .edit({ - content: interaction.translate("fun/tictactoe:TIE"), - embeds: [epm.setDescription(interaction.translate("fun/tictactoe:TIE_DESC"))], - }); - else + if (options.resultBtn === true) { + return m.edit({ + content: interaction.translate("fun/tictactoe:TIE"), + embeds: [epm.setDescription(interaction.translate("fun/tictactoe:TIE_DESC"))], + }); + } else { return m .edit({ content: interaction.translate("fun/tictactoe:TIE"), embeds: [ epm.setDescription( - `${interaction.translate("fun/tictactoe:TIE_DESC")}!\n\`\`\`\n${Args.a1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.a2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.a3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n${Args.b1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.b2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.b3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n${Args.c1.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")} | ${Args.c2.emoji - .replace(o_emoji, "⭕") - .replace(x_emoji, "❌")} | ${Args.c3.emoji.replace(o_emoji, "⭕").replace(x_emoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), + `${interaction.translate("fun/tictactoe:TIE_DESC")}!\n\`\`\`\n${Args.a1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.a2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.a3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n${Args.b1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.b2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.b3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n${Args.c1.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")} | ${Args.c2.emoji + .replace(oEmoji, "⭕") + .replace(xEmoji, "❌")} | ${Args.c3.emoji.replace(oEmoji, "⭕").replace(xEmoji, "❌")}\n\`\`\``.replaceAll(dashmoji, "➖"), ), ], components: [], }) .catch(() => {}); + } } } @@ -537,20 +542,21 @@ async function tictactoe(interaction, options = {}) { } }); collector.on("end", (collected, reason) => { - if (collected.size === 0 && reason == "time") + if (collected.size === 0 && reason === "time") { m.edit({ content: interaction.translate("fun/tictactoe:NO_ANSWER", { user: Args.userid, }), components: [], }); + } }); } } }); collector.on("end", (_, reason) => { - if (reason == "time") { + if (reason === "time") { const embed = client.embed({ author: { name: user.getUsername(), @@ -570,7 +576,7 @@ async function tictactoe(interaction, options = {}) { components: [], }); } - if (reason == "decline") { + if (reason === "decline") { const embed = client.embed({ author: { name: user.getUsername(), @@ -594,6 +600,4 @@ async function tictactoe(interaction, options = {}) { console.log("TicTacToe errored:", e); } }); -} - -module.exports = tictactoe; +}; diff --git a/index.js b/index.js index 93a36e3d..49a3c579 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,10 @@ import "./helpers/extenders.js"; import { GatewayIntentBits } from "discord.js"; -import Client from "./base/Client.js"; +import JaBaClient from "./base/Client.js"; +import languages from "./helpers/languages.js"; -const client = new Client({ +const client = new JaBaClient({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, @@ -27,7 +28,7 @@ const client = new Client({ (async () => { console.time("botReady"); - client.translations = await require("./helpers/languages")(); + client.translations = await languages(); await client.loadEvents("../events"); await client.loadCommands("../commands"); diff --git a/languages/en-US/administration/config.json b/languages/en-US/administration/config.json index ec9ec653..29fc99cf 100644 --- a/languages/en-US/administration/config.json +++ b/languages/en-US/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Automatic Sanctions", "BAN_CONTENT": "Ban: After **{{count}}** warnings", "BAN_NOT_DEFINED": "Ban: Not set", - "DASHBOARD_TITLE": "Modify Settings", - "DASHBOARD_CONTENT": "Click here to go to the dashboard", "GOODBYE_TITLE": "Farewell", "GOODBYE_CONTENT": "Channel: {{channel}}\nCard: {{withImage}}", "KICK_CONTENT": "Kick: After **{{count}}** warnings", diff --git a/languages/en-US/dashboard.json b/languages/en-US/dashboard.json deleted file mode 100644 index 315050aa..00000000 --- a/languages/en-US/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "English", - "index": { - "feeds": [ "Current User", "Playing music in this much servers", "Users Count", "Servers Count" ], - "card": { - "category": "JaBa Bot", - "title": "Simple bot made by Jonny_Bro", - "description": "Upper Text", - "image": "", - "footer": "Bottom Text" - }, - "feedsTitle": "Feeds", - "graphTitle": "Graphs" - }, - "manage": { - "settings": { - "memberCount": "Members", - "info": { - "info": "Info", - "server": "Server Information" - } - } - }, - "privacyPolicy": { - "title": "Privacy Policy", - "description": "Privacy Policy and Terms of Service", - "pp": "Complete Privacy Policy" - }, - "partials": { - "sidebar": { - "dash": "Dashboard", - "manage": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin", - "account": "Account Pages", - "login": "Sign In", - "logout": "Sign Out" - }, - "navbar": { - "home": "Home", - "pages": { - "manage": "Manage Guilds", - "settings": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin Panel", - "error": "Error", - "credits": "Credits", - "debug": "Debug", - "leaderboard": "Leaderboard", - "profile": "Profile", - "maintenance": "Under Maintenance" - } - }, - "title": { - "pages": { - "manage": "Manage Guilds", - "settings": "Manage Guilds", - "commands": "Commands", - "pp": "Privacy Policy", - "admin": "Admin Panel", - "error": "Error", - "credits": "Credits", - "debug": "Debug", - "leaderboard": "Leaderboard", - "profile": "Profile", - "maintenance": "Under Maintenance" - } - }, - "notify": { - "errors": { - "settingsSave": "Failed to save setttings" - }, - "success": { - "settingsSave": "Successfully saved setttings.", - "login": "Successfully logged in.", - "logout": "Successfully logged out." - } - }, - "preloader": { - "text": "Page is loading..." - }, - "premium": { - "title": "Want more from JaBa?", - "description": "Check out premium features below!", - "buttonText": "Become Premium" - }, - "settings": { - "title": "Site Configuration", - "description": "Configurable Viewing Options", - "theme": { - "title": "Site Theme", - "description": "Make the site more appealing for your eyes!" - }, - "language": { - "title": "Site Language", - "description": "Select your preffered language!" - } - } - } -} \ No newline at end of file diff --git a/languages/en-US/misc.json b/languages/en-US/misc.json index ed6d5cd7..baa94e62 100644 --- a/languages/en-US/misc.json +++ b/languages/en-US/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Please specify an integer greater than 0 or `all`.", "OWNER_ONLY": "Only the bot owner can use this command.", "SELECT_CANCELED": "Selection canceled.", - "STATS_FOOTER": "● [Dashboard]({{dashboardLink}})\n● [Support Server]({{supportLink}})\n● [Invite JaBa to Your Server]({{inviteLink}})", + "STATS_FOOTER": "● [Support Server]({{supportLink}})\n● [Invite JaBa to Your Server]({{inviteLink}})", "TIMED_OUT": "Time out.", "JUMP_TO_PAGE": "Specify the page you want to jump to (maximum **{{length}}**):", "QUOTE_TITLE": "Message from {{user}}", diff --git a/languages/language-meta.js b/languages/language-meta.js new file mode 100644 index 00000000..cc409b36 --- /dev/null +++ b/languages/language-meta.js @@ -0,0 +1,23 @@ +export default [ + { + name: "en-US", + nativeName: "English", + moment: "en", + defaultMomentFormat: "HH:mm:ss, MMMM Do YYYY", + default: true, + }, + { + name: "ru-RU", + nativeName: "Русский", + moment: "ru", + defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + default: false, + }, + { + name: "uk-UA", + nativeName: "Українська", + moment: "uk", + defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + default: false, + }, +]; diff --git a/languages/language-meta.json b/languages/language-meta.json deleted file mode 100644 index ae102d46..00000000 --- a/languages/language-meta.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "name": "en-US", - "nativeName": "English", - "moment": "en", - "defaultMomentFormat": "HH:mm:ss, MMMM Do YYYY", - "default": true - }, - { - "name": "ru-RU", - "nativeName": "Русский", - "moment": "ru", - "defaultMomentFormat": "HH:mm:ss, Do MMMM YYYY", - "default": false - }, - { - "name": "uk-UA", - "nativeName": "Українська", - "moment": "uk", - "defaultMomentFormat": "HH:mm:ss, Do MMMM YYYY", - "default": false - } -] \ No newline at end of file diff --git a/languages/ru-RU/administration/config.json b/languages/ru-RU/administration/config.json index 277325d3..eb229e73 100644 --- a/languages/ru-RU/administration/config.json +++ b/languages/ru-RU/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Автоматические наказания", "BAN_CONTENT": "Бан: После **{{count}}** предупреждений", "BAN_NOT_DEFINED": "Бан: Не назначено", - "DASHBOARD_TITLE": "Изменить настройки", - "DASHBOARD_CONTENT": "Нажмите сюда, чтобы перейти в панель управления", "GOODBYE_TITLE": "Прощание", "GOODBYE_CONTENT": "Канал: {{channel}}\nКарточка: {{withImage}}", "KICK_CONTENT": "Кик: После **{{count}}** предупреждений", diff --git a/languages/ru-RU/dashboard.json b/languages/ru-RU/dashboard.json deleted file mode 100644 index c60a4107..00000000 --- a/languages/ru-RU/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "Русский", - "index": { - "feeds": [ "Текущий пользователь", "Играю музыку в стольких серверах", "Кол-во пользователей", "Кол-во серверов" ], - "card": { - "category": "JaBa Bot", - "title": "Простой бот, созданный Jonny_Bro", - "description": "Верхний текст", - "image": "", - "footer": "Нижний текст" - }, - "feedsTitle": "Новости", - "graphTitle": "Графики" - }, - "manage": { - "settings": { - "memberCount": "Участники", - "info": { - "info": "Информация", - "server": "Информация о сервере" - } - } - }, - "privacyPolicy": { - "title": "Политика конф.", - "description": "Политика конфиденциальности и Условия использования", - "pp": "Полная политика конфиденциальности" - }, - "partials": { - "sidebar": { - "dash": "Панель управления", - "manage": "Сервера", - "commands": "Команды", - "pp": "Политика конф.", - "admin": "Админ панель", - "account": "Аккаунт", - "login": "Войти", - "logout": "Выйти" - }, - "navbar": { - "home": "Главная", - "pages": { - "manage": "Настройки серверов", - "settings": "Настройки", - "commands": "Команды", - "pp": "Политика конфиденциальности", - "admin": "Админ панель", - "error": "Ошибка", - "credits": "Разработчики панели", - "debug": "Отладка", - "leaderboard": "Таблица лидеров", - "profile": "Профиль", - "maintenance": "Техобслуживание" - } - }, - "title": { - "pages": { - "manage": "Настройки серверов", - "settings": "Настройки", - "commands": "Команды", - "pp": "Политика конфиденциальности", - "admin": "Админ панель", - "error": "Ошибка", - "credits": "Разработчики панели", - "debug": "Отладка", - "leaderboard": "Таблица лидеров", - "profile": "Профиль", - "maintenance": "Техобслуживание" - } - }, - "notify": { - "errors": { - "settingsSave": "Произошла ошибка при сохранении настроек." - }, - "success": { - "settingsSave": "Настройки успешно сохранены.", - "login": "Вход успешно выполнен.", - "logout": "Выход успешно выполнен." - } - }, - "preloader": { - "text": "Загрузка..." - }, - "premium": { - "title": "Хотите большего JaBa?", - "description": "Проверьте Премиум функции!", - "buttonText": "Стать Премиум" - }, - "settings": { - "title": "Настройки сайта", - "description": "Настройте параметры панели управления", - "theme": { - "title": "Тема", - "description": "У нас есть тёмная и светлая!" - }, - "language": { - "title": "Язык", - "description": "Выберите предпочитаемый язык!" - } - } - } -} \ No newline at end of file diff --git a/languages/ru-RU/misc.json b/languages/ru-RU/misc.json index 307c3184..693cbda8 100644 --- a/languages/ru-RU/misc.json +++ b/languages/ru-RU/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Укажите целое число больше 0 или `all`", "OWNER_ONLY": "Данную команду может использовать только владелец бота", "SELECT_CANCELED": "Выбор отменён", - "STATS_FOOTER": "● [Панель управления]({{dashboardLink}})\n● [Сервер поддержки]({{supportLink}})\n● [Пригласить JaBa на свой сервер]({{inviteLink}})", + "STATS_FOOTER": "● [Сервер поддержки]({{supportLink}})\n● [Пригласить JaBa на свой сервер]({{inviteLink}})", "TIMED_OUT": "Время вышло", "JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):", "QUOTE_TITLE": "Сообщение от {{user}}", diff --git a/languages/uk-UA/administration/config.json b/languages/uk-UA/administration/config.json index 23667af3..63c4c186 100644 --- a/languages/uk-UA/administration/config.json +++ b/languages/uk-UA/administration/config.json @@ -23,8 +23,6 @@ "AUTO_SANCTIONS": "Автоматичні покарання", "BAN_CONTENT": "Бан: Після **{{count}}** попереджень", "BAN_NOT_DEFINED": "Бан: Не призначено", - "DASHBOARD_TITLE": "Змінити налаштування", - "DASHBOARD_CONTENT": "Натисніть сюди, щоб перейти до панелі керування", "GOODBYE_TITLE": "Прощання", "GOODBYE_CONTENT": "Канал: {{channel}}\nКартка: {{withImage}}", "KICK_CONTENT": "Кік: Після **{{count}}** попереджень", diff --git a/languages/uk-UA/dashboard.json b/languages/uk-UA/dashboard.json deleted file mode 100644 index 6141e871..00000000 --- a/languages/uk-UA/dashboard.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "Українська", - "index": { - "feeds": [ "Поточний Користувач", "Играю музыку в стольких серверах", "Кількість користувачів", "Кількість серверів" ], - "card": { - "category": "JaBa Бот", - "title": "Простий бот, створений Jonny_Bro", - "description": "Верхній Текст", - "image": "", - "footer": "Нижній Текст" - }, - "feedsTitle": "Канали", - "graphTitle": "Графіки" - }, - "manage": { - "settings": { - "memberCount": "Учасники", - "info": { - "info": "Інформація", - "server": "Інформація про Сервер" - } - } - }, - "privacyPolicy": { - "title": "Політика Конфіденційності", - "description": "Політика Конфіденційності та Умови Сервісу", - "pp": "Повна Політика Конфіденційності" - }, - "partials": { - "sidebar": { - "dash": "Панель Керування", - "manage": "Налаштування серверів", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Адмін", - "account": "Сторінки Аккаунта", - "login": "Увійти", - "logout": "Вийти" - }, - "navbar": { - "home": "Головна", - "pages": { - "manage": "Налаштування серверів", - "settings": "Керувати", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Панель Адміністратора", - "error": "Помилка", - "credits": "Автори", - "debug": "Налагодження", - "leaderboard": "Таблиця Лідерів", - "profile": "Профіль", - "maintenance": "Технічне Обслуговування" - } - }, - "title": { - "pages": { - "manage": "Керувати Гілдіями", - "settings": "Керувати", - "commands": "Команди", - "pp": "Політика Конфіденційності", - "admin": "Панель Адміністратора", - "error": "Помилка", - "credits": "Автори", - "debug": "Налагодження", - "leaderboard": "Таблиця Лідерів", - "profile": "Профіль", - "maintenance": "Технічне Обслуговування" - } - }, - "notify": { - "errors": { - "settingsSave": "Сталася помилка при збереженні налаштувань." - }, - "success": { - "settingsSave": "Налаштування успішно збережені.", - "login": "Успішний вхід.", - "logout": "Успішний вихід." - } - }, - "preloader": { - "text": "Завантаження..." - }, - "premium": { - "title": "Бажаєте більше від JaBa?", - "description": "Ознайомтесь з преміум-функціями нижче!", - "buttonText": "Стати Преміум" - }, - "settings": { - "title": "Налаштування Сайту", - "description": "Налаштовувані параметри перегляду", - "theme": { - "title": "Тема", - "description": "Зробіть сайт більш привабливим для своїх очей!" - }, - "language": { - "title": "Мова", - "description": "Виберіть бажану мову!" - } - } - } -} \ No newline at end of file diff --git a/languages/uk-UA/misc.json b/languages/uk-UA/misc.json index d5ffcdc1..383b642b 100644 --- a/languages/uk-UA/misc.json +++ b/languages/uk-UA/misc.json @@ -15,7 +15,7 @@ "OPTION_NAN_ALL": "Вкажіть ціле число більше 0 або `all`", "OWNER_ONLY": "Цю команду може використовувати тільки власник бота", "SELECT_CANCELED": "Вибір скасовано", - "STATS_FOOTER": "● [Панель керування]({{dashboardLink}})\n● [Сервер підтримки]({{supportLink}})\n● [Запросити JaBa на свій сервер]({{inviteLink}})", + "STATS_FOOTER": "● [Сервер підтримки]({{supportLink}})\n● [Запросити JaBa на свій сервер]({{inviteLink}})", "TIMED_OUT": "Час вийшов", "JUMP_TO_PAGE": "Вкажіть сторінку, до якої хочете перейти (максимум **{{length}}**):", "QUOTE_TITLE": "Повідомлення від {{user}}", From 9f82e45a67f2bb9a2ed035a5cfef7df83242577a Mon Sep 17 00:00:00 2001 From: Slincnik Date: Thu, 5 Dec 2024 19:13:43 +0300 Subject: [PATCH 03/37] feat: new client, commands handlers --- base/newClient.js | 57 +++++++++++++++ base/newCommand.js | 18 +++++ config.sample.js | 6 +- index.js | 60 +++++++++++----- newCommands/Fun/8ball.js | 10 +++ package.json | 1 + pnpm-lock.yaml | 147 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 281 insertions(+), 18 deletions(-) create mode 100644 base/newClient.js create mode 100644 base/newCommand.js create mode 100644 newCommands/Fun/8ball.js diff --git a/base/newClient.js b/base/newClient.js new file mode 100644 index 00000000..395c7784 --- /dev/null +++ b/base/newClient.js @@ -0,0 +1,57 @@ +import { Client, Collection, REST, Routes } from "discord.js"; +import { config } from "../config.js"; +import { glob } from "glob"; +import { dirname } from "node:path"; + +export class ExtendedClient extends Client { + commands = new Collection(); + __dirname = dirname(new URL(import.meta.url).pathname); + rest = new REST().setToken(config.token); + /** + * @param {import("discord.js").ClientOptions} options + */ + constructor(options) { + super(options); + } + + init() { + this.registerModules(); + this.login(config.token); + } + + async importFile(filePath) { + return (await import(`file://${filePath}`))?.default; + } + + async registerModules() { + await this.registerCommands(this.__dirname); + } + + async registerCommands(baseDir) { + const commandFiles = await glob(`${baseDir}/../newCommands/*/*.js`); + const slashCommands = []; + + for (const filePath of commandFiles) { + try { + const command = await this.importFile(filePath); + if (!command.data.name) return; + + this.commands.set(command.data.name, command); + slashCommands.push(command.data.toJSON()); + } catch (error) { + console.error(`Error loading command ${filePath}:`, error); + } + } + + if (!slashCommands.length) return; + + try { + const route = config.production ? Routes.applicationCommands(config.userId) : Routes.applicationGuildCommands(config.userId, config.support.id); + const data = await this.rest.put(route, { body: slashCommands }); + + console.log(`Successfully registered ${data.length} application commands.`); + } catch (error) { + console.log(error); + } + } +} diff --git a/base/newCommand.js b/base/newCommand.js new file mode 100644 index 00000000..82dcad43 --- /dev/null +++ b/base/newCommand.js @@ -0,0 +1,18 @@ +export default class Command { + constructor(options) { + /** + * @type {import("discord.js").ApplicationCommandData} + */ + this.data = options.data; + /** + * @type {Boolean} + */ + this.ownerOnly = !!options.ownerOnly || false; + /** + * @param {import("discord.js").CommandInteraction} [interaction] + * @param {import('./newClient.js').ExtendedClient} [client] + * @param {import("discord.js").CommandInteractionOptionResolver} [args] + */ + this.execute = function () {}; + } +} diff --git a/config.sample.js b/config.sample.js index 4a008270..c2508e29 100644 --- a/config.sample.js +++ b/config.sample.js @@ -34,7 +34,11 @@ export default { embed: { color: "#00FF00", // Color footer: { - text: "My Discord Bot | v" + require("./package.json").version, // Footer text + text: + "My Discord Bot | v" + + import("./package.json", { + with: { type: "json" }, + }).version, // Footer text }, }, /* Bot's owner informations */ diff --git a/index.js b/index.js index 49a3c579..cbab0c0a 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,13 @@ -import "./helpers/extenders.js"; +// import "./helpers/extenders.js"; + +// import { GatewayIntentBits } from "discord.js"; +// import JaBaClient from "./base/Client.js"; +// import languages from "./helpers/languages.js"; import { GatewayIntentBits } from "discord.js"; -import JaBaClient from "./base/Client.js"; -import languages from "./helpers/languages.js"; +import { ExtendedClient } from "./base/newClient.js"; -const client = new JaBaClient({ +export const client = new ExtendedClient({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, @@ -25,20 +28,43 @@ const client = new JaBaClient({ allowedMentions: { parse: ["everyone", "roles", "users"] }, }); -(async () => { - console.time("botReady"); +client.init(); - client.translations = await languages(); +// const client = new JaBaClient({ +// intents: [ +// GatewayIntentBits.Guilds, +// GatewayIntentBits.GuildMembers, +// GatewayIntentBits.GuildModeration, +// GatewayIntentBits.GuildEmojisAndStickers, +// GatewayIntentBits.GuildIntegrations, +// GatewayIntentBits.GuildInvites, +// GatewayIntentBits.GuildVoiceStates, +// GatewayIntentBits.GuildPresences, +// GatewayIntentBits.GuildMessages, +// GatewayIntentBits.GuildMessageReactions, +// GatewayIntentBits.GuildMessageTyping, +// GatewayIntentBits.MessageContent, +// GatewayIntentBits.DirectMessageTyping, +// GatewayIntentBits.DirectMessages, +// GatewayIntentBits.DirectMessageReactions, +// ], +// allowedMentions: { parse: ["everyone", "roles", "users"] }, +// }); - await client.loadEvents("../events"); - await client.loadCommands("../commands"); - await client.init(); -})(); +// (async () => { +// console.time("botReady"); -client - .on("disconnect", () => client.logger.warn("Bot disconnected.")) - .on("reconnecting", () => client.logger.warn("Bot reconnecting...")) - .on("warn", console.log) - .on("error", console.log); +// client.translations = await languages(); -process.on("unhandledRejection", e => console.log(e)).on("uncaughtException", e => console.log(e)); +// await client.loadEvents("../events"); +// await client.loadCommands("../commands"); +// await client.init(); +// })(); + +// client +// .on("disconnect", () => client.logger.warn("Bot disconnected.")) +// .on("reconnecting", () => client.logger.warn("Bot reconnecting...")) +// .on("warn", console.log) +// .on("error", console.log); + +// process.on("unhandledRejection", e => console.log(e)).on("uncaughtException", e => console.log(e)); diff --git a/newCommands/Fun/8ball.js b/newCommands/Fun/8ball.js new file mode 100644 index 00000000..226246bf --- /dev/null +++ b/newCommands/Fun/8ball.js @@ -0,0 +1,10 @@ +import { SlashCommandBuilder } from "discord.js"; +import Command from "../../base/newCommand.js"; + +export default new Command({ + data: new SlashCommandBuilder().setName("8ball").setDescription("8ball"), + execute(interaction) { + console.log("8ball"); + interaction.reply("8ball"); + }, +}); diff --git a/package.json b/package.json index f69dbec3..4fcc3794 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "discord-player-youtubei": "1.3.5", "discord.js": "^14.16.3", "gamedig": "^5.1.4", + "glob": "^11.0.0", "i18next": "^24.0.0", "i18next-fs-backend": "^2.6.0", "md5": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6b4d075..2c08938c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ importers: gamedig: specifier: ^5.1.4 version: 5.1.4 + glob: + specifier: ^11.0.0 + version: 11.0.0 i18next: specifier: ^24.0.0 version: 24.0.0(typescript@5.7.2) @@ -227,6 +230,10 @@ packages: resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} engines: {node: '>=18.18'} + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + '@jest/schemas@29.6.3': resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -441,6 +448,10 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + ansi-regex@6.1.0: + resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} + engines: {node: '>=12'} + ansi-styles@2.2.1: resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} engines: {node: '>=0.10.0'} @@ -453,6 +464,10 @@ packages: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} + ansi-styles@6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -667,9 +682,15 @@ packages: domutils@3.1.0: resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -793,6 +814,10 @@ packages: flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} + foreground-child@3.3.0: + resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} + engines: {node: '>=14'} + form-data-encoder@2.1.4: resolution: {integrity: sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==} engines: {node: '>= 14.17'} @@ -837,6 +862,11 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} + glob@11.0.0: + resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} + engines: {node: 20 || >=22} + hasBin: true + glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -976,6 +1006,10 @@ packages: isomorphic-unfetch@4.0.2: resolution: {integrity: sha512-1Yd+CF/7al18/N2BDbsLBcp6RO3tucSW+jcLq24dqdX5MNbCNTw1z4BsGsp4zNmjr/Izm2cs/cEqZPp4kvWSCA==} + jackspeak@4.0.2: + resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} + engines: {node: 20 || >=22} + jintr@3.0.2: resolution: {integrity: sha512-5g2EBudeJFOopjAX4exAv5OCCW1DgUISfoioCsm1h9Q9HJ41LmnZ6J52PCsqBlQihsmp0VDuxreAVzM7yk5nFA==} @@ -1039,6 +1073,10 @@ packages: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + lru-cache@11.0.2: + resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} + engines: {node: 20 || >=22} + luxon@3.5.0: resolution: {integrity: sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==} engines: {node: '>=12'} @@ -1072,6 +1110,10 @@ packages: resolution: {integrity: sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + minimatch@10.0.1: + resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} + engines: {node: 20 || >=22} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -1090,6 +1132,10 @@ packages: resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} engines: {node: '>=8'} + minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -1212,6 +1258,9 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -1234,6 +1283,10 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} + path-scurry@2.0.0: + resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} + engines: {node: 20 || >=22} + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -1399,6 +1452,10 @@ packages: signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -1435,6 +1492,10 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + string_decoder@0.10.31: resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} @@ -1452,6 +1513,10 @@ packages: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} + strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -1581,6 +1646,14 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -1820,6 +1893,15 @@ snapshots: '@humanwhocodes/retry@0.4.1': {} + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + '@jest/schemas@29.6.3': dependencies: '@sinclair/typebox': 0.27.8 @@ -2003,6 +2085,8 @@ snapshots: ansi-regex@5.0.1: {} + ansi-regex@6.1.0: {} + ansi-styles@2.2.1: {} ansi-styles@4.3.0: @@ -2011,6 +2095,8 @@ snapshots: ansi-styles@5.2.0: {} + ansi-styles@6.2.1: {} + any-promise@1.3.0: {} aproba@2.0.0: {} @@ -2258,8 +2344,12 @@ snapshots: domelementtype: 2.3.0 domhandler: 5.0.3 + eastasianwidth@0.2.0: {} + emoji-regex@8.0.0: {} + emoji-regex@9.2.2: {} + entities@4.5.0: {} escape-string-regexp@1.0.5: {} @@ -2447,6 +2537,11 @@ snapshots: flatted@3.3.1: {} + foreground-child@3.3.0: + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + form-data-encoder@2.1.4: {} formdata-polyfill@4.0.10: @@ -2505,6 +2600,15 @@ snapshots: dependencies: is-glob: 4.0.3 + glob@11.0.0: + dependencies: + foreground-child: 3.3.0 + jackspeak: 4.0.2 + minimatch: 10.0.1 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 2.0.0 + glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -2643,6 +2747,10 @@ snapshots: node-fetch: 3.3.2 unfetch: 5.0.0 + jackspeak@4.0.2: + dependencies: + '@isaacs/cliui': 8.0.2 + jintr@3.0.2: dependencies: acorn: 8.12.1 @@ -2698,6 +2806,8 @@ snapshots: lowercase-keys@3.0.0: {} + lru-cache@11.0.2: {} + luxon@3.5.0: {} magic-bytes.js@1.10.0: {} @@ -2725,6 +2835,10 @@ snapshots: mimic-response@4.0.0: {} + minimatch@10.0.1: + dependencies: + brace-expansion: 2.0.1 + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -2741,6 +2855,8 @@ snapshots: minipass@5.0.0: {} + minipass@7.1.2: {} + minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -2855,6 +2971,8 @@ snapshots: dependencies: p-limit: 3.1.0 + package-json-from-dist@1.0.1: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -2874,6 +2992,11 @@ snapshots: path-key@3.1.1: {} + path-scurry@2.0.0: + dependencies: + lru-cache: 11.0.2 + minipass: 7.1.2 + path-type@4.0.0: {} peek-readable@4.1.0: {} @@ -3012,6 +3135,8 @@ snapshots: signal-exit@3.0.7: {} + signal-exit@4.1.0: {} + slash@3.0.0: {} smart-buffer@4.2.0: @@ -3052,6 +3177,12 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + string_decoder@0.10.31: {} string_decoder@1.1.1: @@ -3070,6 +3201,10 @@ snapshots: dependencies: ansi-regex: 5.0.1 + strip-ansi@7.1.0: + dependencies: + ansi-regex: 6.1.0 + strip-json-comments@3.1.1: {} strtok3@6.3.0: @@ -3186,6 +3321,18 @@ snapshots: word-wrap@1.2.5: {} + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + wrappy@1.0.2: {} ws@8.18.0: {} From c77d66ea4084eceb058b148f16de984e883a7ba3 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Fri, 6 Dec 2024 19:22:38 +0300 Subject: [PATCH 04/37] feat: added event handler --- base/newClient.js | 16 +++++++++++++++- base/newEvent.js | 10 ++++++++++ newEvents/ready.js | 11 +++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 base/newEvent.js create mode 100644 newEvents/ready.js diff --git a/base/newClient.js b/base/newClient.js index 395c7784..28a2cb30 100644 --- a/base/newClient.js +++ b/base/newClient.js @@ -24,7 +24,7 @@ export class ExtendedClient extends Client { } async registerModules() { - await this.registerCommands(this.__dirname); + await Promise.all([this.registerCommands(this.__dirname), this.registerEvents(this.__dirname)]); } async registerCommands(baseDir) { @@ -54,4 +54,18 @@ export class ExtendedClient extends Client { console.log(error); } } + + async registerEvents(baseDir) { + const eventFiles = await glob(`${baseDir}/../newEvents/**/*.js`); + + for (const file of eventFiles) { + const event = await this.importFile(file); + + if (event.data.once) { + this.once(event.data.name, event.run); + } else { + this.on(event.data.name, event.run); + } + } + } } diff --git a/base/newEvent.js b/base/newEvent.js new file mode 100644 index 00000000..4675a7fc --- /dev/null +++ b/base/newEvent.js @@ -0,0 +1,10 @@ +export default class BaseEvent { + /** + * @param {{ name: import("discord.js").ClientEvents, once: boolean}} options + * @param {Function} run + */ + constructor(data, run) { + this.data = data; + this.run = run; + } +} diff --git a/newEvents/ready.js b/newEvents/ready.js new file mode 100644 index 00000000..433cbcb3 --- /dev/null +++ b/newEvents/ready.js @@ -0,0 +1,11 @@ +import Event from "../base/newEvent.js"; + +export default new Event( + { + name: "ready", + once: true, + }, + client => { + console.log(client.user.tag + " is online!"); + }, +); From cbf08791120eddf9befbfc4978c3a79525fe2f0c Mon Sep 17 00:00:00 2001 From: Slincnik Date: Fri, 6 Dec 2024 23:58:15 +0300 Subject: [PATCH 05/37] refactor: editing command & events handler --- base/newClient.js | 64 +------- base/newCommand.js | 18 --- base/newEvent.js | 10 -- .../functions/registerCommands.js | 19 +++ handlers/command-handler/index.js | 35 +++++ handlers/event-handler/index.js | 41 +++++ newCommands/Fun/8ball.js | 16 +- newEvents/ready.js | 17 +- package.json | 1 - pnpm-lock.yaml | 147 ------------------ utils/get-path.js | 24 +++ utils/resolve-file.js | 11 ++ 12 files changed, 149 insertions(+), 254 deletions(-) delete mode 100644 base/newCommand.js delete mode 100644 base/newEvent.js create mode 100644 handlers/command-handler/functions/registerCommands.js create mode 100644 handlers/command-handler/index.js create mode 100644 handlers/event-handler/index.js create mode 100644 utils/get-path.js create mode 100644 utils/resolve-file.js diff --git a/base/newClient.js b/base/newClient.js index 28a2cb30..b1b4e2f1 100644 --- a/base/newClient.js +++ b/base/newClient.js @@ -1,12 +1,9 @@ -import { Client, Collection, REST, Routes } from "discord.js"; +import { Client } from "discord.js"; import { config } from "../config.js"; -import { glob } from "glob"; -import { dirname } from "node:path"; +import { init as initCommands } from "../handlers/command-handler/index.js"; +import { init as initEvents } from "../handlers/event-handler/index.js"; export class ExtendedClient extends Client { - commands = new Collection(); - __dirname = dirname(new URL(import.meta.url).pathname); - rest = new REST().setToken(config.token); /** * @param {import("discord.js").ClientOptions} options */ @@ -14,58 +11,7 @@ export class ExtendedClient extends Client { super(options); } - init() { - this.registerModules(); - this.login(config.token); - } - - async importFile(filePath) { - return (await import(`file://${filePath}`))?.default; - } - - async registerModules() { - await Promise.all([this.registerCommands(this.__dirname), this.registerEvents(this.__dirname)]); - } - - async registerCommands(baseDir) { - const commandFiles = await glob(`${baseDir}/../newCommands/*/*.js`); - const slashCommands = []; - - for (const filePath of commandFiles) { - try { - const command = await this.importFile(filePath); - if (!command.data.name) return; - - this.commands.set(command.data.name, command); - slashCommands.push(command.data.toJSON()); - } catch (error) { - console.error(`Error loading command ${filePath}:`, error); - } - } - - if (!slashCommands.length) return; - - try { - const route = config.production ? Routes.applicationCommands(config.userId) : Routes.applicationGuildCommands(config.userId, config.support.id); - const data = await this.rest.put(route, { body: slashCommands }); - - console.log(`Successfully registered ${data.length} application commands.`); - } catch (error) { - console.log(error); - } - } - - async registerEvents(baseDir) { - const eventFiles = await glob(`${baseDir}/../newEvents/**/*.js`); - - for (const file of eventFiles) { - const event = await this.importFile(file); - - if (event.data.once) { - this.once(event.data.name, event.run); - } else { - this.on(event.data.name, event.run); - } - } + async init() { + this.login(config.token).then(async () => await Promise.all([initCommands(), initEvents()]).catch(console.error)); } } diff --git a/base/newCommand.js b/base/newCommand.js deleted file mode 100644 index 82dcad43..00000000 --- a/base/newCommand.js +++ /dev/null @@ -1,18 +0,0 @@ -export default class Command { - constructor(options) { - /** - * @type {import("discord.js").ApplicationCommandData} - */ - this.data = options.data; - /** - * @type {Boolean} - */ - this.ownerOnly = !!options.ownerOnly || false; - /** - * @param {import("discord.js").CommandInteraction} [interaction] - * @param {import('./newClient.js').ExtendedClient} [client] - * @param {import("discord.js").CommandInteractionOptionResolver} [args] - */ - this.execute = function () {}; - } -} diff --git a/base/newEvent.js b/base/newEvent.js deleted file mode 100644 index 4675a7fc..00000000 --- a/base/newEvent.js +++ /dev/null @@ -1,10 +0,0 @@ -export default class BaseEvent { - /** - * @param {{ name: import("discord.js").ClientEvents, once: boolean}} options - * @param {Function} run - */ - constructor(data, run) { - this.data = data; - this.run = run; - } -} diff --git a/handlers/command-handler/functions/registerCommands.js b/handlers/command-handler/functions/registerCommands.js new file mode 100644 index 00000000..2f4e5740 --- /dev/null +++ b/handlers/command-handler/functions/registerCommands.js @@ -0,0 +1,19 @@ +export default async function registerCommands(props) { + const globalCommands = props.commands.filter(cmd => !cmd.options?.devOnly); + await registerGlobalCommands(props.client, globalCommands); +} + +const registerGlobalCommands = async (client, commands) => { + const appCommandsManager = client.application.commands; + await appCommandsManager.fetch(); + + const newCommands = commands.filter(cmd => !appCommandsManager.cache.some(existingCmd => existingCmd.name === cmd.data.name)); + + await Promise.all( + newCommands.map(data => + appCommandsManager.create(data).catch(() => { + throw new Error(`Failed to register command: ${data.name}`); + }), + ), + ); +}; diff --git a/handlers/command-handler/index.js b/handlers/command-handler/index.js new file mode 100644 index 00000000..50538603 --- /dev/null +++ b/handlers/command-handler/index.js @@ -0,0 +1,35 @@ +import { client } from "../../index.js"; +import { getFilePaths } from "../../utils/get-path.js"; +import { toFileURL } from "../../utils/resolve-file.js"; +import registerCommands from "./functions/registerCommands.js"; + +export const commands = []; + +export const init = async () => { + await buildCommands(); + + await registerCommands({ + client, + commands, + }); +}; + +const buildCommands = async () => { + const commandFilePaths = (await getFilePaths("./newCommands", true)).filter(path => path.endsWith(".js")); + + for (const cmdFilePath of commandFilePaths) { + const { data, run } = await import(toFileURL(cmdFilePath)); + + if (!data || !data.name) { + console.warn(`Command ${cmdFilePath} does not have a data object or name`); + continue; + } + + if (typeof run !== "function") { + console.warn(`Command ${cmdFilePath} does not have a run function or it is not a function`); + continue; + } + + commands.push({ data, run }); + } +}; diff --git a/handlers/event-handler/index.js b/handlers/event-handler/index.js new file mode 100644 index 00000000..cd52e970 --- /dev/null +++ b/handlers/event-handler/index.js @@ -0,0 +1,41 @@ +import { client } from "../../index.js"; +import { getFilePaths } from "../../utils/get-path.js"; +import { toFileURL } from "../../utils/resolve-file.js"; + +export const events = []; + +export const init = async () => { + await buildEvents(); + + registerEvents(); +}; + +const buildEvents = async () => { + const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); + + for (const eventFilePath of eventFilePaths) { + const { data, run } = await import(toFileURL(eventFilePath)); + + if (!data || !data.name) { + console.warn(`Event ${eventFilePath} does not have a data object or name`); + continue; + } + + if (typeof run !== "function") { + console.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); + continue; + } + + events.push({ data, run }); + } +}; + +const registerEvents = () => { + for (const { data, run } of events) { + if (data.once) { + client.once(data.name, run); + } else { + client.on(data.name, run); + } + } +}; diff --git a/newCommands/Fun/8ball.js b/newCommands/Fun/8ball.js index 226246bf..7600c06c 100644 --- a/newCommands/Fun/8ball.js +++ b/newCommands/Fun/8ball.js @@ -1,10 +1,8 @@ -import { SlashCommandBuilder } from "discord.js"; -import Command from "../../base/newCommand.js"; +export const data = { + name: "8ball", + description: "8ball", +}; -export default new Command({ - data: new SlashCommandBuilder().setName("8ball").setDescription("8ball"), - execute(interaction) { - console.log("8ball"); - interaction.reply("8ball"); - }, -}); +export const run = () => { + console.log("8ball"); +}; diff --git a/newEvents/ready.js b/newEvents/ready.js index 433cbcb3..dfa2a88b 100644 --- a/newEvents/ready.js +++ b/newEvents/ready.js @@ -1,11 +1,8 @@ -import Event from "../base/newEvent.js"; +export const data = { + name: "ready", + once: true, +}; -export default new Event( - { - name: "ready", - once: true, - }, - client => { - console.log(client.user.tag + " is online!"); - }, -); +export async function run(client) { + console.log(client.user.tag + " is online!"); +} diff --git a/package.json b/package.json index 4fcc3794..f69dbec3 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "discord-player-youtubei": "1.3.5", "discord.js": "^14.16.3", "gamedig": "^5.1.4", - "glob": "^11.0.0", "i18next": "^24.0.0", "i18next-fs-backend": "^2.6.0", "md5": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2c08938c..c6b4d075 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,9 +47,6 @@ importers: gamedig: specifier: ^5.1.4 version: 5.1.4 - glob: - specifier: ^11.0.0 - version: 11.0.0 i18next: specifier: ^24.0.0 version: 24.0.0(typescript@5.7.2) @@ -230,10 +227,6 @@ packages: resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} engines: {node: '>=18.18'} - '@isaacs/cliui@8.0.2': - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - '@jest/schemas@29.6.3': resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -448,10 +441,6 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} - ansi-regex@6.1.0: - resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} - engines: {node: '>=12'} - ansi-styles@2.2.1: resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} engines: {node: '>=0.10.0'} @@ -464,10 +453,6 @@ packages: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} - ansi-styles@6.2.1: - resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} - engines: {node: '>=12'} - any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -682,15 +667,9 @@ packages: domutils@3.1.0: resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} - eastasianwidth@0.2.0: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - emoji-regex@9.2.2: - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - entities@4.5.0: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} @@ -814,10 +793,6 @@ packages: flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} - foreground-child@3.3.0: - resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} - engines: {node: '>=14'} - form-data-encoder@2.1.4: resolution: {integrity: sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==} engines: {node: '>= 14.17'} @@ -862,11 +837,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@11.0.0: - resolution: {integrity: sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==} - engines: {node: 20 || >=22} - hasBin: true - glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -1006,10 +976,6 @@ packages: isomorphic-unfetch@4.0.2: resolution: {integrity: sha512-1Yd+CF/7al18/N2BDbsLBcp6RO3tucSW+jcLq24dqdX5MNbCNTw1z4BsGsp4zNmjr/Izm2cs/cEqZPp4kvWSCA==} - jackspeak@4.0.2: - resolution: {integrity: sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==} - engines: {node: 20 || >=22} - jintr@3.0.2: resolution: {integrity: sha512-5g2EBudeJFOopjAX4exAv5OCCW1DgUISfoioCsm1h9Q9HJ41LmnZ6J52PCsqBlQihsmp0VDuxreAVzM7yk5nFA==} @@ -1073,10 +1039,6 @@ packages: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - lru-cache@11.0.2: - resolution: {integrity: sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==} - engines: {node: 20 || >=22} - luxon@3.5.0: resolution: {integrity: sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==} engines: {node: '>=12'} @@ -1110,10 +1072,6 @@ packages: resolution: {integrity: sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - minimatch@10.0.1: - resolution: {integrity: sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==} - engines: {node: 20 || >=22} - minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -1132,10 +1090,6 @@ packages: resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} engines: {node: '>=8'} - minipass@7.1.2: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -1258,9 +1212,6 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - package-json-from-dist@1.0.1: - resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} - parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -1283,10 +1234,6 @@ packages: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - path-scurry@2.0.0: - resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==} - engines: {node: 20 || >=22} - path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -1452,10 +1399,6 @@ packages: signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - signal-exit@4.1.0: - resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} - engines: {node: '>=14'} - slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -1492,10 +1435,6 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} - string-width@5.1.2: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} - string_decoder@0.10.31: resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} @@ -1513,10 +1452,6 @@ packages: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} - strip-ansi@7.1.0: - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} - engines: {node: '>=12'} - strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -1646,14 +1581,6 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - wrap-ansi@8.1.0: - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} - engines: {node: '>=12'} - wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -1893,15 +1820,6 @@ snapshots: '@humanwhocodes/retry@0.4.1': {} - '@isaacs/cliui@8.0.2': - dependencies: - string-width: 5.1.2 - string-width-cjs: string-width@4.2.3 - strip-ansi: 7.1.0 - strip-ansi-cjs: strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: wrap-ansi@7.0.0 - '@jest/schemas@29.6.3': dependencies: '@sinclair/typebox': 0.27.8 @@ -2085,8 +2003,6 @@ snapshots: ansi-regex@5.0.1: {} - ansi-regex@6.1.0: {} - ansi-styles@2.2.1: {} ansi-styles@4.3.0: @@ -2095,8 +2011,6 @@ snapshots: ansi-styles@5.2.0: {} - ansi-styles@6.2.1: {} - any-promise@1.3.0: {} aproba@2.0.0: {} @@ -2344,12 +2258,8 @@ snapshots: domelementtype: 2.3.0 domhandler: 5.0.3 - eastasianwidth@0.2.0: {} - emoji-regex@8.0.0: {} - emoji-regex@9.2.2: {} - entities@4.5.0: {} escape-string-regexp@1.0.5: {} @@ -2537,11 +2447,6 @@ snapshots: flatted@3.3.1: {} - foreground-child@3.3.0: - dependencies: - cross-spawn: 7.0.6 - signal-exit: 4.1.0 - form-data-encoder@2.1.4: {} formdata-polyfill@4.0.10: @@ -2600,15 +2505,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@11.0.0: - dependencies: - foreground-child: 3.3.0 - jackspeak: 4.0.2 - minimatch: 10.0.1 - minipass: 7.1.2 - package-json-from-dist: 1.0.1 - path-scurry: 2.0.0 - glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -2747,10 +2643,6 @@ snapshots: node-fetch: 3.3.2 unfetch: 5.0.0 - jackspeak@4.0.2: - dependencies: - '@isaacs/cliui': 8.0.2 - jintr@3.0.2: dependencies: acorn: 8.12.1 @@ -2806,8 +2698,6 @@ snapshots: lowercase-keys@3.0.0: {} - lru-cache@11.0.2: {} - luxon@3.5.0: {} magic-bytes.js@1.10.0: {} @@ -2835,10 +2725,6 @@ snapshots: mimic-response@4.0.0: {} - minimatch@10.0.1: - dependencies: - brace-expansion: 2.0.1 - minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -2855,8 +2741,6 @@ snapshots: minipass@5.0.0: {} - minipass@7.1.2: {} - minizlib@2.1.2: dependencies: minipass: 3.3.6 @@ -2971,8 +2855,6 @@ snapshots: dependencies: p-limit: 3.1.0 - package-json-from-dist@1.0.1: {} - parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -2992,11 +2874,6 @@ snapshots: path-key@3.1.1: {} - path-scurry@2.0.0: - dependencies: - lru-cache: 11.0.2 - minipass: 7.1.2 - path-type@4.0.0: {} peek-readable@4.1.0: {} @@ -3135,8 +3012,6 @@ snapshots: signal-exit@3.0.7: {} - signal-exit@4.1.0: {} - slash@3.0.0: {} smart-buffer@4.2.0: @@ -3177,12 +3052,6 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - string-width@5.1.2: - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.0 - string_decoder@0.10.31: {} string_decoder@1.1.1: @@ -3201,10 +3070,6 @@ snapshots: dependencies: ansi-regex: 5.0.1 - strip-ansi@7.1.0: - dependencies: - ansi-regex: 6.1.0 - strip-json-comments@3.1.1: {} strtok3@6.3.0: @@ -3321,18 +3186,6 @@ snapshots: word-wrap@1.2.5: {} - wrap-ansi@7.0.0: - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - - wrap-ansi@8.1.0: - dependencies: - ansi-styles: 6.2.1 - string-width: 5.1.2 - strip-ansi: 7.1.0 - wrappy@1.0.2: {} ws@8.18.0: {} diff --git a/utils/get-path.js b/utils/get-path.js new file mode 100644 index 00000000..800ce749 --- /dev/null +++ b/utils/get-path.js @@ -0,0 +1,24 @@ +import fs from "node:fs/promises"; +import path from "node:path"; + +export const getFilePaths = async (directory, nesting) => { + let filePaths = []; + + if (!directory) return; + + const files = await fs.readdir(directory, { withFileTypes: true }); + + for (const file of files) { + const filePath = path.join(directory, file.name); + + if (file.isFile()) { + filePaths.push(filePath); + } + + if (nesting && file.isDirectory()) { + filePaths = [...filePaths, ...(await getFilePaths(filePath, true))]; + } + } + + return filePaths; +}; diff --git a/utils/resolve-file.js b/utils/resolve-file.js new file mode 100644 index 00000000..58264449 --- /dev/null +++ b/utils/resolve-file.js @@ -0,0 +1,11 @@ +import path from "node:path"; + +/** + * Convert a local file path to a file URL. + * @param {string} filePath - local file's path. + * @returns {string} file URL + */ +export const toFileURL = filePath => { + const resolvedPath = path.resolve(filePath); + return "file://" + resolvedPath.replace(/\\\\|\\/g, "/"); +}; From ba5bf0208657f65ac4b268fdad7a0806f283a7c7 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sat, 7 Dec 2024 14:47:05 +0500 Subject: [PATCH 06/37] remove unused folder and function --- clips/.gitkeep | 0 handlers/event-handler/index.js | 7 ++----- helpers/functions.js | 18 ------------------ newEvents/ready.js | 4 ++++ 4 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 clips/.gitkeep diff --git a/clips/.gitkeep b/clips/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/handlers/event-handler/index.js b/handlers/event-handler/index.js index cd52e970..a1406c23 100644 --- a/handlers/event-handler/index.js +++ b/handlers/event-handler/index.js @@ -32,10 +32,7 @@ const buildEvents = async () => { const registerEvents = () => { for (const { data, run } of events) { - if (data.once) { - client.once(data.name, run); - } else { - client.on(data.name, run); - } + if (data.once) client.once(data.name, run); + else client.on(data.name, run); } }; diff --git a/helpers/functions.js b/helpers/functions.js index 9cd8623b..38cbb15b 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -117,21 +117,3 @@ export function getNoun(number, one, two, five) { 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 '. - */ -export function 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/newEvents/ready.js b/newEvents/ready.js index dfa2a88b..d796ebd6 100644 --- a/newEvents/ready.js +++ b/newEvents/ready.js @@ -3,6 +3,10 @@ export const data = { once: true, }; +/** + * + * @param {import("../base/Client.JaBaClient")} client + */ export async function run(client) { console.log(client.user.tag + " is online!"); } From 3d91b7fa9b4f0d49b9e30b7f7efabe15d25e40d6 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 7 Dec 2024 14:52:22 +0300 Subject: [PATCH 07/37] feat(command): added checking if command editing --- .../functions/registerCommands.js | 20 ++++++++++++------- .../utils/differentcommands.js | 8 ++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 handlers/command-handler/utils/differentcommands.js diff --git a/handlers/command-handler/functions/registerCommands.js b/handlers/command-handler/functions/registerCommands.js index 2f4e5740..18b32119 100644 --- a/handlers/command-handler/functions/registerCommands.js +++ b/handlers/command-handler/functions/registerCommands.js @@ -1,3 +1,5 @@ +import differentCommands from "../utils/differentcommands.js"; + export default async function registerCommands(props) { const globalCommands = props.commands.filter(cmd => !cmd.options?.devOnly); await registerGlobalCommands(props.client, globalCommands); @@ -7,13 +9,17 @@ const registerGlobalCommands = async (client, commands) => { const appCommandsManager = client.application.commands; await appCommandsManager.fetch(); - const newCommands = commands.filter(cmd => !appCommandsManager.cache.some(existingCmd => existingCmd.name === cmd.data.name)); - await Promise.all( - newCommands.map(data => - appCommandsManager.create(data).catch(() => { - throw new Error(`Failed to register command: ${data.name}`); - }), - ), + commands.map(async ({ data }) => { + const targetCommand = appCommandsManager.cache.find(cmd => cmd.name === data.name); + + if (targetCommand && differentCommands(targetCommand, data)) { + await targetCommand.edit(data).catch(() => console.log(`Failed to update command: ${data.name} globally`)); + + console.log(`Edited command globally: ${data.name}`); + } else if (!targetCommand) { + await appCommandsManager.create(data).catch(() => console.log(`Failed to register command: ${data.name}`)); + } + }), ); }; diff --git a/handlers/command-handler/utils/differentcommands.js b/handlers/command-handler/utils/differentcommands.js new file mode 100644 index 00000000..bf32572c --- /dev/null +++ b/handlers/command-handler/utils/differentcommands.js @@ -0,0 +1,8 @@ +export default function differentCommands(appCommand, localCommand) { + const appOptions = appCommand.options || []; + const localOptions = localCommand.options || []; + const appDescription = appCommand.description || ""; + const localDescription = localCommand.description || ""; + + return localDescription !== appDescription || localOptions.length !== appOptions.length; +} From dc7bef73ee2a70b08a0ae71126427ccef80b0f2f Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 7 Dec 2024 14:53:11 +0300 Subject: [PATCH 08/37] fix(event): fixed not loading events --- base/newClient.js | 4 +++- handlers/event-handler/index.js | 30 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/base/newClient.js b/base/newClient.js index b1b4e2f1..ae3e9497 100644 --- a/base/newClient.js +++ b/base/newClient.js @@ -12,6 +12,8 @@ export class ExtendedClient extends Client { } async init() { - this.login(config.token).then(async () => await Promise.all([initCommands(), initEvents()]).catch(console.error)); + return this.login(config.token) + .then(async () => await Promise.all([initCommands(), initEvents()])) + .catch(console.error); } } diff --git a/handlers/event-handler/index.js b/handlers/event-handler/index.js index a1406c23..4179703d 100644 --- a/handlers/event-handler/index.js +++ b/handlers/event-handler/index.js @@ -11,22 +11,26 @@ export const init = async () => { }; const buildEvents = async () => { - const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); + try { + const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); - for (const eventFilePath of eventFilePaths) { - const { data, run } = await import(toFileURL(eventFilePath)); + for (const eventFilePath of eventFilePaths) { + const { data, run } = await import(toFileURL(eventFilePath)); - if (!data || !data.name) { - console.warn(`Event ${eventFilePath} does not have a data object or name`); - continue; + if (!data || !data.name) { + console.warn(`Event ${eventFilePath} does not have a data object or name`); + continue; + } + + if (typeof run !== "function") { + console.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); + continue; + } + + events.push({ data, run }); } - - if (typeof run !== "function") { - console.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); - continue; - } - - events.push({ data, run }); + } catch (error) { + console.error("Error build events: ", error); } }; From cfee30528d69335b57b3a572cc98c189c6a327e5 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sun, 8 Dec 2024 18:00:26 +0300 Subject: [PATCH 09/37] refactor: logger --- helpers/logger.js | 53 +++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/helpers/logger.js b/helpers/logger.js index 4c912908..b987c48a 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -1,52 +1,47 @@ -import { bgBlue, black, green } from "chalk"; - -function dateTimePad(value, digits) { - let number = value; - while (number.toString().length < digits) number = "0" + number; - - return number; -} +import chalk from "chalk"; function format(tDate) { - return ( - dateTimePad(tDate.getDate(), 2) + - "-" + - dateTimePad(tDate.getMonth() + 1, 2) + - "-" + - dateTimePad(tDate.getFullYear(), 2) + - " " + - dateTimePad(tDate.getHours(), 2) + - ":" + - dateTimePad(tDate.getMinutes(), 2) + - ":" + - dateTimePad(tDate.getSeconds(), 2) + - "." + - dateTimePad(tDate.getMilliseconds(), 3) - ); + return new Intl.DateTimeFormat("ru-RU", { + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + }).format(tDate); } +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(new Date(Date.now()))}]: ${bgBlue("LOG")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.LOG} ${content}`); }, warn(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgYellow("WARN")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content}`); }, error(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgRed("ERROR")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content}`); }, debug(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${green("DEBUG")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content}`); }, cmd(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgWhite("CMD")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content}`); }, ready(content) { - return console.log(`[${format(new Date(Date.now()))}]: ${black.bgGreen("READY")} ${content}`); + return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content}`); }, }; From 024822d1f3c7a6e6fbf9378deb3cd4aaf45a7166 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sun, 8 Dec 2024 18:09:44 +0300 Subject: [PATCH 10/37] fix: doesnt commands registered, when client doesnt ready --- handlers/command-handler/functions/registerCommands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/command-handler/functions/registerCommands.js b/handlers/command-handler/functions/registerCommands.js index 18b32119..e0e50d2e 100644 --- a/handlers/command-handler/functions/registerCommands.js +++ b/handlers/command-handler/functions/registerCommands.js @@ -2,7 +2,7 @@ import differentCommands from "../utils/differentcommands.js"; export default async function registerCommands(props) { const globalCommands = props.commands.filter(cmd => !cmd.options?.devOnly); - await registerGlobalCommands(props.client, globalCommands); + props.client.once("ready", () => registerGlobalCommands(props.client, globalCommands)); } const registerGlobalCommands = async (client, commands) => { From be5722bb0116d74058babc261b6d07ff02881275 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sun, 8 Dec 2024 18:11:30 +0300 Subject: [PATCH 11/37] refactor: change default console to logger --- handlers/command-handler/functions/registerCommands.js | 9 ++++++--- handlers/command-handler/index.js | 5 +++-- handlers/event-handler/index.js | 10 +++++----- newEvents/ready.js | 4 +++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/handlers/command-handler/functions/registerCommands.js b/handlers/command-handler/functions/registerCommands.js index e0e50d2e..c7fe5ef9 100644 --- a/handlers/command-handler/functions/registerCommands.js +++ b/handlers/command-handler/functions/registerCommands.js @@ -1,3 +1,4 @@ +import logger from "../../../helpers/logger.js"; import differentCommands from "../utils/differentcommands.js"; export default async function registerCommands(props) { @@ -14,12 +15,14 @@ const registerGlobalCommands = async (client, commands) => { const targetCommand = appCommandsManager.cache.find(cmd => cmd.name === data.name); if (targetCommand && differentCommands(targetCommand, data)) { - await targetCommand.edit(data).catch(() => console.log(`Failed to update command: ${data.name} globally`)); + await targetCommand.edit(data).catch(() => logger.error(`Failed to update command: ${data.name} globally`)); - console.log(`Edited command globally: ${data.name}`); + logger.log(`Edited command globally: ${data.name}`); } else if (!targetCommand) { - await appCommandsManager.create(data).catch(() => console.log(`Failed to register command: ${data.name}`)); + await appCommandsManager.create(data).catch(() => logger.error(`Failed to register command: ${data.name}`)); } }), ); + + logger.log("Registered global commands"); }; diff --git a/handlers/command-handler/index.js b/handlers/command-handler/index.js index 50538603..96ffe039 100644 --- a/handlers/command-handler/index.js +++ b/handlers/command-handler/index.js @@ -1,3 +1,4 @@ +import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/get-path.js"; import { toFileURL } from "../../utils/resolve-file.js"; @@ -21,12 +22,12 @@ const buildCommands = async () => { const { data, run } = await import(toFileURL(cmdFilePath)); if (!data || !data.name) { - console.warn(`Command ${cmdFilePath} does not have a data object or name`); + logger.warn(`Command ${cmdFilePath} does not have a data object or name`); continue; } if (typeof run !== "function") { - console.warn(`Command ${cmdFilePath} does not have a run function or it is not a function`); + logger.warn(`Command ${cmdFilePath} does not have a run function or it is not a function`); continue; } diff --git a/handlers/event-handler/index.js b/handlers/event-handler/index.js index 4179703d..6200e0a6 100644 --- a/handlers/event-handler/index.js +++ b/handlers/event-handler/index.js @@ -1,3 +1,4 @@ +import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/get-path.js"; import { toFileURL } from "../../utils/resolve-file.js"; @@ -6,7 +7,6 @@ export const events = []; export const init = async () => { await buildEvents(); - registerEvents(); }; @@ -18,23 +18,23 @@ const buildEvents = async () => { const { data, run } = await import(toFileURL(eventFilePath)); if (!data || !data.name) { - console.warn(`Event ${eventFilePath} does not have a data object or name`); + logger.warn(`Event ${eventFilePath} does not have a data object or name`); continue; } if (typeof run !== "function") { - console.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); + logger.warn(`Event ${eventFilePath} does not have a run function or it is not a function`); continue; } events.push({ data, run }); } } catch (error) { - console.error("Error build events: ", error); + logger.error("Error build events: ", error); } }; -const registerEvents = () => { +const registerEvents = async () => { for (const { data, run } of events) { if (data.once) client.once(data.name, run); else client.on(data.name, run); diff --git a/newEvents/ready.js b/newEvents/ready.js index d796ebd6..0f698b5d 100644 --- a/newEvents/ready.js +++ b/newEvents/ready.js @@ -1,3 +1,5 @@ +import logger from "../helpers/logger.js"; + export const data = { name: "ready", once: true, @@ -8,5 +10,5 @@ export const data = { * @param {import("../base/Client.JaBaClient")} client */ export async function run(client) { - console.log(client.user.tag + " is online!"); + logger.log(client.user.tag + " is online!"); } From 5c4a1200dd6f30d37039d5b9bc89d0d46ca942dc Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" <48434875+JonnyBro@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:34:53 +0500 Subject: [PATCH 12/37] Update README.md remove codefactor image --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 87ce7928..5ca6aa94 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ JaBa is an open source Discord Bot written by [Jonny_Bro](https://github.com/Jon [![image](https://img.shields.io/discord/892727526911258654?logo=discord&&colorB=00BFFF&label=Discord&style=flat-square)](https://discord.gg/Ptkj2n9nzZ) [![image](https://img.shields.io/badge/discord.js-v14.14.1-blue.svg?logo=npm)](https://github.com/discordjs/discord.js) -[![image](https://www.codefactor.io/repository/github/JonnyBro/JaBa/badge)](https://www.codefactor.io/repository/github/JonnyBro/JaBa) [![image](https://img.shields.io/github/license/JonnyBro/JaBa?label=License&style=flat-square)](https://github.com/JonnyBro/JaBa/blob/main/LICENSE) ## Functionality From b7ee0fe291f3444ac87978498a71b78ed47f878b Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 9 Dec 2024 11:06:22 +0500 Subject: [PATCH 13/37] refactor(shorturl): reply with generated link from response --- commands/General/shorturl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js index 06da073d..ee60eb44 100644 --- a/commands/General/shorturl.js +++ b/commands/General/shorturl.js @@ -63,7 +63,7 @@ class Shorturl extends BaseCommand { }).then(res => res.json()); interaction.editReply({ - content: ``, + content: `<${res.shortLink}>`, }); } } From db7f9693fe4fdcaa53b6c0665ddc6cc2fa6e7548 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 9 Dec 2024 13:09:57 +0300 Subject: [PATCH 14/37] feat: new structure, and fixes paths on handlers --- base/newClient.js | 19 ----------- package.json | 4 +-- src/adapters/database/IDatabaseAdapter.js | 9 +++++ src/adapters/database/MongooseAdapter.js | 31 ++++++++++++++++++ .../assets}/fonts/KeepCalm-Medium.ttf | Bin .../assets}/fonts/RubikMonoOne-Regular.ttf | Bin .../assets}/img/achievements/achievement1.png | Bin .../assets}/img/achievements/achievement2.png | Bin .../assets}/img/achievements/achievement3.png | Bin .../assets}/img/achievements/achievement4.png | Bin .../assets}/img/achievements/achievement5.png | Bin .../assets}/img/achievements/achievement6.png | Bin .../assets}/img/achievements/achievement7.png | Bin .../img/achievements/achievement_colored1.png | Bin .../img/achievements/achievement_colored2.png | Bin .../img/achievements/achievement_colored3.png | Bin .../img/achievements/achievement_colored4.png | Bin .../img/achievements/achievement_colored5.png | Bin .../img/achievements/achievement_colored6.png | Bin .../img/achievements/achievement_colored7.png | Bin .../achievements/achievement_unlocked1.png | Bin .../achievements/achievement_unlocked2.png | Bin .../achievements/achievement_unlocked3.png | Bin .../achievements/achievement_unlocked4.png | Bin .../achievements/achievement_unlocked5.png | Bin .../achievements/achievement_unlocked6.png | Bin .../achievements/achievement_unlocked7.png | Bin .../assets}/img/greetings_background.png | Bin {base => src/base}/BaseCommand.js | 0 {base => src/base}/BaseEvent.js | 0 {base => src/base}/Client.js | 10 +++--- .../commands}/Administration/addemoji.js | 0 .../commands}/Administration/automod.js | 0 .../commands}/Administration/autorole.js | 0 .../commands}/Administration/config.js | 0 .../commands}/Administration/goodbye.js | 0 .../commands}/Administration/selectroles.js | 0 .../commands}/Administration/set.js | 0 .../commands}/Administration/setlang.js | 0 .../commands}/Administration/stealemoji.js | 0 .../commands}/Administration/welcome.js | 0 {commands => src/commands}/Beatrun/courses.js | 0 .../commands}/Economy/achievements.js | 0 {commands => src/commands}/Economy/bank.js | 0 .../commands}/Economy/birthdate.js | 0 {commands => src/commands}/Economy/divorce.js | 0 .../commands}/Economy/leaderboard.js | 0 {commands => src/commands}/Economy/marry.js | 0 {commands => src/commands}/Economy/money.js | 0 {commands => src/commands}/Economy/pay.js | 0 {commands => src/commands}/Economy/profile.js | 0 {commands => src/commands}/Economy/rep.js | 0 {commands => src/commands}/Economy/rob.js | 0 {commands => src/commands}/Economy/setbio.js | 0 {commands => src/commands}/Economy/slots.js | 0 .../commands}/Economy/transactions.js | 0 {commands => src/commands}/Economy/work.js | 0 {commands => src/commands}/Fun/8ball.js | 0 {commands => src/commands}/Fun/cat.js | 0 {commands => src/commands}/Fun/dog.js | 0 {commands => src/commands}/Fun/lmgtfy.js | 0 {commands => src/commands}/Fun/lovecalc.js | 0 {commands => src/commands}/Fun/number.js | 0 {commands => src/commands}/Fun/tictactoe.js | 0 {commands => src/commands}/General/afk.js | 0 .../commands}/General/avatar.c.js | 0 {commands => src/commands}/General/avatar.js | 0 .../commands}/General/boosters.js | 0 {commands => src/commands}/General/emoji.js | 0 {commands => src/commands}/General/help.js | 0 {commands => src/commands}/General/info.js | 0 .../commands}/General/minecraft.js | 0 {commands => src/commands}/General/ping.js | 0 .../commands}/General/remindme.js | 0 {commands => src/commands}/General/reminds.js | 0 {commands => src/commands}/General/report.js | 0 .../commands}/General/shorturl.js | 0 {commands => src/commands}/General/stats.js | 0 {commands => src/commands}/General/suggest.js | 0 {commands => src/commands}/General/whois.js | 0 {commands => src/commands}/IAT/checkjar.js | 0 .../commands}/Moderation/clear.js | 0 .../commands}/Moderation/clearwarns.js | 0 .../commands}/Moderation/giveaway.js | 0 .../commands}/Moderation/unban.js | 0 .../commands}/Moderation/untimeout.js | 0 .../commands}/Moderation/warn.c.js | 0 .../commands}/Moderation/warns.js | 0 {commands => src/commands}/Music/back.js | 0 {commands => src/commands}/Music/clips.js | 0 {commands => src/commands}/Music/loop.js | 0 .../commands}/Music/nowplaying.js | 0 {commands => src/commands}/Music/play.c.js | 0 {commands => src/commands}/Music/play.js | 0 {commands => src/commands}/Music/queue.js | 0 {commands => src/commands}/Music/seek.js | 0 {commands => src/commands}/Music/shuffle.js | 0 {commands => src/commands}/Music/skip.js | 0 {commands => src/commands}/Music/stop.js | 0 {commands => src/commands}/Music/volume.js | 0 {commands => src/commands}/Owner/debug.js | 0 {commands => src/commands}/Owner/eval.js | 0 {commands => src/commands}/Owner/reload.js | 0 {commands => src/commands}/Owner/say.js | 0 {commands => src/commands}/Owner/servers.js | 0 {commands => src/commands}/Tickets/adduser.js | 0 .../commands}/Tickets/closeticket.js | 0 .../commands}/Tickets/createticketembed.js | 0 .../commands}/Tickets/removeuser.js | 0 src/constants/index.js | 3 ++ {events => src/events}/CommandHandler.js | 0 {events => src/events}/Guild/guildBanAdd.js | 0 {events => src/events}/Guild/guildCreate.js | 0 {events => src/events}/Guild/guildDelete.js | 0 .../events}/Guild/guildMemberAdd.js | 0 .../events}/Guild/guildMemberRemove.js | 0 .../events}/Guild/guildMemberUpdate.js | 0 {events => src/events}/MessageHandler.js | 0 .../events}/Monitoring/messageDelete.js | 0 .../events}/Monitoring/messageUpdate.js | 0 {events => src/events}/Ready.js | 0 {events => src/events}/TicketsButton.js | 0 .../functions/registerCommands.js | 0 .../handlers}/command-handler/index.js | 0 .../utils/differentcommands.js | 0 .../handlers}/event-handler/index.js | 0 {helpers => src/helpers}/birthdays.js | 0 {helpers => src/helpers}/checkReminds.js | 0 {helpers => src/helpers}/cleanup.js | 0 {helpers => src/helpers}/extenders.js | 0 {helpers => src/helpers}/functions.js | 0 {helpers => src/helpers}/languages.js | 0 {helpers => src/helpers}/logger.js | 0 {helpers => src/helpers}/tictactoe.js | 0 index.js => src/index.js | 2 +- .../en-US/administration/addemoji.json | 0 .../en-US/administration/automod.json | 0 .../en-US/administration/autorole.json | 0 .../en-US/administration/config.json | 0 .../en-US/administration/deletemod.json | 0 .../en-US/administration/goodbye.json | 0 .../en-US/administration/selectroles.json | 0 .../languages}/en-US/administration/set.json | 0 .../en-US/administration/setlang.json | 0 .../en-US/administration/stealemoji.json | 0 .../en-US/administration/welcome.json | 0 .../languages}/en-US/beatrun/courses.json | 0 .../languages}/en-US/common.json | 0 .../en-US/economy/achievements.json | 0 .../languages}/en-US/economy/bank.json | 0 .../languages}/en-US/economy/birthdate.json | 0 .../languages}/en-US/economy/divorce.json | 0 .../languages}/en-US/economy/importmee6.json | 0 .../languages}/en-US/economy/leaderboard.json | 0 .../languages}/en-US/economy/marry.json | 0 .../languages}/en-US/economy/money.json | 0 .../languages}/en-US/economy/pay.json | 0 .../languages}/en-US/economy/profile.json | 0 .../languages}/en-US/economy/rep.json | 0 .../languages}/en-US/economy/rob.json | 0 .../languages}/en-US/economy/setbio.json | 0 .../languages}/en-US/economy/slots.json | 0 .../en-US/economy/transactions.json | 0 .../languages}/en-US/economy/work.json | 0 .../languages}/en-US/fun/8ball.json | 0 .../languages}/en-US/fun/cat.json | 0 .../languages}/en-US/fun/dog.json | 0 .../languages}/en-US/fun/lmgtfy.json | 0 .../languages}/en-US/fun/lovecalc.json | 0 .../languages}/en-US/fun/memes.json | 0 .../languages}/en-US/fun/number.json | 0 .../languages}/en-US/fun/tictactoe.json | 0 .../languages}/en-US/general/afk.json | 0 .../languages}/en-US/general/avatar.json | 0 .../languages}/en-US/general/boosters.json | 0 .../languages}/en-US/general/emoji.json | 0 .../languages}/en-US/general/help.json | 0 .../languages}/en-US/general/info.json | 0 .../languages}/en-US/general/minecraft.json | 0 .../languages}/en-US/general/ping.json | 0 .../languages}/en-US/general/remindme.json | 0 .../languages}/en-US/general/reminds.json | 0 .../languages}/en-US/general/report.json | 0 .../languages}/en-US/general/shorturl.json | 0 .../languages}/en-US/general/staff.json | 0 .../languages}/en-US/general/stats.json | 0 .../languages}/en-US/general/suggest.json | 0 .../languages}/en-US/general/whois.json | 0 .../languages}/en-US/iat/checkjar.json | 0 {languages => src/languages}/en-US/misc.json | 0 .../languages}/en-US/moderation/ban.json | 0 .../languages}/en-US/moderation/clear.json | 0 .../en-US/moderation/clearwarns.json | 0 .../languages}/en-US/moderation/giveaway.json | 0 .../languages}/en-US/moderation/kick.json | 0 .../languages}/en-US/moderation/unban.json | 0 .../en-US/moderation/untimeout.json | 0 .../languages}/en-US/moderation/warn.json | 0 .../languages}/en-US/moderation/warns.json | 0 .../languages}/en-US/music/back.json | 0 .../languages}/en-US/music/clips.json | 0 .../languages}/en-US/music/loop.json | 0 .../languages}/en-US/music/nowplaying.json | 0 .../languages}/en-US/music/play.json | 0 .../languages}/en-US/music/queue.json | 0 .../languages}/en-US/music/seek.json | 0 .../languages}/en-US/music/shuffle.json | 0 .../languages}/en-US/music/skip.json | 0 .../languages}/en-US/music/stop.json | 0 .../languages}/en-US/music/volume.json | 0 .../languages}/en-US/owner/announcement.json | 0 .../languages}/en-US/owner/debug.json | 0 .../languages}/en-US/owner/eval.json | 0 .../languages}/en-US/owner/reload.json | 0 .../languages}/en-US/owner/say.json | 0 .../languages}/en-US/owner/servers.json | 0 .../languages}/en-US/tickets/adduser.json | 0 .../languages}/en-US/tickets/closeticket.json | 0 .../en-US/tickets/createticketembed.json | 0 .../languages}/en-US/tickets/removeuser.json | 0 {languages => src/languages}/language-meta.js | 0 .../ru-RU/administration/addemoji.json | 0 .../ru-RU/administration/automod.json | 0 .../ru-RU/administration/autorole.json | 0 .../ru-RU/administration/config.json | 0 .../ru-RU/administration/deletemod.json | 0 .../ru-RU/administration/goodbye.json | 0 .../ru-RU/administration/selectroles.json | 0 .../languages}/ru-RU/administration/set.json | 0 .../ru-RU/administration/setlang.json | 0 .../ru-RU/administration/stealemoji.json | 0 .../ru-RU/administration/welcome.json | 0 .../languages}/ru-RU/beatrun/courses.json | 0 .../languages}/ru-RU/common.json | 0 .../ru-RU/economy/achievements.json | 0 .../languages}/ru-RU/economy/bank.json | 0 .../languages}/ru-RU/economy/birthdate.json | 0 .../languages}/ru-RU/economy/divorce.json | 0 .../languages}/ru-RU/economy/importmee6.json | 0 .../languages}/ru-RU/economy/leaderboard.json | 0 .../languages}/ru-RU/economy/marry.json | 0 .../languages}/ru-RU/economy/money.json | 0 .../languages}/ru-RU/economy/pay.json | 0 .../languages}/ru-RU/economy/profile.json | 0 .../languages}/ru-RU/economy/rep.json | 0 .../languages}/ru-RU/economy/rob.json | 0 .../languages}/ru-RU/economy/setbio.json | 0 .../languages}/ru-RU/economy/slots.json | 0 .../ru-RU/economy/transactions.json | 0 .../languages}/ru-RU/economy/work.json | 0 .../languages}/ru-RU/fun/8ball.json | 0 .../languages}/ru-RU/fun/cat.json | 0 .../languages}/ru-RU/fun/dog.json | 0 .../languages}/ru-RU/fun/lmgtfy.json | 0 .../languages}/ru-RU/fun/lovecalc.json | 0 .../languages}/ru-RU/fun/memes.json | 0 .../languages}/ru-RU/fun/number.json | 0 .../languages}/ru-RU/fun/tictactoe.json | 0 .../languages}/ru-RU/general/afk.json | 0 .../languages}/ru-RU/general/avatar.json | 0 .../languages}/ru-RU/general/boosters.json | 0 .../languages}/ru-RU/general/emoji.json | 0 .../languages}/ru-RU/general/help.json | 0 .../languages}/ru-RU/general/info.json | 0 .../languages}/ru-RU/general/minecraft.json | 0 .../languages}/ru-RU/general/ping.json | 0 .../languages}/ru-RU/general/remindme.json | 0 .../languages}/ru-RU/general/reminds.json | 0 .../languages}/ru-RU/general/report.json | 0 .../languages}/ru-RU/general/shorturl.json | 0 .../languages}/ru-RU/general/staff.json | 0 .../languages}/ru-RU/general/stats.json | 0 .../languages}/ru-RU/general/suggest.json | 0 .../languages}/ru-RU/general/whois.json | 0 .../languages}/ru-RU/iat/checkjar.json | 0 {languages => src/languages}/ru-RU/misc.json | 0 .../languages}/ru-RU/moderation/ban.json | 0 .../languages}/ru-RU/moderation/clear.json | 0 .../ru-RU/moderation/clearwarns.json | 0 .../languages}/ru-RU/moderation/giveaway.json | 0 .../languages}/ru-RU/moderation/kick.json | 0 .../languages}/ru-RU/moderation/unban.json | 0 .../ru-RU/moderation/untimeout.json | 0 .../languages}/ru-RU/moderation/warn.json | 0 .../languages}/ru-RU/moderation/warns.json | 0 .../languages}/ru-RU/music/back.json | 0 .../languages}/ru-RU/music/clips.json | 0 .../languages}/ru-RU/music/loop.json | 0 .../languages}/ru-RU/music/nowplaying.json | 0 .../languages}/ru-RU/music/play.json | 0 .../languages}/ru-RU/music/queue.json | 0 .../languages}/ru-RU/music/seek.json | 0 .../languages}/ru-RU/music/shuffle.json | 0 .../languages}/ru-RU/music/skip.json | 0 .../languages}/ru-RU/music/stop.json | 0 .../languages}/ru-RU/music/volume.json | 0 .../languages}/ru-RU/owner/announcement.json | 0 .../languages}/ru-RU/owner/debug.json | 0 .../languages}/ru-RU/owner/eval.json | 0 .../languages}/ru-RU/owner/reload.json | 0 .../languages}/ru-RU/owner/say.json | 0 .../languages}/ru-RU/owner/servers.json | 0 .../languages}/ru-RU/tickets/adduser.json | 0 .../languages}/ru-RU/tickets/closeticket.json | 0 .../ru-RU/tickets/createticketembed.json | 0 .../languages}/ru-RU/tickets/removeuser.json | 0 .../uk-UA/administration/addemoji.json | 0 .../uk-UA/administration/automod.json | 0 .../uk-UA/administration/autorole.json | 0 .../uk-UA/administration/config.json | 0 .../uk-UA/administration/deletemod.json | 0 .../uk-UA/administration/goodbye.json | 0 .../uk-UA/administration/selectroles.json | 0 .../languages}/uk-UA/administration/set.json | 0 .../uk-UA/administration/setlang.json | 0 .../uk-UA/administration/stealemoji.json | 0 .../uk-UA/administration/welcome.json | 0 .../languages}/uk-UA/beatrun/courses.json | 0 .../languages}/uk-UA/common.json | 0 .../uk-UA/economy/achievements.json | 0 .../languages}/uk-UA/economy/bank.json | 0 .../languages}/uk-UA/economy/birthdate.json | 0 .../languages}/uk-UA/economy/divorce.json | 0 .../languages}/uk-UA/economy/importmee6.json | 0 .../languages}/uk-UA/economy/leaderboard.json | 0 .../languages}/uk-UA/economy/marry.json | 0 .../languages}/uk-UA/economy/money.json | 0 .../languages}/uk-UA/economy/pay.json | 0 .../languages}/uk-UA/economy/profile.json | 0 .../languages}/uk-UA/economy/rep.json | 0 .../languages}/uk-UA/economy/rob.json | 0 .../languages}/uk-UA/economy/setbio.json | 0 .../languages}/uk-UA/economy/slots.json | 0 .../uk-UA/economy/transactions.json | 0 .../languages}/uk-UA/economy/work.json | 0 .../languages}/uk-UA/fun/8ball.json | 0 .../languages}/uk-UA/fun/cat.json | 0 .../languages}/uk-UA/fun/dog.json | 0 .../languages}/uk-UA/fun/lmgtfy.json | 0 .../languages}/uk-UA/fun/lovecalc.json | 0 .../languages}/uk-UA/fun/memes.json | 0 .../languages}/uk-UA/fun/number.json | 0 .../languages}/uk-UA/fun/tictactoe.json | 0 .../languages}/uk-UA/general/afk.json | 0 .../languages}/uk-UA/general/avatar.json | 0 .../languages}/uk-UA/general/boosters.json | 0 .../languages}/uk-UA/general/emoji.json | 0 .../languages}/uk-UA/general/help.json | 0 .../languages}/uk-UA/general/info.json | 0 .../languages}/uk-UA/general/minecraft.json | 0 .../languages}/uk-UA/general/ping.json | 0 .../languages}/uk-UA/general/remindme.json | 0 .../languages}/uk-UA/general/reminds.json | 0 .../languages}/uk-UA/general/report.json | 0 .../languages}/uk-UA/general/shorturl.json | 0 .../languages}/uk-UA/general/staff.json | 0 .../languages}/uk-UA/general/stats.json | 0 .../languages}/uk-UA/general/suggest.json | 0 .../languages}/uk-UA/general/whois.json | 0 .../languages}/uk-UA/iat/checkjar.json | 0 {languages => src/languages}/uk-UA/misc.json | 0 .../languages}/uk-UA/moderation/ban.json | 0 .../languages}/uk-UA/moderation/clear.json | 0 .../uk-UA/moderation/clearwarns.json | 0 .../languages}/uk-UA/moderation/giveaway.json | 0 .../languages}/uk-UA/moderation/kick.json | 0 .../languages}/uk-UA/moderation/unban.json | 0 .../uk-UA/moderation/untimeout.json | 0 .../languages}/uk-UA/moderation/warn.json | 0 .../languages}/uk-UA/moderation/warns.json | 0 .../languages}/uk-UA/music/back.json | 0 .../languages}/uk-UA/music/clips.json | 0 .../languages}/uk-UA/music/loop.json | 0 .../languages}/uk-UA/music/nowplaying.json | 0 .../languages}/uk-UA/music/play.json | 0 .../languages}/uk-UA/music/queue.json | 0 .../languages}/uk-UA/music/seek.json | 0 .../languages}/uk-UA/music/shuffle.json | 0 .../languages}/uk-UA/music/skip.json | 0 .../languages}/uk-UA/music/stop.json | 0 .../languages}/uk-UA/music/volume.json | 0 .../languages}/uk-UA/owner/announcement.json | 0 .../languages}/uk-UA/owner/debug.json | 0 .../languages}/uk-UA/owner/eval.json | 0 .../languages}/uk-UA/owner/reload.json | 0 .../languages}/uk-UA/owner/say.json | 0 .../languages}/uk-UA/owner/servers.json | 0 .../languages}/uk-UA/tickets/adduser.json | 0 .../languages}/uk-UA/tickets/closeticket.json | 0 .../uk-UA/tickets/createticketembed.json | 0 .../languages}/uk-UA/tickets/removeuser.json | 0 base/Guild.js => src/models/GuildModel.js | 0 base/Member.js => src/models/MemberModel.js | 0 base/User.js => src/models/UserModel.js | 0 {newCommands => src/newCommands}/Fun/8ball.js | 0 {newEvents => src/newEvents}/ready.js | 0 src/structures/client.js | 28 ++++++++++++++++ {utils => src/utils}/get-path.js | 5 ++- {utils => src/utils}/resolve-file.js | 3 +- 399 files changed, 85 insertions(+), 29 deletions(-) delete mode 100644 base/newClient.js create mode 100644 src/adapters/database/IDatabaseAdapter.js create mode 100644 src/adapters/database/MongooseAdapter.js rename {assets => src/assets}/fonts/KeepCalm-Medium.ttf (100%) rename {assets => src/assets}/fonts/RubikMonoOne-Regular.ttf (100%) rename {assets => src/assets}/img/achievements/achievement1.png (100%) rename {assets => src/assets}/img/achievements/achievement2.png (100%) rename {assets => src/assets}/img/achievements/achievement3.png (100%) rename {assets => src/assets}/img/achievements/achievement4.png (100%) rename {assets => src/assets}/img/achievements/achievement5.png (100%) rename {assets => src/assets}/img/achievements/achievement6.png (100%) rename {assets => src/assets}/img/achievements/achievement7.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored1.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored2.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored3.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored4.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored5.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored6.png (100%) rename {assets => src/assets}/img/achievements/achievement_colored7.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked1.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked2.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked3.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked4.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked5.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked6.png (100%) rename {assets => src/assets}/img/achievements/achievement_unlocked7.png (100%) rename {assets => src/assets}/img/greetings_background.png (100%) rename {base => src/base}/BaseCommand.js (100%) rename {base => src/base}/BaseEvent.js (100%) rename {base => src/base}/Client.js (96%) rename {commands => src/commands}/Administration/addemoji.js (100%) rename {commands => src/commands}/Administration/automod.js (100%) rename {commands => src/commands}/Administration/autorole.js (100%) rename {commands => src/commands}/Administration/config.js (100%) rename {commands => src/commands}/Administration/goodbye.js (100%) rename {commands => src/commands}/Administration/selectroles.js (100%) rename {commands => src/commands}/Administration/set.js (100%) rename {commands => src/commands}/Administration/setlang.js (100%) rename {commands => src/commands}/Administration/stealemoji.js (100%) rename {commands => src/commands}/Administration/welcome.js (100%) rename {commands => src/commands}/Beatrun/courses.js (100%) rename {commands => src/commands}/Economy/achievements.js (100%) rename {commands => src/commands}/Economy/bank.js (100%) rename {commands => src/commands}/Economy/birthdate.js (100%) rename {commands => src/commands}/Economy/divorce.js (100%) rename {commands => src/commands}/Economy/leaderboard.js (100%) rename {commands => src/commands}/Economy/marry.js (100%) rename {commands => src/commands}/Economy/money.js (100%) rename {commands => src/commands}/Economy/pay.js (100%) rename {commands => src/commands}/Economy/profile.js (100%) rename {commands => src/commands}/Economy/rep.js (100%) rename {commands => src/commands}/Economy/rob.js (100%) rename {commands => src/commands}/Economy/setbio.js (100%) rename {commands => src/commands}/Economy/slots.js (100%) rename {commands => src/commands}/Economy/transactions.js (100%) rename {commands => src/commands}/Economy/work.js (100%) rename {commands => src/commands}/Fun/8ball.js (100%) rename {commands => src/commands}/Fun/cat.js (100%) rename {commands => src/commands}/Fun/dog.js (100%) rename {commands => src/commands}/Fun/lmgtfy.js (100%) rename {commands => src/commands}/Fun/lovecalc.js (100%) rename {commands => src/commands}/Fun/number.js (100%) rename {commands => src/commands}/Fun/tictactoe.js (100%) rename {commands => src/commands}/General/afk.js (100%) rename {commands => src/commands}/General/avatar.c.js (100%) rename {commands => src/commands}/General/avatar.js (100%) rename {commands => src/commands}/General/boosters.js (100%) rename {commands => src/commands}/General/emoji.js (100%) rename {commands => src/commands}/General/help.js (100%) rename {commands => src/commands}/General/info.js (100%) rename {commands => src/commands}/General/minecraft.js (100%) rename {commands => src/commands}/General/ping.js (100%) rename {commands => src/commands}/General/remindme.js (100%) rename {commands => src/commands}/General/reminds.js (100%) rename {commands => src/commands}/General/report.js (100%) rename {commands => src/commands}/General/shorturl.js (100%) rename {commands => src/commands}/General/stats.js (100%) rename {commands => src/commands}/General/suggest.js (100%) rename {commands => src/commands}/General/whois.js (100%) rename {commands => src/commands}/IAT/checkjar.js (100%) rename {commands => src/commands}/Moderation/clear.js (100%) rename {commands => src/commands}/Moderation/clearwarns.js (100%) rename {commands => src/commands}/Moderation/giveaway.js (100%) rename {commands => src/commands}/Moderation/unban.js (100%) rename {commands => src/commands}/Moderation/untimeout.js (100%) rename {commands => src/commands}/Moderation/warn.c.js (100%) rename {commands => src/commands}/Moderation/warns.js (100%) rename {commands => src/commands}/Music/back.js (100%) rename {commands => src/commands}/Music/clips.js (100%) rename {commands => src/commands}/Music/loop.js (100%) rename {commands => src/commands}/Music/nowplaying.js (100%) rename {commands => src/commands}/Music/play.c.js (100%) rename {commands => src/commands}/Music/play.js (100%) rename {commands => src/commands}/Music/queue.js (100%) rename {commands => src/commands}/Music/seek.js (100%) rename {commands => src/commands}/Music/shuffle.js (100%) rename {commands => src/commands}/Music/skip.js (100%) rename {commands => src/commands}/Music/stop.js (100%) rename {commands => src/commands}/Music/volume.js (100%) rename {commands => src/commands}/Owner/debug.js (100%) rename {commands => src/commands}/Owner/eval.js (100%) rename {commands => src/commands}/Owner/reload.js (100%) rename {commands => src/commands}/Owner/say.js (100%) rename {commands => src/commands}/Owner/servers.js (100%) rename {commands => src/commands}/Tickets/adduser.js (100%) rename {commands => src/commands}/Tickets/closeticket.js (100%) rename {commands => src/commands}/Tickets/createticketembed.js (100%) rename {commands => src/commands}/Tickets/removeuser.js (100%) create mode 100644 src/constants/index.js rename {events => src/events}/CommandHandler.js (100%) rename {events => src/events}/Guild/guildBanAdd.js (100%) rename {events => src/events}/Guild/guildCreate.js (100%) rename {events => src/events}/Guild/guildDelete.js (100%) rename {events => src/events}/Guild/guildMemberAdd.js (100%) rename {events => src/events}/Guild/guildMemberRemove.js (100%) rename {events => src/events}/Guild/guildMemberUpdate.js (100%) rename {events => src/events}/MessageHandler.js (100%) rename {events => src/events}/Monitoring/messageDelete.js (100%) rename {events => src/events}/Monitoring/messageUpdate.js (100%) rename {events => src/events}/Ready.js (100%) rename {events => src/events}/TicketsButton.js (100%) rename {handlers => src/handlers}/command-handler/functions/registerCommands.js (100%) rename {handlers => src/handlers}/command-handler/index.js (100%) rename {handlers => src/handlers}/command-handler/utils/differentcommands.js (100%) rename {handlers => src/handlers}/event-handler/index.js (100%) rename {helpers => src/helpers}/birthdays.js (100%) rename {helpers => src/helpers}/checkReminds.js (100%) rename {helpers => src/helpers}/cleanup.js (100%) rename {helpers => src/helpers}/extenders.js (100%) rename {helpers => src/helpers}/functions.js (100%) rename {helpers => src/helpers}/languages.js (100%) rename {helpers => src/helpers}/logger.js (100%) rename {helpers => src/helpers}/tictactoe.js (100%) rename index.js => src/index.js (97%) rename {languages => src/languages}/en-US/administration/addemoji.json (100%) rename {languages => src/languages}/en-US/administration/automod.json (100%) rename {languages => src/languages}/en-US/administration/autorole.json (100%) rename {languages => src/languages}/en-US/administration/config.json (100%) rename {languages => src/languages}/en-US/administration/deletemod.json (100%) rename {languages => src/languages}/en-US/administration/goodbye.json (100%) rename {languages => src/languages}/en-US/administration/selectroles.json (100%) rename {languages => src/languages}/en-US/administration/set.json (100%) rename {languages => src/languages}/en-US/administration/setlang.json (100%) rename {languages => src/languages}/en-US/administration/stealemoji.json (100%) rename {languages => src/languages}/en-US/administration/welcome.json (100%) rename {languages => src/languages}/en-US/beatrun/courses.json (100%) rename {languages => src/languages}/en-US/common.json (100%) rename {languages => src/languages}/en-US/economy/achievements.json (100%) rename {languages => src/languages}/en-US/economy/bank.json (100%) rename {languages => src/languages}/en-US/economy/birthdate.json (100%) rename {languages => src/languages}/en-US/economy/divorce.json (100%) rename {languages => src/languages}/en-US/economy/importmee6.json (100%) rename {languages => src/languages}/en-US/economy/leaderboard.json (100%) rename {languages => src/languages}/en-US/economy/marry.json (100%) rename {languages => src/languages}/en-US/economy/money.json (100%) rename {languages => src/languages}/en-US/economy/pay.json (100%) rename {languages => src/languages}/en-US/economy/profile.json (100%) rename {languages => src/languages}/en-US/economy/rep.json (100%) rename {languages => src/languages}/en-US/economy/rob.json (100%) rename {languages => src/languages}/en-US/economy/setbio.json (100%) rename {languages => src/languages}/en-US/economy/slots.json (100%) rename {languages => src/languages}/en-US/economy/transactions.json (100%) rename {languages => src/languages}/en-US/economy/work.json (100%) rename {languages => src/languages}/en-US/fun/8ball.json (100%) rename {languages => src/languages}/en-US/fun/cat.json (100%) rename {languages => src/languages}/en-US/fun/dog.json (100%) rename {languages => src/languages}/en-US/fun/lmgtfy.json (100%) rename {languages => src/languages}/en-US/fun/lovecalc.json (100%) rename {languages => src/languages}/en-US/fun/memes.json (100%) rename {languages => src/languages}/en-US/fun/number.json (100%) rename {languages => src/languages}/en-US/fun/tictactoe.json (100%) rename {languages => src/languages}/en-US/general/afk.json (100%) rename {languages => src/languages}/en-US/general/avatar.json (100%) rename {languages => src/languages}/en-US/general/boosters.json (100%) rename {languages => src/languages}/en-US/general/emoji.json (100%) rename {languages => src/languages}/en-US/general/help.json (100%) rename {languages => src/languages}/en-US/general/info.json (100%) rename {languages => src/languages}/en-US/general/minecraft.json (100%) rename {languages => src/languages}/en-US/general/ping.json (100%) rename {languages => src/languages}/en-US/general/remindme.json (100%) rename {languages => src/languages}/en-US/general/reminds.json (100%) rename {languages => src/languages}/en-US/general/report.json (100%) rename {languages => src/languages}/en-US/general/shorturl.json (100%) rename {languages => src/languages}/en-US/general/staff.json (100%) rename {languages => src/languages}/en-US/general/stats.json (100%) rename {languages => src/languages}/en-US/general/suggest.json (100%) rename {languages => src/languages}/en-US/general/whois.json (100%) rename {languages => src/languages}/en-US/iat/checkjar.json (100%) rename {languages => src/languages}/en-US/misc.json (100%) rename {languages => src/languages}/en-US/moderation/ban.json (100%) rename {languages => src/languages}/en-US/moderation/clear.json (100%) rename {languages => src/languages}/en-US/moderation/clearwarns.json (100%) rename {languages => src/languages}/en-US/moderation/giveaway.json (100%) rename {languages => src/languages}/en-US/moderation/kick.json (100%) rename {languages => src/languages}/en-US/moderation/unban.json (100%) rename {languages => src/languages}/en-US/moderation/untimeout.json (100%) rename {languages => src/languages}/en-US/moderation/warn.json (100%) rename {languages => src/languages}/en-US/moderation/warns.json (100%) rename {languages => src/languages}/en-US/music/back.json (100%) rename {languages => src/languages}/en-US/music/clips.json (100%) rename {languages => src/languages}/en-US/music/loop.json (100%) rename {languages => src/languages}/en-US/music/nowplaying.json (100%) rename {languages => src/languages}/en-US/music/play.json (100%) rename {languages => src/languages}/en-US/music/queue.json (100%) rename {languages => src/languages}/en-US/music/seek.json (100%) rename {languages => src/languages}/en-US/music/shuffle.json (100%) rename {languages => src/languages}/en-US/music/skip.json (100%) rename {languages => src/languages}/en-US/music/stop.json (100%) rename {languages => src/languages}/en-US/music/volume.json (100%) rename {languages => src/languages}/en-US/owner/announcement.json (100%) rename {languages => src/languages}/en-US/owner/debug.json (100%) rename {languages => src/languages}/en-US/owner/eval.json (100%) rename {languages => src/languages}/en-US/owner/reload.json (100%) rename {languages => src/languages}/en-US/owner/say.json (100%) rename {languages => src/languages}/en-US/owner/servers.json (100%) rename {languages => src/languages}/en-US/tickets/adduser.json (100%) rename {languages => src/languages}/en-US/tickets/closeticket.json (100%) rename {languages => src/languages}/en-US/tickets/createticketembed.json (100%) rename {languages => src/languages}/en-US/tickets/removeuser.json (100%) rename {languages => src/languages}/language-meta.js (100%) rename {languages => src/languages}/ru-RU/administration/addemoji.json (100%) rename {languages => src/languages}/ru-RU/administration/automod.json (100%) rename {languages => src/languages}/ru-RU/administration/autorole.json (100%) rename {languages => src/languages}/ru-RU/administration/config.json (100%) rename {languages => src/languages}/ru-RU/administration/deletemod.json (100%) rename {languages => src/languages}/ru-RU/administration/goodbye.json (100%) rename {languages => src/languages}/ru-RU/administration/selectroles.json (100%) rename {languages => src/languages}/ru-RU/administration/set.json (100%) rename {languages => src/languages}/ru-RU/administration/setlang.json (100%) rename {languages => src/languages}/ru-RU/administration/stealemoji.json (100%) rename {languages => src/languages}/ru-RU/administration/welcome.json (100%) rename {languages => src/languages}/ru-RU/beatrun/courses.json (100%) rename {languages => src/languages}/ru-RU/common.json (100%) rename {languages => src/languages}/ru-RU/economy/achievements.json (100%) rename {languages => src/languages}/ru-RU/economy/bank.json (100%) rename {languages => src/languages}/ru-RU/economy/birthdate.json (100%) rename {languages => src/languages}/ru-RU/economy/divorce.json (100%) rename {languages => src/languages}/ru-RU/economy/importmee6.json (100%) rename {languages => src/languages}/ru-RU/economy/leaderboard.json (100%) rename {languages => src/languages}/ru-RU/economy/marry.json (100%) rename {languages => src/languages}/ru-RU/economy/money.json (100%) rename {languages => src/languages}/ru-RU/economy/pay.json (100%) rename {languages => src/languages}/ru-RU/economy/profile.json (100%) rename {languages => src/languages}/ru-RU/economy/rep.json (100%) rename {languages => src/languages}/ru-RU/economy/rob.json (100%) rename {languages => src/languages}/ru-RU/economy/setbio.json (100%) rename {languages => src/languages}/ru-RU/economy/slots.json (100%) rename {languages => src/languages}/ru-RU/economy/transactions.json (100%) rename {languages => src/languages}/ru-RU/economy/work.json (100%) rename {languages => src/languages}/ru-RU/fun/8ball.json (100%) rename {languages => src/languages}/ru-RU/fun/cat.json (100%) rename {languages => src/languages}/ru-RU/fun/dog.json (100%) rename {languages => src/languages}/ru-RU/fun/lmgtfy.json (100%) rename {languages => src/languages}/ru-RU/fun/lovecalc.json (100%) rename {languages => src/languages}/ru-RU/fun/memes.json (100%) rename {languages => src/languages}/ru-RU/fun/number.json (100%) rename {languages => src/languages}/ru-RU/fun/tictactoe.json (100%) rename {languages => src/languages}/ru-RU/general/afk.json (100%) rename {languages => src/languages}/ru-RU/general/avatar.json (100%) rename {languages => src/languages}/ru-RU/general/boosters.json (100%) rename {languages => src/languages}/ru-RU/general/emoji.json (100%) rename {languages => src/languages}/ru-RU/general/help.json (100%) rename {languages => src/languages}/ru-RU/general/info.json (100%) rename {languages => src/languages}/ru-RU/general/minecraft.json (100%) rename {languages => src/languages}/ru-RU/general/ping.json (100%) rename {languages => src/languages}/ru-RU/general/remindme.json (100%) rename {languages => src/languages}/ru-RU/general/reminds.json (100%) rename {languages => src/languages}/ru-RU/general/report.json (100%) rename {languages => src/languages}/ru-RU/general/shorturl.json (100%) rename {languages => src/languages}/ru-RU/general/staff.json (100%) rename {languages => src/languages}/ru-RU/general/stats.json (100%) rename {languages => src/languages}/ru-RU/general/suggest.json (100%) rename {languages => src/languages}/ru-RU/general/whois.json (100%) rename {languages => src/languages}/ru-RU/iat/checkjar.json (100%) rename {languages => src/languages}/ru-RU/misc.json (100%) rename {languages => src/languages}/ru-RU/moderation/ban.json (100%) rename {languages => src/languages}/ru-RU/moderation/clear.json (100%) rename {languages => src/languages}/ru-RU/moderation/clearwarns.json (100%) rename {languages => src/languages}/ru-RU/moderation/giveaway.json (100%) rename {languages => src/languages}/ru-RU/moderation/kick.json (100%) rename {languages => src/languages}/ru-RU/moderation/unban.json (100%) rename {languages => src/languages}/ru-RU/moderation/untimeout.json (100%) rename {languages => src/languages}/ru-RU/moderation/warn.json (100%) rename {languages => src/languages}/ru-RU/moderation/warns.json (100%) rename {languages => src/languages}/ru-RU/music/back.json (100%) rename {languages => src/languages}/ru-RU/music/clips.json (100%) rename {languages => src/languages}/ru-RU/music/loop.json (100%) rename {languages => src/languages}/ru-RU/music/nowplaying.json (100%) rename {languages => src/languages}/ru-RU/music/play.json (100%) rename {languages => src/languages}/ru-RU/music/queue.json (100%) rename {languages => src/languages}/ru-RU/music/seek.json (100%) rename {languages => src/languages}/ru-RU/music/shuffle.json (100%) rename {languages => src/languages}/ru-RU/music/skip.json (100%) rename {languages => src/languages}/ru-RU/music/stop.json (100%) rename {languages => src/languages}/ru-RU/music/volume.json (100%) rename {languages => src/languages}/ru-RU/owner/announcement.json (100%) rename {languages => src/languages}/ru-RU/owner/debug.json (100%) rename {languages => src/languages}/ru-RU/owner/eval.json (100%) rename {languages => src/languages}/ru-RU/owner/reload.json (100%) rename {languages => src/languages}/ru-RU/owner/say.json (100%) rename {languages => src/languages}/ru-RU/owner/servers.json (100%) rename {languages => src/languages}/ru-RU/tickets/adduser.json (100%) rename {languages => src/languages}/ru-RU/tickets/closeticket.json (100%) rename {languages => src/languages}/ru-RU/tickets/createticketembed.json (100%) rename {languages => src/languages}/ru-RU/tickets/removeuser.json (100%) rename {languages => src/languages}/uk-UA/administration/addemoji.json (100%) rename {languages => src/languages}/uk-UA/administration/automod.json (100%) rename {languages => src/languages}/uk-UA/administration/autorole.json (100%) rename {languages => src/languages}/uk-UA/administration/config.json (100%) rename {languages => src/languages}/uk-UA/administration/deletemod.json (100%) rename {languages => src/languages}/uk-UA/administration/goodbye.json (100%) rename {languages => src/languages}/uk-UA/administration/selectroles.json (100%) rename {languages => src/languages}/uk-UA/administration/set.json (100%) rename {languages => src/languages}/uk-UA/administration/setlang.json (100%) rename {languages => src/languages}/uk-UA/administration/stealemoji.json (100%) rename {languages => src/languages}/uk-UA/administration/welcome.json (100%) rename {languages => src/languages}/uk-UA/beatrun/courses.json (100%) rename {languages => src/languages}/uk-UA/common.json (100%) rename {languages => src/languages}/uk-UA/economy/achievements.json (100%) rename {languages => src/languages}/uk-UA/economy/bank.json (100%) rename {languages => src/languages}/uk-UA/economy/birthdate.json (100%) rename {languages => src/languages}/uk-UA/economy/divorce.json (100%) rename {languages => src/languages}/uk-UA/economy/importmee6.json (100%) rename {languages => src/languages}/uk-UA/economy/leaderboard.json (100%) rename {languages => src/languages}/uk-UA/economy/marry.json (100%) rename {languages => src/languages}/uk-UA/economy/money.json (100%) rename {languages => src/languages}/uk-UA/economy/pay.json (100%) rename {languages => src/languages}/uk-UA/economy/profile.json (100%) rename {languages => src/languages}/uk-UA/economy/rep.json (100%) rename {languages => src/languages}/uk-UA/economy/rob.json (100%) rename {languages => src/languages}/uk-UA/economy/setbio.json (100%) rename {languages => src/languages}/uk-UA/economy/slots.json (100%) rename {languages => src/languages}/uk-UA/economy/transactions.json (100%) rename {languages => src/languages}/uk-UA/economy/work.json (100%) rename {languages => src/languages}/uk-UA/fun/8ball.json (100%) rename {languages => src/languages}/uk-UA/fun/cat.json (100%) rename {languages => src/languages}/uk-UA/fun/dog.json (100%) rename {languages => src/languages}/uk-UA/fun/lmgtfy.json (100%) rename {languages => src/languages}/uk-UA/fun/lovecalc.json (100%) rename {languages => src/languages}/uk-UA/fun/memes.json (100%) rename {languages => src/languages}/uk-UA/fun/number.json (100%) rename {languages => src/languages}/uk-UA/fun/tictactoe.json (100%) rename {languages => src/languages}/uk-UA/general/afk.json (100%) rename {languages => src/languages}/uk-UA/general/avatar.json (100%) rename {languages => src/languages}/uk-UA/general/boosters.json (100%) rename {languages => src/languages}/uk-UA/general/emoji.json (100%) rename {languages => src/languages}/uk-UA/general/help.json (100%) rename {languages => src/languages}/uk-UA/general/info.json (100%) rename {languages => src/languages}/uk-UA/general/minecraft.json (100%) rename {languages => src/languages}/uk-UA/general/ping.json (100%) rename {languages => src/languages}/uk-UA/general/remindme.json (100%) rename {languages => src/languages}/uk-UA/general/reminds.json (100%) rename {languages => src/languages}/uk-UA/general/report.json (100%) rename {languages => src/languages}/uk-UA/general/shorturl.json (100%) rename {languages => src/languages}/uk-UA/general/staff.json (100%) rename {languages => src/languages}/uk-UA/general/stats.json (100%) rename {languages => src/languages}/uk-UA/general/suggest.json (100%) rename {languages => src/languages}/uk-UA/general/whois.json (100%) rename {languages => src/languages}/uk-UA/iat/checkjar.json (100%) rename {languages => src/languages}/uk-UA/misc.json (100%) rename {languages => src/languages}/uk-UA/moderation/ban.json (100%) rename {languages => src/languages}/uk-UA/moderation/clear.json (100%) rename {languages => src/languages}/uk-UA/moderation/clearwarns.json (100%) rename {languages => src/languages}/uk-UA/moderation/giveaway.json (100%) rename {languages => src/languages}/uk-UA/moderation/kick.json (100%) rename {languages => src/languages}/uk-UA/moderation/unban.json (100%) rename {languages => src/languages}/uk-UA/moderation/untimeout.json (100%) rename {languages => src/languages}/uk-UA/moderation/warn.json (100%) rename {languages => src/languages}/uk-UA/moderation/warns.json (100%) rename {languages => src/languages}/uk-UA/music/back.json (100%) rename {languages => src/languages}/uk-UA/music/clips.json (100%) rename {languages => src/languages}/uk-UA/music/loop.json (100%) rename {languages => src/languages}/uk-UA/music/nowplaying.json (100%) rename {languages => src/languages}/uk-UA/music/play.json (100%) rename {languages => src/languages}/uk-UA/music/queue.json (100%) rename {languages => src/languages}/uk-UA/music/seek.json (100%) rename {languages => src/languages}/uk-UA/music/shuffle.json (100%) rename {languages => src/languages}/uk-UA/music/skip.json (100%) rename {languages => src/languages}/uk-UA/music/stop.json (100%) rename {languages => src/languages}/uk-UA/music/volume.json (100%) rename {languages => src/languages}/uk-UA/owner/announcement.json (100%) rename {languages => src/languages}/uk-UA/owner/debug.json (100%) rename {languages => src/languages}/uk-UA/owner/eval.json (100%) rename {languages => src/languages}/uk-UA/owner/reload.json (100%) rename {languages => src/languages}/uk-UA/owner/say.json (100%) rename {languages => src/languages}/uk-UA/owner/servers.json (100%) rename {languages => src/languages}/uk-UA/tickets/adduser.json (100%) rename {languages => src/languages}/uk-UA/tickets/closeticket.json (100%) rename {languages => src/languages}/uk-UA/tickets/createticketembed.json (100%) rename {languages => src/languages}/uk-UA/tickets/removeuser.json (100%) rename base/Guild.js => src/models/GuildModel.js (100%) rename base/Member.js => src/models/MemberModel.js (100%) rename base/User.js => src/models/UserModel.js (100%) rename {newCommands => src/newCommands}/Fun/8ball.js (100%) rename {newEvents => src/newEvents}/ready.js (100%) create mode 100644 src/structures/client.js rename {utils => src/utils}/get-path.js (65%) rename {utils => src/utils}/resolve-file.js (63%) diff --git a/base/newClient.js b/base/newClient.js deleted file mode 100644 index ae3e9497..00000000 --- a/base/newClient.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Client } from "discord.js"; -import { config } from "../config.js"; -import { init as initCommands } from "../handlers/command-handler/index.js"; -import { init as initEvents } from "../handlers/event-handler/index.js"; - -export class ExtendedClient extends Client { - /** - * @param {import("discord.js").ClientOptions} options - */ - constructor(options) { - super(options); - } - - async init() { - return this.login(config.token) - .then(async () => await Promise.all([initCommands(), initEvents()])) - .catch(console.error); - } -} diff --git a/package.json b/package.json index f69dbec3..1b98402d 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "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": { diff --git a/src/adapters/database/IDatabaseAdapter.js b/src/adapters/database/IDatabaseAdapter.js new file mode 100644 index 00000000..feee308f --- /dev/null +++ b/src/adapters/database/IDatabaseAdapter.js @@ -0,0 +1,9 @@ +export default class IDatabaseAdapter { + async connect() { + throw new Error("Method `connect` not implemented."); + } + + async disconnect() { + throw new Error("Method `disconnect` not implemented."); + } +} diff --git a/src/adapters/database/MongooseAdapter.js b/src/adapters/database/MongooseAdapter.js new file mode 100644 index 00000000..f6d244c3 --- /dev/null +++ b/src/adapters/database/MongooseAdapter.js @@ -0,0 +1,31 @@ +import mongoose from "mongoose"; +import IDatabaseAdapter from "./IDatabaseAdapter.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); + console.log("Database connected."); + } + + async disconnect() { + await mongoose.disconnect(); + console.log("Database disconnected."); + } +} 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/BaseCommand.js similarity index 100% rename from base/BaseCommand.js rename to src/base/BaseCommand.js diff --git a/base/BaseEvent.js b/src/base/BaseEvent.js similarity index 100% rename from base/BaseEvent.js rename to src/base/BaseEvent.js diff --git a/base/Client.js b/src/base/Client.js similarity index 96% rename from base/Client.js rename to src/base/Client.js index b8217352..45f45876 100644 --- a/base/Client.js +++ b/src/base/Client.js @@ -10,8 +10,8 @@ import { promises as fs } from "fs"; import { setTimeout } from "timers/promises"; import mongoose from "mongoose"; -import config from "../config.js"; -import * as emojis from "../emojis.json"; +import config from "../../config.js"; +import * as emojis from "../../emojis.json"; import langs from "../languages/language-meta.js"; import logger from "../helpers/logger.js"; import * as funcs from "../helpers/functions.js"; @@ -327,7 +327,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 }); @@ -346,7 +346,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 }); @@ -370,7 +370,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"); diff --git a/commands/Administration/addemoji.js b/src/commands/Administration/addemoji.js similarity index 100% rename from commands/Administration/addemoji.js rename to src/commands/Administration/addemoji.js diff --git a/commands/Administration/automod.js b/src/commands/Administration/automod.js similarity index 100% rename from commands/Administration/automod.js rename to src/commands/Administration/automod.js diff --git a/commands/Administration/autorole.js b/src/commands/Administration/autorole.js similarity index 100% rename from commands/Administration/autorole.js rename to src/commands/Administration/autorole.js diff --git a/commands/Administration/config.js b/src/commands/Administration/config.js similarity index 100% rename from commands/Administration/config.js rename to src/commands/Administration/config.js diff --git a/commands/Administration/goodbye.js b/src/commands/Administration/goodbye.js similarity index 100% rename from commands/Administration/goodbye.js rename to src/commands/Administration/goodbye.js diff --git a/commands/Administration/selectroles.js b/src/commands/Administration/selectroles.js similarity index 100% rename from commands/Administration/selectroles.js rename to src/commands/Administration/selectroles.js diff --git a/commands/Administration/set.js b/src/commands/Administration/set.js similarity index 100% rename from commands/Administration/set.js rename to src/commands/Administration/set.js diff --git a/commands/Administration/setlang.js b/src/commands/Administration/setlang.js similarity index 100% rename from commands/Administration/setlang.js rename to src/commands/Administration/setlang.js diff --git a/commands/Administration/stealemoji.js b/src/commands/Administration/stealemoji.js similarity index 100% rename from commands/Administration/stealemoji.js rename to src/commands/Administration/stealemoji.js diff --git a/commands/Administration/welcome.js b/src/commands/Administration/welcome.js similarity index 100% rename from commands/Administration/welcome.js rename to src/commands/Administration/welcome.js diff --git a/commands/Beatrun/courses.js b/src/commands/Beatrun/courses.js similarity index 100% rename from commands/Beatrun/courses.js rename to src/commands/Beatrun/courses.js diff --git a/commands/Economy/achievements.js b/src/commands/Economy/achievements.js similarity index 100% rename from commands/Economy/achievements.js rename to src/commands/Economy/achievements.js diff --git a/commands/Economy/bank.js b/src/commands/Economy/bank.js similarity index 100% rename from commands/Economy/bank.js rename to src/commands/Economy/bank.js diff --git a/commands/Economy/birthdate.js b/src/commands/Economy/birthdate.js similarity index 100% rename from commands/Economy/birthdate.js rename to src/commands/Economy/birthdate.js diff --git a/commands/Economy/divorce.js b/src/commands/Economy/divorce.js similarity index 100% rename from commands/Economy/divorce.js rename to src/commands/Economy/divorce.js diff --git a/commands/Economy/leaderboard.js b/src/commands/Economy/leaderboard.js similarity index 100% rename from commands/Economy/leaderboard.js rename to src/commands/Economy/leaderboard.js diff --git a/commands/Economy/marry.js b/src/commands/Economy/marry.js similarity index 100% rename from commands/Economy/marry.js rename to src/commands/Economy/marry.js diff --git a/commands/Economy/money.js b/src/commands/Economy/money.js similarity index 100% rename from commands/Economy/money.js rename to src/commands/Economy/money.js diff --git a/commands/Economy/pay.js b/src/commands/Economy/pay.js similarity index 100% rename from commands/Economy/pay.js rename to src/commands/Economy/pay.js diff --git a/commands/Economy/profile.js b/src/commands/Economy/profile.js similarity index 100% rename from commands/Economy/profile.js rename to src/commands/Economy/profile.js diff --git a/commands/Economy/rep.js b/src/commands/Economy/rep.js similarity index 100% rename from commands/Economy/rep.js rename to src/commands/Economy/rep.js diff --git a/commands/Economy/rob.js b/src/commands/Economy/rob.js similarity index 100% rename from commands/Economy/rob.js rename to src/commands/Economy/rob.js diff --git a/commands/Economy/setbio.js b/src/commands/Economy/setbio.js similarity index 100% rename from commands/Economy/setbio.js rename to src/commands/Economy/setbio.js diff --git a/commands/Economy/slots.js b/src/commands/Economy/slots.js similarity index 100% rename from commands/Economy/slots.js rename to src/commands/Economy/slots.js diff --git a/commands/Economy/transactions.js b/src/commands/Economy/transactions.js similarity index 100% rename from commands/Economy/transactions.js rename to src/commands/Economy/transactions.js diff --git a/commands/Economy/work.js b/src/commands/Economy/work.js similarity index 100% rename from commands/Economy/work.js rename to src/commands/Economy/work.js diff --git a/commands/Fun/8ball.js b/src/commands/Fun/8ball.js similarity index 100% rename from commands/Fun/8ball.js rename to src/commands/Fun/8ball.js diff --git a/commands/Fun/cat.js b/src/commands/Fun/cat.js similarity index 100% rename from commands/Fun/cat.js rename to src/commands/Fun/cat.js diff --git a/commands/Fun/dog.js b/src/commands/Fun/dog.js similarity index 100% rename from commands/Fun/dog.js rename to src/commands/Fun/dog.js diff --git a/commands/Fun/lmgtfy.js b/src/commands/Fun/lmgtfy.js similarity index 100% rename from commands/Fun/lmgtfy.js rename to src/commands/Fun/lmgtfy.js diff --git a/commands/Fun/lovecalc.js b/src/commands/Fun/lovecalc.js similarity index 100% rename from commands/Fun/lovecalc.js rename to src/commands/Fun/lovecalc.js diff --git a/commands/Fun/number.js b/src/commands/Fun/number.js similarity index 100% rename from commands/Fun/number.js rename to src/commands/Fun/number.js diff --git a/commands/Fun/tictactoe.js b/src/commands/Fun/tictactoe.js similarity index 100% rename from commands/Fun/tictactoe.js rename to src/commands/Fun/tictactoe.js diff --git a/commands/General/afk.js b/src/commands/General/afk.js similarity index 100% rename from commands/General/afk.js rename to src/commands/General/afk.js diff --git a/commands/General/avatar.c.js b/src/commands/General/avatar.c.js similarity index 100% rename from commands/General/avatar.c.js rename to src/commands/General/avatar.c.js diff --git a/commands/General/avatar.js b/src/commands/General/avatar.js similarity index 100% rename from commands/General/avatar.js rename to src/commands/General/avatar.js diff --git a/commands/General/boosters.js b/src/commands/General/boosters.js similarity index 100% rename from commands/General/boosters.js rename to src/commands/General/boosters.js diff --git a/commands/General/emoji.js b/src/commands/General/emoji.js similarity index 100% rename from commands/General/emoji.js rename to src/commands/General/emoji.js diff --git a/commands/General/help.js b/src/commands/General/help.js similarity index 100% rename from commands/General/help.js rename to src/commands/General/help.js diff --git a/commands/General/info.js b/src/commands/General/info.js similarity index 100% rename from commands/General/info.js rename to src/commands/General/info.js diff --git a/commands/General/minecraft.js b/src/commands/General/minecraft.js similarity index 100% rename from commands/General/minecraft.js rename to src/commands/General/minecraft.js diff --git a/commands/General/ping.js b/src/commands/General/ping.js similarity index 100% rename from commands/General/ping.js rename to src/commands/General/ping.js diff --git a/commands/General/remindme.js b/src/commands/General/remindme.js similarity index 100% rename from commands/General/remindme.js rename to src/commands/General/remindme.js diff --git a/commands/General/reminds.js b/src/commands/General/reminds.js similarity index 100% rename from commands/General/reminds.js rename to src/commands/General/reminds.js diff --git a/commands/General/report.js b/src/commands/General/report.js similarity index 100% rename from commands/General/report.js rename to src/commands/General/report.js diff --git a/commands/General/shorturl.js b/src/commands/General/shorturl.js similarity index 100% rename from commands/General/shorturl.js rename to src/commands/General/shorturl.js diff --git a/commands/General/stats.js b/src/commands/General/stats.js similarity index 100% rename from commands/General/stats.js rename to src/commands/General/stats.js diff --git a/commands/General/suggest.js b/src/commands/General/suggest.js similarity index 100% rename from commands/General/suggest.js rename to src/commands/General/suggest.js diff --git a/commands/General/whois.js b/src/commands/General/whois.js similarity index 100% rename from commands/General/whois.js rename to src/commands/General/whois.js diff --git a/commands/IAT/checkjar.js b/src/commands/IAT/checkjar.js similarity index 100% rename from commands/IAT/checkjar.js rename to src/commands/IAT/checkjar.js diff --git a/commands/Moderation/clear.js b/src/commands/Moderation/clear.js similarity index 100% rename from commands/Moderation/clear.js rename to src/commands/Moderation/clear.js diff --git a/commands/Moderation/clearwarns.js b/src/commands/Moderation/clearwarns.js similarity index 100% rename from commands/Moderation/clearwarns.js rename to src/commands/Moderation/clearwarns.js diff --git a/commands/Moderation/giveaway.js b/src/commands/Moderation/giveaway.js similarity index 100% rename from commands/Moderation/giveaway.js rename to src/commands/Moderation/giveaway.js diff --git a/commands/Moderation/unban.js b/src/commands/Moderation/unban.js similarity index 100% rename from commands/Moderation/unban.js rename to src/commands/Moderation/unban.js diff --git a/commands/Moderation/untimeout.js b/src/commands/Moderation/untimeout.js similarity index 100% rename from commands/Moderation/untimeout.js rename to src/commands/Moderation/untimeout.js diff --git a/commands/Moderation/warn.c.js b/src/commands/Moderation/warn.c.js similarity index 100% rename from commands/Moderation/warn.c.js rename to src/commands/Moderation/warn.c.js diff --git a/commands/Moderation/warns.js b/src/commands/Moderation/warns.js similarity index 100% rename from commands/Moderation/warns.js rename to src/commands/Moderation/warns.js diff --git a/commands/Music/back.js b/src/commands/Music/back.js similarity index 100% rename from commands/Music/back.js rename to src/commands/Music/back.js diff --git a/commands/Music/clips.js b/src/commands/Music/clips.js similarity index 100% rename from commands/Music/clips.js rename to src/commands/Music/clips.js diff --git a/commands/Music/loop.js b/src/commands/Music/loop.js similarity index 100% rename from commands/Music/loop.js rename to src/commands/Music/loop.js diff --git a/commands/Music/nowplaying.js b/src/commands/Music/nowplaying.js similarity index 100% rename from commands/Music/nowplaying.js rename to src/commands/Music/nowplaying.js diff --git a/commands/Music/play.c.js b/src/commands/Music/play.c.js similarity index 100% rename from commands/Music/play.c.js rename to src/commands/Music/play.c.js diff --git a/commands/Music/play.js b/src/commands/Music/play.js similarity index 100% rename from commands/Music/play.js rename to src/commands/Music/play.js diff --git a/commands/Music/queue.js b/src/commands/Music/queue.js similarity index 100% rename from commands/Music/queue.js rename to src/commands/Music/queue.js diff --git a/commands/Music/seek.js b/src/commands/Music/seek.js similarity index 100% rename from commands/Music/seek.js rename to src/commands/Music/seek.js diff --git a/commands/Music/shuffle.js b/src/commands/Music/shuffle.js similarity index 100% rename from commands/Music/shuffle.js rename to src/commands/Music/shuffle.js diff --git a/commands/Music/skip.js b/src/commands/Music/skip.js similarity index 100% rename from commands/Music/skip.js rename to src/commands/Music/skip.js diff --git a/commands/Music/stop.js b/src/commands/Music/stop.js similarity index 100% rename from commands/Music/stop.js rename to src/commands/Music/stop.js diff --git a/commands/Music/volume.js b/src/commands/Music/volume.js similarity index 100% rename from commands/Music/volume.js rename to src/commands/Music/volume.js diff --git a/commands/Owner/debug.js b/src/commands/Owner/debug.js similarity index 100% rename from commands/Owner/debug.js rename to src/commands/Owner/debug.js diff --git a/commands/Owner/eval.js b/src/commands/Owner/eval.js similarity index 100% rename from commands/Owner/eval.js rename to src/commands/Owner/eval.js diff --git a/commands/Owner/reload.js b/src/commands/Owner/reload.js similarity index 100% rename from commands/Owner/reload.js rename to src/commands/Owner/reload.js diff --git a/commands/Owner/say.js b/src/commands/Owner/say.js similarity index 100% rename from commands/Owner/say.js rename to src/commands/Owner/say.js diff --git a/commands/Owner/servers.js b/src/commands/Owner/servers.js similarity index 100% rename from commands/Owner/servers.js rename to src/commands/Owner/servers.js diff --git a/commands/Tickets/adduser.js b/src/commands/Tickets/adduser.js similarity index 100% rename from commands/Tickets/adduser.js rename to src/commands/Tickets/adduser.js diff --git a/commands/Tickets/closeticket.js b/src/commands/Tickets/closeticket.js similarity index 100% rename from commands/Tickets/closeticket.js rename to src/commands/Tickets/closeticket.js diff --git a/commands/Tickets/createticketembed.js b/src/commands/Tickets/createticketembed.js similarity index 100% rename from commands/Tickets/createticketembed.js rename to src/commands/Tickets/createticketembed.js diff --git a/commands/Tickets/removeuser.js b/src/commands/Tickets/removeuser.js similarity index 100% rename from commands/Tickets/removeuser.js rename to src/commands/Tickets/removeuser.js diff --git a/src/constants/index.js b/src/constants/index.js new file mode 100644 index 00000000..5ee045d6 --- /dev/null +++ b/src/constants/index.js @@ -0,0 +1,3 @@ +import path from "node:path"; + +export const PROJECT_ROOT = path.join(import.meta.dirname, ".."); diff --git a/events/CommandHandler.js b/src/events/CommandHandler.js similarity index 100% rename from events/CommandHandler.js rename to src/events/CommandHandler.js diff --git a/events/Guild/guildBanAdd.js b/src/events/Guild/guildBanAdd.js similarity index 100% rename from events/Guild/guildBanAdd.js rename to src/events/Guild/guildBanAdd.js diff --git a/events/Guild/guildCreate.js b/src/events/Guild/guildCreate.js similarity index 100% rename from events/Guild/guildCreate.js rename to src/events/Guild/guildCreate.js diff --git a/events/Guild/guildDelete.js b/src/events/Guild/guildDelete.js similarity index 100% rename from events/Guild/guildDelete.js rename to src/events/Guild/guildDelete.js diff --git a/events/Guild/guildMemberAdd.js b/src/events/Guild/guildMemberAdd.js similarity index 100% rename from events/Guild/guildMemberAdd.js rename to src/events/Guild/guildMemberAdd.js diff --git a/events/Guild/guildMemberRemove.js b/src/events/Guild/guildMemberRemove.js similarity index 100% rename from events/Guild/guildMemberRemove.js rename to src/events/Guild/guildMemberRemove.js diff --git a/events/Guild/guildMemberUpdate.js b/src/events/Guild/guildMemberUpdate.js similarity index 100% rename from events/Guild/guildMemberUpdate.js rename to src/events/Guild/guildMemberUpdate.js diff --git a/events/MessageHandler.js b/src/events/MessageHandler.js similarity index 100% rename from events/MessageHandler.js rename to src/events/MessageHandler.js diff --git a/events/Monitoring/messageDelete.js b/src/events/Monitoring/messageDelete.js similarity index 100% rename from events/Monitoring/messageDelete.js rename to src/events/Monitoring/messageDelete.js diff --git a/events/Monitoring/messageUpdate.js b/src/events/Monitoring/messageUpdate.js similarity index 100% rename from events/Monitoring/messageUpdate.js rename to src/events/Monitoring/messageUpdate.js diff --git a/events/Ready.js b/src/events/Ready.js similarity index 100% rename from events/Ready.js rename to src/events/Ready.js diff --git a/events/TicketsButton.js b/src/events/TicketsButton.js similarity index 100% rename from events/TicketsButton.js rename to src/events/TicketsButton.js diff --git a/handlers/command-handler/functions/registerCommands.js b/src/handlers/command-handler/functions/registerCommands.js similarity index 100% rename from handlers/command-handler/functions/registerCommands.js rename to src/handlers/command-handler/functions/registerCommands.js diff --git a/handlers/command-handler/index.js b/src/handlers/command-handler/index.js similarity index 100% rename from handlers/command-handler/index.js rename to src/handlers/command-handler/index.js diff --git a/handlers/command-handler/utils/differentcommands.js b/src/handlers/command-handler/utils/differentcommands.js similarity index 100% rename from handlers/command-handler/utils/differentcommands.js rename to src/handlers/command-handler/utils/differentcommands.js diff --git a/handlers/event-handler/index.js b/src/handlers/event-handler/index.js similarity index 100% rename from handlers/event-handler/index.js rename to src/handlers/event-handler/index.js diff --git a/helpers/birthdays.js b/src/helpers/birthdays.js similarity index 100% rename from helpers/birthdays.js rename to src/helpers/birthdays.js diff --git a/helpers/checkReminds.js b/src/helpers/checkReminds.js similarity index 100% rename from helpers/checkReminds.js rename to src/helpers/checkReminds.js diff --git a/helpers/cleanup.js b/src/helpers/cleanup.js similarity index 100% rename from helpers/cleanup.js rename to src/helpers/cleanup.js diff --git a/helpers/extenders.js b/src/helpers/extenders.js similarity index 100% rename from helpers/extenders.js rename to src/helpers/extenders.js diff --git a/helpers/functions.js b/src/helpers/functions.js similarity index 100% rename from helpers/functions.js rename to src/helpers/functions.js diff --git a/helpers/languages.js b/src/helpers/languages.js similarity index 100% rename from helpers/languages.js rename to src/helpers/languages.js diff --git a/helpers/logger.js b/src/helpers/logger.js similarity index 100% rename from helpers/logger.js rename to src/helpers/logger.js diff --git a/helpers/tictactoe.js b/src/helpers/tictactoe.js similarity index 100% rename from helpers/tictactoe.js rename to src/helpers/tictactoe.js diff --git a/index.js b/src/index.js similarity index 97% rename from index.js rename to src/index.js index cbab0c0a..3429d899 100644 --- a/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ // import languages from "./helpers/languages.js"; import { GatewayIntentBits } from "discord.js"; -import { ExtendedClient } from "./base/newClient.js"; +import { ExtendedClient } from "./structures/client.js"; export const client = new ExtendedClient({ intents: [ diff --git a/languages/en-US/administration/addemoji.json b/src/languages/en-US/administration/addemoji.json similarity index 100% rename from languages/en-US/administration/addemoji.json rename to src/languages/en-US/administration/addemoji.json diff --git a/languages/en-US/administration/automod.json b/src/languages/en-US/administration/automod.json similarity index 100% rename from languages/en-US/administration/automod.json rename to src/languages/en-US/administration/automod.json diff --git a/languages/en-US/administration/autorole.json b/src/languages/en-US/administration/autorole.json similarity index 100% rename from languages/en-US/administration/autorole.json rename to src/languages/en-US/administration/autorole.json diff --git a/languages/en-US/administration/config.json b/src/languages/en-US/administration/config.json similarity index 100% rename from languages/en-US/administration/config.json rename to src/languages/en-US/administration/config.json diff --git a/languages/en-US/administration/deletemod.json b/src/languages/en-US/administration/deletemod.json similarity index 100% rename from languages/en-US/administration/deletemod.json rename to src/languages/en-US/administration/deletemod.json diff --git a/languages/en-US/administration/goodbye.json b/src/languages/en-US/administration/goodbye.json similarity index 100% rename from languages/en-US/administration/goodbye.json rename to src/languages/en-US/administration/goodbye.json diff --git a/languages/en-US/administration/selectroles.json b/src/languages/en-US/administration/selectroles.json similarity index 100% rename from languages/en-US/administration/selectroles.json rename to src/languages/en-US/administration/selectroles.json diff --git a/languages/en-US/administration/set.json b/src/languages/en-US/administration/set.json similarity index 100% rename from languages/en-US/administration/set.json rename to src/languages/en-US/administration/set.json diff --git a/languages/en-US/administration/setlang.json b/src/languages/en-US/administration/setlang.json similarity index 100% rename from languages/en-US/administration/setlang.json rename to src/languages/en-US/administration/setlang.json diff --git a/languages/en-US/administration/stealemoji.json b/src/languages/en-US/administration/stealemoji.json similarity index 100% rename from languages/en-US/administration/stealemoji.json rename to src/languages/en-US/administration/stealemoji.json diff --git a/languages/en-US/administration/welcome.json b/src/languages/en-US/administration/welcome.json similarity index 100% rename from languages/en-US/administration/welcome.json rename to src/languages/en-US/administration/welcome.json diff --git a/languages/en-US/beatrun/courses.json b/src/languages/en-US/beatrun/courses.json similarity index 100% rename from languages/en-US/beatrun/courses.json rename to src/languages/en-US/beatrun/courses.json diff --git a/languages/en-US/common.json b/src/languages/en-US/common.json similarity index 100% rename from languages/en-US/common.json rename to src/languages/en-US/common.json diff --git a/languages/en-US/economy/achievements.json b/src/languages/en-US/economy/achievements.json similarity index 100% rename from languages/en-US/economy/achievements.json rename to src/languages/en-US/economy/achievements.json diff --git a/languages/en-US/economy/bank.json b/src/languages/en-US/economy/bank.json similarity index 100% rename from languages/en-US/economy/bank.json rename to src/languages/en-US/economy/bank.json diff --git a/languages/en-US/economy/birthdate.json b/src/languages/en-US/economy/birthdate.json similarity index 100% rename from languages/en-US/economy/birthdate.json rename to src/languages/en-US/economy/birthdate.json diff --git a/languages/en-US/economy/divorce.json b/src/languages/en-US/economy/divorce.json similarity index 100% rename from languages/en-US/economy/divorce.json rename to src/languages/en-US/economy/divorce.json diff --git a/languages/en-US/economy/importmee6.json b/src/languages/en-US/economy/importmee6.json similarity index 100% rename from languages/en-US/economy/importmee6.json rename to src/languages/en-US/economy/importmee6.json diff --git a/languages/en-US/economy/leaderboard.json b/src/languages/en-US/economy/leaderboard.json similarity index 100% rename from languages/en-US/economy/leaderboard.json rename to src/languages/en-US/economy/leaderboard.json diff --git a/languages/en-US/economy/marry.json b/src/languages/en-US/economy/marry.json similarity index 100% rename from languages/en-US/economy/marry.json rename to src/languages/en-US/economy/marry.json diff --git a/languages/en-US/economy/money.json b/src/languages/en-US/economy/money.json similarity index 100% rename from languages/en-US/economy/money.json rename to src/languages/en-US/economy/money.json diff --git a/languages/en-US/economy/pay.json b/src/languages/en-US/economy/pay.json similarity index 100% rename from languages/en-US/economy/pay.json rename to src/languages/en-US/economy/pay.json diff --git a/languages/en-US/economy/profile.json b/src/languages/en-US/economy/profile.json similarity index 100% rename from languages/en-US/economy/profile.json rename to src/languages/en-US/economy/profile.json diff --git a/languages/en-US/economy/rep.json b/src/languages/en-US/economy/rep.json similarity index 100% rename from languages/en-US/economy/rep.json rename to src/languages/en-US/economy/rep.json diff --git a/languages/en-US/economy/rob.json b/src/languages/en-US/economy/rob.json similarity index 100% rename from languages/en-US/economy/rob.json rename to src/languages/en-US/economy/rob.json diff --git a/languages/en-US/economy/setbio.json b/src/languages/en-US/economy/setbio.json similarity index 100% rename from languages/en-US/economy/setbio.json rename to src/languages/en-US/economy/setbio.json diff --git a/languages/en-US/economy/slots.json b/src/languages/en-US/economy/slots.json similarity index 100% rename from languages/en-US/economy/slots.json rename to src/languages/en-US/economy/slots.json diff --git a/languages/en-US/economy/transactions.json b/src/languages/en-US/economy/transactions.json similarity index 100% rename from languages/en-US/economy/transactions.json rename to src/languages/en-US/economy/transactions.json diff --git a/languages/en-US/economy/work.json b/src/languages/en-US/economy/work.json similarity index 100% rename from languages/en-US/economy/work.json rename to src/languages/en-US/economy/work.json diff --git a/languages/en-US/fun/8ball.json b/src/languages/en-US/fun/8ball.json similarity index 100% rename from languages/en-US/fun/8ball.json rename to src/languages/en-US/fun/8ball.json diff --git a/languages/en-US/fun/cat.json b/src/languages/en-US/fun/cat.json similarity index 100% rename from languages/en-US/fun/cat.json rename to src/languages/en-US/fun/cat.json diff --git a/languages/en-US/fun/dog.json b/src/languages/en-US/fun/dog.json similarity index 100% rename from languages/en-US/fun/dog.json rename to src/languages/en-US/fun/dog.json diff --git a/languages/en-US/fun/lmgtfy.json b/src/languages/en-US/fun/lmgtfy.json similarity index 100% rename from languages/en-US/fun/lmgtfy.json rename to src/languages/en-US/fun/lmgtfy.json diff --git a/languages/en-US/fun/lovecalc.json b/src/languages/en-US/fun/lovecalc.json similarity index 100% rename from languages/en-US/fun/lovecalc.json rename to src/languages/en-US/fun/lovecalc.json diff --git a/languages/en-US/fun/memes.json b/src/languages/en-US/fun/memes.json similarity index 100% rename from languages/en-US/fun/memes.json rename to src/languages/en-US/fun/memes.json diff --git a/languages/en-US/fun/number.json b/src/languages/en-US/fun/number.json similarity index 100% rename from languages/en-US/fun/number.json rename to src/languages/en-US/fun/number.json diff --git a/languages/en-US/fun/tictactoe.json b/src/languages/en-US/fun/tictactoe.json similarity index 100% rename from languages/en-US/fun/tictactoe.json rename to src/languages/en-US/fun/tictactoe.json diff --git a/languages/en-US/general/afk.json b/src/languages/en-US/general/afk.json similarity index 100% rename from languages/en-US/general/afk.json rename to src/languages/en-US/general/afk.json diff --git a/languages/en-US/general/avatar.json b/src/languages/en-US/general/avatar.json similarity index 100% rename from languages/en-US/general/avatar.json rename to src/languages/en-US/general/avatar.json diff --git a/languages/en-US/general/boosters.json b/src/languages/en-US/general/boosters.json similarity index 100% rename from languages/en-US/general/boosters.json rename to src/languages/en-US/general/boosters.json diff --git a/languages/en-US/general/emoji.json b/src/languages/en-US/general/emoji.json similarity index 100% rename from languages/en-US/general/emoji.json rename to src/languages/en-US/general/emoji.json diff --git a/languages/en-US/general/help.json b/src/languages/en-US/general/help.json similarity index 100% rename from languages/en-US/general/help.json rename to src/languages/en-US/general/help.json diff --git a/languages/en-US/general/info.json b/src/languages/en-US/general/info.json similarity index 100% rename from languages/en-US/general/info.json rename to src/languages/en-US/general/info.json diff --git a/languages/en-US/general/minecraft.json b/src/languages/en-US/general/minecraft.json similarity index 100% rename from languages/en-US/general/minecraft.json rename to src/languages/en-US/general/minecraft.json diff --git a/languages/en-US/general/ping.json b/src/languages/en-US/general/ping.json similarity index 100% rename from languages/en-US/general/ping.json rename to src/languages/en-US/general/ping.json diff --git a/languages/en-US/general/remindme.json b/src/languages/en-US/general/remindme.json similarity index 100% rename from languages/en-US/general/remindme.json rename to src/languages/en-US/general/remindme.json diff --git a/languages/en-US/general/reminds.json b/src/languages/en-US/general/reminds.json similarity index 100% rename from languages/en-US/general/reminds.json rename to src/languages/en-US/general/reminds.json diff --git a/languages/en-US/general/report.json b/src/languages/en-US/general/report.json similarity index 100% rename from languages/en-US/general/report.json rename to src/languages/en-US/general/report.json diff --git a/languages/en-US/general/shorturl.json b/src/languages/en-US/general/shorturl.json similarity index 100% rename from languages/en-US/general/shorturl.json rename to src/languages/en-US/general/shorturl.json diff --git a/languages/en-US/general/staff.json b/src/languages/en-US/general/staff.json similarity index 100% rename from languages/en-US/general/staff.json rename to src/languages/en-US/general/staff.json diff --git a/languages/en-US/general/stats.json b/src/languages/en-US/general/stats.json similarity index 100% rename from languages/en-US/general/stats.json rename to src/languages/en-US/general/stats.json diff --git a/languages/en-US/general/suggest.json b/src/languages/en-US/general/suggest.json similarity index 100% rename from languages/en-US/general/suggest.json rename to src/languages/en-US/general/suggest.json diff --git a/languages/en-US/general/whois.json b/src/languages/en-US/general/whois.json similarity index 100% rename from languages/en-US/general/whois.json rename to src/languages/en-US/general/whois.json diff --git a/languages/en-US/iat/checkjar.json b/src/languages/en-US/iat/checkjar.json similarity index 100% rename from languages/en-US/iat/checkjar.json rename to src/languages/en-US/iat/checkjar.json diff --git a/languages/en-US/misc.json b/src/languages/en-US/misc.json similarity index 100% rename from languages/en-US/misc.json rename to src/languages/en-US/misc.json diff --git a/languages/en-US/moderation/ban.json b/src/languages/en-US/moderation/ban.json similarity index 100% rename from languages/en-US/moderation/ban.json rename to src/languages/en-US/moderation/ban.json diff --git a/languages/en-US/moderation/clear.json b/src/languages/en-US/moderation/clear.json similarity index 100% rename from languages/en-US/moderation/clear.json rename to src/languages/en-US/moderation/clear.json diff --git a/languages/en-US/moderation/clearwarns.json b/src/languages/en-US/moderation/clearwarns.json similarity index 100% rename from languages/en-US/moderation/clearwarns.json rename to src/languages/en-US/moderation/clearwarns.json diff --git a/languages/en-US/moderation/giveaway.json b/src/languages/en-US/moderation/giveaway.json similarity index 100% rename from languages/en-US/moderation/giveaway.json rename to src/languages/en-US/moderation/giveaway.json diff --git a/languages/en-US/moderation/kick.json b/src/languages/en-US/moderation/kick.json similarity index 100% rename from languages/en-US/moderation/kick.json rename to src/languages/en-US/moderation/kick.json diff --git a/languages/en-US/moderation/unban.json b/src/languages/en-US/moderation/unban.json similarity index 100% rename from languages/en-US/moderation/unban.json rename to src/languages/en-US/moderation/unban.json diff --git a/languages/en-US/moderation/untimeout.json b/src/languages/en-US/moderation/untimeout.json similarity index 100% rename from languages/en-US/moderation/untimeout.json rename to src/languages/en-US/moderation/untimeout.json diff --git a/languages/en-US/moderation/warn.json b/src/languages/en-US/moderation/warn.json similarity index 100% rename from languages/en-US/moderation/warn.json rename to src/languages/en-US/moderation/warn.json diff --git a/languages/en-US/moderation/warns.json b/src/languages/en-US/moderation/warns.json similarity index 100% rename from languages/en-US/moderation/warns.json rename to src/languages/en-US/moderation/warns.json diff --git a/languages/en-US/music/back.json b/src/languages/en-US/music/back.json similarity index 100% rename from languages/en-US/music/back.json rename to src/languages/en-US/music/back.json diff --git a/languages/en-US/music/clips.json b/src/languages/en-US/music/clips.json similarity index 100% rename from languages/en-US/music/clips.json rename to src/languages/en-US/music/clips.json diff --git a/languages/en-US/music/loop.json b/src/languages/en-US/music/loop.json similarity index 100% rename from languages/en-US/music/loop.json rename to src/languages/en-US/music/loop.json diff --git a/languages/en-US/music/nowplaying.json b/src/languages/en-US/music/nowplaying.json similarity index 100% rename from languages/en-US/music/nowplaying.json rename to src/languages/en-US/music/nowplaying.json diff --git a/languages/en-US/music/play.json b/src/languages/en-US/music/play.json similarity index 100% rename from languages/en-US/music/play.json rename to src/languages/en-US/music/play.json diff --git a/languages/en-US/music/queue.json b/src/languages/en-US/music/queue.json similarity index 100% rename from languages/en-US/music/queue.json rename to src/languages/en-US/music/queue.json diff --git a/languages/en-US/music/seek.json b/src/languages/en-US/music/seek.json similarity index 100% rename from languages/en-US/music/seek.json rename to src/languages/en-US/music/seek.json diff --git a/languages/en-US/music/shuffle.json b/src/languages/en-US/music/shuffle.json similarity index 100% rename from languages/en-US/music/shuffle.json rename to src/languages/en-US/music/shuffle.json diff --git a/languages/en-US/music/skip.json b/src/languages/en-US/music/skip.json similarity index 100% rename from languages/en-US/music/skip.json rename to src/languages/en-US/music/skip.json diff --git a/languages/en-US/music/stop.json b/src/languages/en-US/music/stop.json similarity index 100% rename from languages/en-US/music/stop.json rename to src/languages/en-US/music/stop.json diff --git a/languages/en-US/music/volume.json b/src/languages/en-US/music/volume.json similarity index 100% rename from languages/en-US/music/volume.json rename to src/languages/en-US/music/volume.json diff --git a/languages/en-US/owner/announcement.json b/src/languages/en-US/owner/announcement.json similarity index 100% rename from languages/en-US/owner/announcement.json rename to src/languages/en-US/owner/announcement.json diff --git a/languages/en-US/owner/debug.json b/src/languages/en-US/owner/debug.json similarity index 100% rename from languages/en-US/owner/debug.json rename to src/languages/en-US/owner/debug.json diff --git a/languages/en-US/owner/eval.json b/src/languages/en-US/owner/eval.json similarity index 100% rename from languages/en-US/owner/eval.json rename to src/languages/en-US/owner/eval.json diff --git a/languages/en-US/owner/reload.json b/src/languages/en-US/owner/reload.json similarity index 100% rename from languages/en-US/owner/reload.json rename to src/languages/en-US/owner/reload.json diff --git a/languages/en-US/owner/say.json b/src/languages/en-US/owner/say.json similarity index 100% rename from languages/en-US/owner/say.json rename to src/languages/en-US/owner/say.json diff --git a/languages/en-US/owner/servers.json b/src/languages/en-US/owner/servers.json similarity index 100% rename from languages/en-US/owner/servers.json rename to src/languages/en-US/owner/servers.json diff --git a/languages/en-US/tickets/adduser.json b/src/languages/en-US/tickets/adduser.json similarity index 100% rename from languages/en-US/tickets/adduser.json rename to src/languages/en-US/tickets/adduser.json diff --git a/languages/en-US/tickets/closeticket.json b/src/languages/en-US/tickets/closeticket.json similarity index 100% rename from languages/en-US/tickets/closeticket.json rename to src/languages/en-US/tickets/closeticket.json diff --git a/languages/en-US/tickets/createticketembed.json b/src/languages/en-US/tickets/createticketembed.json similarity index 100% rename from languages/en-US/tickets/createticketembed.json rename to src/languages/en-US/tickets/createticketembed.json diff --git a/languages/en-US/tickets/removeuser.json b/src/languages/en-US/tickets/removeuser.json similarity index 100% rename from languages/en-US/tickets/removeuser.json rename to src/languages/en-US/tickets/removeuser.json diff --git a/languages/language-meta.js b/src/languages/language-meta.js similarity index 100% rename from languages/language-meta.js rename to src/languages/language-meta.js diff --git a/languages/ru-RU/administration/addemoji.json b/src/languages/ru-RU/administration/addemoji.json similarity index 100% rename from languages/ru-RU/administration/addemoji.json rename to src/languages/ru-RU/administration/addemoji.json diff --git a/languages/ru-RU/administration/automod.json b/src/languages/ru-RU/administration/automod.json similarity index 100% rename from languages/ru-RU/administration/automod.json rename to src/languages/ru-RU/administration/automod.json diff --git a/languages/ru-RU/administration/autorole.json b/src/languages/ru-RU/administration/autorole.json similarity index 100% rename from languages/ru-RU/administration/autorole.json rename to src/languages/ru-RU/administration/autorole.json diff --git a/languages/ru-RU/administration/config.json b/src/languages/ru-RU/administration/config.json similarity index 100% rename from languages/ru-RU/administration/config.json rename to src/languages/ru-RU/administration/config.json diff --git a/languages/ru-RU/administration/deletemod.json b/src/languages/ru-RU/administration/deletemod.json similarity index 100% rename from languages/ru-RU/administration/deletemod.json rename to src/languages/ru-RU/administration/deletemod.json diff --git a/languages/ru-RU/administration/goodbye.json b/src/languages/ru-RU/administration/goodbye.json similarity index 100% rename from languages/ru-RU/administration/goodbye.json rename to src/languages/ru-RU/administration/goodbye.json diff --git a/languages/ru-RU/administration/selectroles.json b/src/languages/ru-RU/administration/selectroles.json similarity index 100% rename from languages/ru-RU/administration/selectroles.json rename to src/languages/ru-RU/administration/selectroles.json diff --git a/languages/ru-RU/administration/set.json b/src/languages/ru-RU/administration/set.json similarity index 100% rename from languages/ru-RU/administration/set.json rename to src/languages/ru-RU/administration/set.json diff --git a/languages/ru-RU/administration/setlang.json b/src/languages/ru-RU/administration/setlang.json similarity index 100% rename from languages/ru-RU/administration/setlang.json rename to src/languages/ru-RU/administration/setlang.json diff --git a/languages/ru-RU/administration/stealemoji.json b/src/languages/ru-RU/administration/stealemoji.json similarity index 100% rename from languages/ru-RU/administration/stealemoji.json rename to src/languages/ru-RU/administration/stealemoji.json diff --git a/languages/ru-RU/administration/welcome.json b/src/languages/ru-RU/administration/welcome.json similarity index 100% rename from languages/ru-RU/administration/welcome.json rename to src/languages/ru-RU/administration/welcome.json diff --git a/languages/ru-RU/beatrun/courses.json b/src/languages/ru-RU/beatrun/courses.json similarity index 100% rename from languages/ru-RU/beatrun/courses.json rename to src/languages/ru-RU/beatrun/courses.json diff --git a/languages/ru-RU/common.json b/src/languages/ru-RU/common.json similarity index 100% rename from languages/ru-RU/common.json rename to src/languages/ru-RU/common.json diff --git a/languages/ru-RU/economy/achievements.json b/src/languages/ru-RU/economy/achievements.json similarity index 100% rename from languages/ru-RU/economy/achievements.json rename to src/languages/ru-RU/economy/achievements.json diff --git a/languages/ru-RU/economy/bank.json b/src/languages/ru-RU/economy/bank.json similarity index 100% rename from languages/ru-RU/economy/bank.json rename to src/languages/ru-RU/economy/bank.json diff --git a/languages/ru-RU/economy/birthdate.json b/src/languages/ru-RU/economy/birthdate.json similarity index 100% rename from languages/ru-RU/economy/birthdate.json rename to src/languages/ru-RU/economy/birthdate.json diff --git a/languages/ru-RU/economy/divorce.json b/src/languages/ru-RU/economy/divorce.json similarity index 100% rename from languages/ru-RU/economy/divorce.json rename to src/languages/ru-RU/economy/divorce.json diff --git a/languages/ru-RU/economy/importmee6.json b/src/languages/ru-RU/economy/importmee6.json similarity index 100% rename from languages/ru-RU/economy/importmee6.json rename to src/languages/ru-RU/economy/importmee6.json diff --git a/languages/ru-RU/economy/leaderboard.json b/src/languages/ru-RU/economy/leaderboard.json similarity index 100% rename from languages/ru-RU/economy/leaderboard.json rename to src/languages/ru-RU/economy/leaderboard.json diff --git a/languages/ru-RU/economy/marry.json b/src/languages/ru-RU/economy/marry.json similarity index 100% rename from languages/ru-RU/economy/marry.json rename to src/languages/ru-RU/economy/marry.json diff --git a/languages/ru-RU/economy/money.json b/src/languages/ru-RU/economy/money.json similarity index 100% rename from languages/ru-RU/economy/money.json rename to src/languages/ru-RU/economy/money.json diff --git a/languages/ru-RU/economy/pay.json b/src/languages/ru-RU/economy/pay.json similarity index 100% rename from languages/ru-RU/economy/pay.json rename to src/languages/ru-RU/economy/pay.json diff --git a/languages/ru-RU/economy/profile.json b/src/languages/ru-RU/economy/profile.json similarity index 100% rename from languages/ru-RU/economy/profile.json rename to src/languages/ru-RU/economy/profile.json diff --git a/languages/ru-RU/economy/rep.json b/src/languages/ru-RU/economy/rep.json similarity index 100% rename from languages/ru-RU/economy/rep.json rename to src/languages/ru-RU/economy/rep.json diff --git a/languages/ru-RU/economy/rob.json b/src/languages/ru-RU/economy/rob.json similarity index 100% rename from languages/ru-RU/economy/rob.json rename to src/languages/ru-RU/economy/rob.json diff --git a/languages/ru-RU/economy/setbio.json b/src/languages/ru-RU/economy/setbio.json similarity index 100% rename from languages/ru-RU/economy/setbio.json rename to src/languages/ru-RU/economy/setbio.json diff --git a/languages/ru-RU/economy/slots.json b/src/languages/ru-RU/economy/slots.json similarity index 100% rename from languages/ru-RU/economy/slots.json rename to src/languages/ru-RU/economy/slots.json diff --git a/languages/ru-RU/economy/transactions.json b/src/languages/ru-RU/economy/transactions.json similarity index 100% rename from languages/ru-RU/economy/transactions.json rename to src/languages/ru-RU/economy/transactions.json diff --git a/languages/ru-RU/economy/work.json b/src/languages/ru-RU/economy/work.json similarity index 100% rename from languages/ru-RU/economy/work.json rename to src/languages/ru-RU/economy/work.json diff --git a/languages/ru-RU/fun/8ball.json b/src/languages/ru-RU/fun/8ball.json similarity index 100% rename from languages/ru-RU/fun/8ball.json rename to src/languages/ru-RU/fun/8ball.json diff --git a/languages/ru-RU/fun/cat.json b/src/languages/ru-RU/fun/cat.json similarity index 100% rename from languages/ru-RU/fun/cat.json rename to src/languages/ru-RU/fun/cat.json diff --git a/languages/ru-RU/fun/dog.json b/src/languages/ru-RU/fun/dog.json similarity index 100% rename from languages/ru-RU/fun/dog.json rename to src/languages/ru-RU/fun/dog.json diff --git a/languages/ru-RU/fun/lmgtfy.json b/src/languages/ru-RU/fun/lmgtfy.json similarity index 100% rename from languages/ru-RU/fun/lmgtfy.json rename to src/languages/ru-RU/fun/lmgtfy.json diff --git a/languages/ru-RU/fun/lovecalc.json b/src/languages/ru-RU/fun/lovecalc.json similarity index 100% rename from languages/ru-RU/fun/lovecalc.json rename to src/languages/ru-RU/fun/lovecalc.json diff --git a/languages/ru-RU/fun/memes.json b/src/languages/ru-RU/fun/memes.json similarity index 100% rename from languages/ru-RU/fun/memes.json rename to src/languages/ru-RU/fun/memes.json diff --git a/languages/ru-RU/fun/number.json b/src/languages/ru-RU/fun/number.json similarity index 100% rename from languages/ru-RU/fun/number.json rename to src/languages/ru-RU/fun/number.json diff --git a/languages/ru-RU/fun/tictactoe.json b/src/languages/ru-RU/fun/tictactoe.json similarity index 100% rename from languages/ru-RU/fun/tictactoe.json rename to src/languages/ru-RU/fun/tictactoe.json diff --git a/languages/ru-RU/general/afk.json b/src/languages/ru-RU/general/afk.json similarity index 100% rename from languages/ru-RU/general/afk.json rename to src/languages/ru-RU/general/afk.json diff --git a/languages/ru-RU/general/avatar.json b/src/languages/ru-RU/general/avatar.json similarity index 100% rename from languages/ru-RU/general/avatar.json rename to src/languages/ru-RU/general/avatar.json diff --git a/languages/ru-RU/general/boosters.json b/src/languages/ru-RU/general/boosters.json similarity index 100% rename from languages/ru-RU/general/boosters.json rename to src/languages/ru-RU/general/boosters.json diff --git a/languages/ru-RU/general/emoji.json b/src/languages/ru-RU/general/emoji.json similarity index 100% rename from languages/ru-RU/general/emoji.json rename to src/languages/ru-RU/general/emoji.json diff --git a/languages/ru-RU/general/help.json b/src/languages/ru-RU/general/help.json similarity index 100% rename from languages/ru-RU/general/help.json rename to src/languages/ru-RU/general/help.json diff --git a/languages/ru-RU/general/info.json b/src/languages/ru-RU/general/info.json similarity index 100% rename from languages/ru-RU/general/info.json rename to src/languages/ru-RU/general/info.json diff --git a/languages/ru-RU/general/minecraft.json b/src/languages/ru-RU/general/minecraft.json similarity index 100% rename from languages/ru-RU/general/minecraft.json rename to src/languages/ru-RU/general/minecraft.json diff --git a/languages/ru-RU/general/ping.json b/src/languages/ru-RU/general/ping.json similarity index 100% rename from languages/ru-RU/general/ping.json rename to src/languages/ru-RU/general/ping.json diff --git a/languages/ru-RU/general/remindme.json b/src/languages/ru-RU/general/remindme.json similarity index 100% rename from languages/ru-RU/general/remindme.json rename to src/languages/ru-RU/general/remindme.json diff --git a/languages/ru-RU/general/reminds.json b/src/languages/ru-RU/general/reminds.json similarity index 100% rename from languages/ru-RU/general/reminds.json rename to src/languages/ru-RU/general/reminds.json diff --git a/languages/ru-RU/general/report.json b/src/languages/ru-RU/general/report.json similarity index 100% rename from languages/ru-RU/general/report.json rename to src/languages/ru-RU/general/report.json diff --git a/languages/ru-RU/general/shorturl.json b/src/languages/ru-RU/general/shorturl.json similarity index 100% rename from languages/ru-RU/general/shorturl.json rename to src/languages/ru-RU/general/shorturl.json diff --git a/languages/ru-RU/general/staff.json b/src/languages/ru-RU/general/staff.json similarity index 100% rename from languages/ru-RU/general/staff.json rename to src/languages/ru-RU/general/staff.json diff --git a/languages/ru-RU/general/stats.json b/src/languages/ru-RU/general/stats.json similarity index 100% rename from languages/ru-RU/general/stats.json rename to src/languages/ru-RU/general/stats.json diff --git a/languages/ru-RU/general/suggest.json b/src/languages/ru-RU/general/suggest.json similarity index 100% rename from languages/ru-RU/general/suggest.json rename to src/languages/ru-RU/general/suggest.json diff --git a/languages/ru-RU/general/whois.json b/src/languages/ru-RU/general/whois.json similarity index 100% rename from languages/ru-RU/general/whois.json rename to src/languages/ru-RU/general/whois.json diff --git a/languages/ru-RU/iat/checkjar.json b/src/languages/ru-RU/iat/checkjar.json similarity index 100% rename from languages/ru-RU/iat/checkjar.json rename to src/languages/ru-RU/iat/checkjar.json diff --git a/languages/ru-RU/misc.json b/src/languages/ru-RU/misc.json similarity index 100% rename from languages/ru-RU/misc.json rename to src/languages/ru-RU/misc.json diff --git a/languages/ru-RU/moderation/ban.json b/src/languages/ru-RU/moderation/ban.json similarity index 100% rename from languages/ru-RU/moderation/ban.json rename to src/languages/ru-RU/moderation/ban.json diff --git a/languages/ru-RU/moderation/clear.json b/src/languages/ru-RU/moderation/clear.json similarity index 100% rename from languages/ru-RU/moderation/clear.json rename to src/languages/ru-RU/moderation/clear.json diff --git a/languages/ru-RU/moderation/clearwarns.json b/src/languages/ru-RU/moderation/clearwarns.json similarity index 100% rename from languages/ru-RU/moderation/clearwarns.json rename to src/languages/ru-RU/moderation/clearwarns.json diff --git a/languages/ru-RU/moderation/giveaway.json b/src/languages/ru-RU/moderation/giveaway.json similarity index 100% rename from languages/ru-RU/moderation/giveaway.json rename to src/languages/ru-RU/moderation/giveaway.json diff --git a/languages/ru-RU/moderation/kick.json b/src/languages/ru-RU/moderation/kick.json similarity index 100% rename from languages/ru-RU/moderation/kick.json rename to src/languages/ru-RU/moderation/kick.json diff --git a/languages/ru-RU/moderation/unban.json b/src/languages/ru-RU/moderation/unban.json similarity index 100% rename from languages/ru-RU/moderation/unban.json rename to src/languages/ru-RU/moderation/unban.json diff --git a/languages/ru-RU/moderation/untimeout.json b/src/languages/ru-RU/moderation/untimeout.json similarity index 100% rename from languages/ru-RU/moderation/untimeout.json rename to src/languages/ru-RU/moderation/untimeout.json diff --git a/languages/ru-RU/moderation/warn.json b/src/languages/ru-RU/moderation/warn.json similarity index 100% rename from languages/ru-RU/moderation/warn.json rename to src/languages/ru-RU/moderation/warn.json diff --git a/languages/ru-RU/moderation/warns.json b/src/languages/ru-RU/moderation/warns.json similarity index 100% rename from languages/ru-RU/moderation/warns.json rename to src/languages/ru-RU/moderation/warns.json diff --git a/languages/ru-RU/music/back.json b/src/languages/ru-RU/music/back.json similarity index 100% rename from languages/ru-RU/music/back.json rename to src/languages/ru-RU/music/back.json diff --git a/languages/ru-RU/music/clips.json b/src/languages/ru-RU/music/clips.json similarity index 100% rename from languages/ru-RU/music/clips.json rename to src/languages/ru-RU/music/clips.json diff --git a/languages/ru-RU/music/loop.json b/src/languages/ru-RU/music/loop.json similarity index 100% rename from languages/ru-RU/music/loop.json rename to src/languages/ru-RU/music/loop.json diff --git a/languages/ru-RU/music/nowplaying.json b/src/languages/ru-RU/music/nowplaying.json similarity index 100% rename from languages/ru-RU/music/nowplaying.json rename to src/languages/ru-RU/music/nowplaying.json diff --git a/languages/ru-RU/music/play.json b/src/languages/ru-RU/music/play.json similarity index 100% rename from languages/ru-RU/music/play.json rename to src/languages/ru-RU/music/play.json diff --git a/languages/ru-RU/music/queue.json b/src/languages/ru-RU/music/queue.json similarity index 100% rename from languages/ru-RU/music/queue.json rename to src/languages/ru-RU/music/queue.json diff --git a/languages/ru-RU/music/seek.json b/src/languages/ru-RU/music/seek.json similarity index 100% rename from languages/ru-RU/music/seek.json rename to src/languages/ru-RU/music/seek.json diff --git a/languages/ru-RU/music/shuffle.json b/src/languages/ru-RU/music/shuffle.json similarity index 100% rename from languages/ru-RU/music/shuffle.json rename to src/languages/ru-RU/music/shuffle.json diff --git a/languages/ru-RU/music/skip.json b/src/languages/ru-RU/music/skip.json similarity index 100% rename from languages/ru-RU/music/skip.json rename to src/languages/ru-RU/music/skip.json diff --git a/languages/ru-RU/music/stop.json b/src/languages/ru-RU/music/stop.json similarity index 100% rename from languages/ru-RU/music/stop.json rename to src/languages/ru-RU/music/stop.json diff --git a/languages/ru-RU/music/volume.json b/src/languages/ru-RU/music/volume.json similarity index 100% rename from languages/ru-RU/music/volume.json rename to src/languages/ru-RU/music/volume.json diff --git a/languages/ru-RU/owner/announcement.json b/src/languages/ru-RU/owner/announcement.json similarity index 100% rename from languages/ru-RU/owner/announcement.json rename to src/languages/ru-RU/owner/announcement.json diff --git a/languages/ru-RU/owner/debug.json b/src/languages/ru-RU/owner/debug.json similarity index 100% rename from languages/ru-RU/owner/debug.json rename to src/languages/ru-RU/owner/debug.json diff --git a/languages/ru-RU/owner/eval.json b/src/languages/ru-RU/owner/eval.json similarity index 100% rename from languages/ru-RU/owner/eval.json rename to src/languages/ru-RU/owner/eval.json diff --git a/languages/ru-RU/owner/reload.json b/src/languages/ru-RU/owner/reload.json similarity index 100% rename from languages/ru-RU/owner/reload.json rename to src/languages/ru-RU/owner/reload.json diff --git a/languages/ru-RU/owner/say.json b/src/languages/ru-RU/owner/say.json similarity index 100% rename from languages/ru-RU/owner/say.json rename to src/languages/ru-RU/owner/say.json diff --git a/languages/ru-RU/owner/servers.json b/src/languages/ru-RU/owner/servers.json similarity index 100% rename from languages/ru-RU/owner/servers.json rename to src/languages/ru-RU/owner/servers.json diff --git a/languages/ru-RU/tickets/adduser.json b/src/languages/ru-RU/tickets/adduser.json similarity index 100% rename from languages/ru-RU/tickets/adduser.json rename to src/languages/ru-RU/tickets/adduser.json diff --git a/languages/ru-RU/tickets/closeticket.json b/src/languages/ru-RU/tickets/closeticket.json similarity index 100% rename from languages/ru-RU/tickets/closeticket.json rename to src/languages/ru-RU/tickets/closeticket.json diff --git a/languages/ru-RU/tickets/createticketembed.json b/src/languages/ru-RU/tickets/createticketembed.json similarity index 100% rename from languages/ru-RU/tickets/createticketembed.json rename to src/languages/ru-RU/tickets/createticketembed.json diff --git a/languages/ru-RU/tickets/removeuser.json b/src/languages/ru-RU/tickets/removeuser.json similarity index 100% rename from languages/ru-RU/tickets/removeuser.json rename to src/languages/ru-RU/tickets/removeuser.json diff --git a/languages/uk-UA/administration/addemoji.json b/src/languages/uk-UA/administration/addemoji.json similarity index 100% rename from languages/uk-UA/administration/addemoji.json rename to src/languages/uk-UA/administration/addemoji.json diff --git a/languages/uk-UA/administration/automod.json b/src/languages/uk-UA/administration/automod.json similarity index 100% rename from languages/uk-UA/administration/automod.json rename to src/languages/uk-UA/administration/automod.json diff --git a/languages/uk-UA/administration/autorole.json b/src/languages/uk-UA/administration/autorole.json similarity index 100% rename from languages/uk-UA/administration/autorole.json rename to src/languages/uk-UA/administration/autorole.json diff --git a/languages/uk-UA/administration/config.json b/src/languages/uk-UA/administration/config.json similarity index 100% rename from languages/uk-UA/administration/config.json rename to src/languages/uk-UA/administration/config.json diff --git a/languages/uk-UA/administration/deletemod.json b/src/languages/uk-UA/administration/deletemod.json similarity index 100% rename from languages/uk-UA/administration/deletemod.json rename to src/languages/uk-UA/administration/deletemod.json diff --git a/languages/uk-UA/administration/goodbye.json b/src/languages/uk-UA/administration/goodbye.json similarity index 100% rename from languages/uk-UA/administration/goodbye.json rename to src/languages/uk-UA/administration/goodbye.json diff --git a/languages/uk-UA/administration/selectroles.json b/src/languages/uk-UA/administration/selectroles.json similarity index 100% rename from languages/uk-UA/administration/selectroles.json rename to src/languages/uk-UA/administration/selectroles.json diff --git a/languages/uk-UA/administration/set.json b/src/languages/uk-UA/administration/set.json similarity index 100% rename from languages/uk-UA/administration/set.json rename to src/languages/uk-UA/administration/set.json diff --git a/languages/uk-UA/administration/setlang.json b/src/languages/uk-UA/administration/setlang.json similarity index 100% rename from languages/uk-UA/administration/setlang.json rename to src/languages/uk-UA/administration/setlang.json diff --git a/languages/uk-UA/administration/stealemoji.json b/src/languages/uk-UA/administration/stealemoji.json similarity index 100% rename from languages/uk-UA/administration/stealemoji.json rename to src/languages/uk-UA/administration/stealemoji.json diff --git a/languages/uk-UA/administration/welcome.json b/src/languages/uk-UA/administration/welcome.json similarity index 100% rename from languages/uk-UA/administration/welcome.json rename to src/languages/uk-UA/administration/welcome.json diff --git a/languages/uk-UA/beatrun/courses.json b/src/languages/uk-UA/beatrun/courses.json similarity index 100% rename from languages/uk-UA/beatrun/courses.json rename to src/languages/uk-UA/beatrun/courses.json diff --git a/languages/uk-UA/common.json b/src/languages/uk-UA/common.json similarity index 100% rename from languages/uk-UA/common.json rename to src/languages/uk-UA/common.json diff --git a/languages/uk-UA/economy/achievements.json b/src/languages/uk-UA/economy/achievements.json similarity index 100% rename from languages/uk-UA/economy/achievements.json rename to src/languages/uk-UA/economy/achievements.json diff --git a/languages/uk-UA/economy/bank.json b/src/languages/uk-UA/economy/bank.json similarity index 100% rename from languages/uk-UA/economy/bank.json rename to src/languages/uk-UA/economy/bank.json diff --git a/languages/uk-UA/economy/birthdate.json b/src/languages/uk-UA/economy/birthdate.json similarity index 100% rename from languages/uk-UA/economy/birthdate.json rename to src/languages/uk-UA/economy/birthdate.json diff --git a/languages/uk-UA/economy/divorce.json b/src/languages/uk-UA/economy/divorce.json similarity index 100% rename from languages/uk-UA/economy/divorce.json rename to src/languages/uk-UA/economy/divorce.json diff --git a/languages/uk-UA/economy/importmee6.json b/src/languages/uk-UA/economy/importmee6.json similarity index 100% rename from languages/uk-UA/economy/importmee6.json rename to src/languages/uk-UA/economy/importmee6.json diff --git a/languages/uk-UA/economy/leaderboard.json b/src/languages/uk-UA/economy/leaderboard.json similarity index 100% rename from languages/uk-UA/economy/leaderboard.json rename to src/languages/uk-UA/economy/leaderboard.json diff --git a/languages/uk-UA/economy/marry.json b/src/languages/uk-UA/economy/marry.json similarity index 100% rename from languages/uk-UA/economy/marry.json rename to src/languages/uk-UA/economy/marry.json diff --git a/languages/uk-UA/economy/money.json b/src/languages/uk-UA/economy/money.json similarity index 100% rename from languages/uk-UA/economy/money.json rename to src/languages/uk-UA/economy/money.json diff --git a/languages/uk-UA/economy/pay.json b/src/languages/uk-UA/economy/pay.json similarity index 100% rename from languages/uk-UA/economy/pay.json rename to src/languages/uk-UA/economy/pay.json diff --git a/languages/uk-UA/economy/profile.json b/src/languages/uk-UA/economy/profile.json similarity index 100% rename from languages/uk-UA/economy/profile.json rename to src/languages/uk-UA/economy/profile.json diff --git a/languages/uk-UA/economy/rep.json b/src/languages/uk-UA/economy/rep.json similarity index 100% rename from languages/uk-UA/economy/rep.json rename to src/languages/uk-UA/economy/rep.json diff --git a/languages/uk-UA/economy/rob.json b/src/languages/uk-UA/economy/rob.json similarity index 100% rename from languages/uk-UA/economy/rob.json rename to src/languages/uk-UA/economy/rob.json diff --git a/languages/uk-UA/economy/setbio.json b/src/languages/uk-UA/economy/setbio.json similarity index 100% rename from languages/uk-UA/economy/setbio.json rename to src/languages/uk-UA/economy/setbio.json diff --git a/languages/uk-UA/economy/slots.json b/src/languages/uk-UA/economy/slots.json similarity index 100% rename from languages/uk-UA/economy/slots.json rename to src/languages/uk-UA/economy/slots.json diff --git a/languages/uk-UA/economy/transactions.json b/src/languages/uk-UA/economy/transactions.json similarity index 100% rename from languages/uk-UA/economy/transactions.json rename to src/languages/uk-UA/economy/transactions.json diff --git a/languages/uk-UA/economy/work.json b/src/languages/uk-UA/economy/work.json similarity index 100% rename from languages/uk-UA/economy/work.json rename to src/languages/uk-UA/economy/work.json diff --git a/languages/uk-UA/fun/8ball.json b/src/languages/uk-UA/fun/8ball.json similarity index 100% rename from languages/uk-UA/fun/8ball.json rename to src/languages/uk-UA/fun/8ball.json diff --git a/languages/uk-UA/fun/cat.json b/src/languages/uk-UA/fun/cat.json similarity index 100% rename from languages/uk-UA/fun/cat.json rename to src/languages/uk-UA/fun/cat.json diff --git a/languages/uk-UA/fun/dog.json b/src/languages/uk-UA/fun/dog.json similarity index 100% rename from languages/uk-UA/fun/dog.json rename to src/languages/uk-UA/fun/dog.json diff --git a/languages/uk-UA/fun/lmgtfy.json b/src/languages/uk-UA/fun/lmgtfy.json similarity index 100% rename from languages/uk-UA/fun/lmgtfy.json rename to src/languages/uk-UA/fun/lmgtfy.json diff --git a/languages/uk-UA/fun/lovecalc.json b/src/languages/uk-UA/fun/lovecalc.json similarity index 100% rename from languages/uk-UA/fun/lovecalc.json rename to src/languages/uk-UA/fun/lovecalc.json diff --git a/languages/uk-UA/fun/memes.json b/src/languages/uk-UA/fun/memes.json similarity index 100% rename from languages/uk-UA/fun/memes.json rename to src/languages/uk-UA/fun/memes.json diff --git a/languages/uk-UA/fun/number.json b/src/languages/uk-UA/fun/number.json similarity index 100% rename from languages/uk-UA/fun/number.json rename to src/languages/uk-UA/fun/number.json diff --git a/languages/uk-UA/fun/tictactoe.json b/src/languages/uk-UA/fun/tictactoe.json similarity index 100% rename from languages/uk-UA/fun/tictactoe.json rename to src/languages/uk-UA/fun/tictactoe.json diff --git a/languages/uk-UA/general/afk.json b/src/languages/uk-UA/general/afk.json similarity index 100% rename from languages/uk-UA/general/afk.json rename to src/languages/uk-UA/general/afk.json diff --git a/languages/uk-UA/general/avatar.json b/src/languages/uk-UA/general/avatar.json similarity index 100% rename from languages/uk-UA/general/avatar.json rename to src/languages/uk-UA/general/avatar.json diff --git a/languages/uk-UA/general/boosters.json b/src/languages/uk-UA/general/boosters.json similarity index 100% rename from languages/uk-UA/general/boosters.json rename to src/languages/uk-UA/general/boosters.json diff --git a/languages/uk-UA/general/emoji.json b/src/languages/uk-UA/general/emoji.json similarity index 100% rename from languages/uk-UA/general/emoji.json rename to src/languages/uk-UA/general/emoji.json diff --git a/languages/uk-UA/general/help.json b/src/languages/uk-UA/general/help.json similarity index 100% rename from languages/uk-UA/general/help.json rename to src/languages/uk-UA/general/help.json diff --git a/languages/uk-UA/general/info.json b/src/languages/uk-UA/general/info.json similarity index 100% rename from languages/uk-UA/general/info.json rename to src/languages/uk-UA/general/info.json diff --git a/languages/uk-UA/general/minecraft.json b/src/languages/uk-UA/general/minecraft.json similarity index 100% rename from languages/uk-UA/general/minecraft.json rename to src/languages/uk-UA/general/minecraft.json diff --git a/languages/uk-UA/general/ping.json b/src/languages/uk-UA/general/ping.json similarity index 100% rename from languages/uk-UA/general/ping.json rename to src/languages/uk-UA/general/ping.json diff --git a/languages/uk-UA/general/remindme.json b/src/languages/uk-UA/general/remindme.json similarity index 100% rename from languages/uk-UA/general/remindme.json rename to src/languages/uk-UA/general/remindme.json diff --git a/languages/uk-UA/general/reminds.json b/src/languages/uk-UA/general/reminds.json similarity index 100% rename from languages/uk-UA/general/reminds.json rename to src/languages/uk-UA/general/reminds.json diff --git a/languages/uk-UA/general/report.json b/src/languages/uk-UA/general/report.json similarity index 100% rename from languages/uk-UA/general/report.json rename to src/languages/uk-UA/general/report.json diff --git a/languages/uk-UA/general/shorturl.json b/src/languages/uk-UA/general/shorturl.json similarity index 100% rename from languages/uk-UA/general/shorturl.json rename to src/languages/uk-UA/general/shorturl.json diff --git a/languages/uk-UA/general/staff.json b/src/languages/uk-UA/general/staff.json similarity index 100% rename from languages/uk-UA/general/staff.json rename to src/languages/uk-UA/general/staff.json diff --git a/languages/uk-UA/general/stats.json b/src/languages/uk-UA/general/stats.json similarity index 100% rename from languages/uk-UA/general/stats.json rename to src/languages/uk-UA/general/stats.json diff --git a/languages/uk-UA/general/suggest.json b/src/languages/uk-UA/general/suggest.json similarity index 100% rename from languages/uk-UA/general/suggest.json rename to src/languages/uk-UA/general/suggest.json diff --git a/languages/uk-UA/general/whois.json b/src/languages/uk-UA/general/whois.json similarity index 100% rename from languages/uk-UA/general/whois.json rename to src/languages/uk-UA/general/whois.json diff --git a/languages/uk-UA/iat/checkjar.json b/src/languages/uk-UA/iat/checkjar.json similarity index 100% rename from languages/uk-UA/iat/checkjar.json rename to src/languages/uk-UA/iat/checkjar.json diff --git a/languages/uk-UA/misc.json b/src/languages/uk-UA/misc.json similarity index 100% rename from languages/uk-UA/misc.json rename to src/languages/uk-UA/misc.json diff --git a/languages/uk-UA/moderation/ban.json b/src/languages/uk-UA/moderation/ban.json similarity index 100% rename from languages/uk-UA/moderation/ban.json rename to src/languages/uk-UA/moderation/ban.json diff --git a/languages/uk-UA/moderation/clear.json b/src/languages/uk-UA/moderation/clear.json similarity index 100% rename from languages/uk-UA/moderation/clear.json rename to src/languages/uk-UA/moderation/clear.json diff --git a/languages/uk-UA/moderation/clearwarns.json b/src/languages/uk-UA/moderation/clearwarns.json similarity index 100% rename from languages/uk-UA/moderation/clearwarns.json rename to src/languages/uk-UA/moderation/clearwarns.json diff --git a/languages/uk-UA/moderation/giveaway.json b/src/languages/uk-UA/moderation/giveaway.json similarity index 100% rename from languages/uk-UA/moderation/giveaway.json rename to src/languages/uk-UA/moderation/giveaway.json diff --git a/languages/uk-UA/moderation/kick.json b/src/languages/uk-UA/moderation/kick.json similarity index 100% rename from languages/uk-UA/moderation/kick.json rename to src/languages/uk-UA/moderation/kick.json diff --git a/languages/uk-UA/moderation/unban.json b/src/languages/uk-UA/moderation/unban.json similarity index 100% rename from languages/uk-UA/moderation/unban.json rename to src/languages/uk-UA/moderation/unban.json diff --git a/languages/uk-UA/moderation/untimeout.json b/src/languages/uk-UA/moderation/untimeout.json similarity index 100% rename from languages/uk-UA/moderation/untimeout.json rename to src/languages/uk-UA/moderation/untimeout.json diff --git a/languages/uk-UA/moderation/warn.json b/src/languages/uk-UA/moderation/warn.json similarity index 100% rename from languages/uk-UA/moderation/warn.json rename to src/languages/uk-UA/moderation/warn.json diff --git a/languages/uk-UA/moderation/warns.json b/src/languages/uk-UA/moderation/warns.json similarity index 100% rename from languages/uk-UA/moderation/warns.json rename to src/languages/uk-UA/moderation/warns.json diff --git a/languages/uk-UA/music/back.json b/src/languages/uk-UA/music/back.json similarity index 100% rename from languages/uk-UA/music/back.json rename to src/languages/uk-UA/music/back.json diff --git a/languages/uk-UA/music/clips.json b/src/languages/uk-UA/music/clips.json similarity index 100% rename from languages/uk-UA/music/clips.json rename to src/languages/uk-UA/music/clips.json diff --git a/languages/uk-UA/music/loop.json b/src/languages/uk-UA/music/loop.json similarity index 100% rename from languages/uk-UA/music/loop.json rename to src/languages/uk-UA/music/loop.json diff --git a/languages/uk-UA/music/nowplaying.json b/src/languages/uk-UA/music/nowplaying.json similarity index 100% rename from languages/uk-UA/music/nowplaying.json rename to src/languages/uk-UA/music/nowplaying.json diff --git a/languages/uk-UA/music/play.json b/src/languages/uk-UA/music/play.json similarity index 100% rename from languages/uk-UA/music/play.json rename to src/languages/uk-UA/music/play.json diff --git a/languages/uk-UA/music/queue.json b/src/languages/uk-UA/music/queue.json similarity index 100% rename from languages/uk-UA/music/queue.json rename to src/languages/uk-UA/music/queue.json diff --git a/languages/uk-UA/music/seek.json b/src/languages/uk-UA/music/seek.json similarity index 100% rename from languages/uk-UA/music/seek.json rename to src/languages/uk-UA/music/seek.json diff --git a/languages/uk-UA/music/shuffle.json b/src/languages/uk-UA/music/shuffle.json similarity index 100% rename from languages/uk-UA/music/shuffle.json rename to src/languages/uk-UA/music/shuffle.json diff --git a/languages/uk-UA/music/skip.json b/src/languages/uk-UA/music/skip.json similarity index 100% rename from languages/uk-UA/music/skip.json rename to src/languages/uk-UA/music/skip.json diff --git a/languages/uk-UA/music/stop.json b/src/languages/uk-UA/music/stop.json similarity index 100% rename from languages/uk-UA/music/stop.json rename to src/languages/uk-UA/music/stop.json diff --git a/languages/uk-UA/music/volume.json b/src/languages/uk-UA/music/volume.json similarity index 100% rename from languages/uk-UA/music/volume.json rename to src/languages/uk-UA/music/volume.json diff --git a/languages/uk-UA/owner/announcement.json b/src/languages/uk-UA/owner/announcement.json similarity index 100% rename from languages/uk-UA/owner/announcement.json rename to src/languages/uk-UA/owner/announcement.json diff --git a/languages/uk-UA/owner/debug.json b/src/languages/uk-UA/owner/debug.json similarity index 100% rename from languages/uk-UA/owner/debug.json rename to src/languages/uk-UA/owner/debug.json diff --git a/languages/uk-UA/owner/eval.json b/src/languages/uk-UA/owner/eval.json similarity index 100% rename from languages/uk-UA/owner/eval.json rename to src/languages/uk-UA/owner/eval.json diff --git a/languages/uk-UA/owner/reload.json b/src/languages/uk-UA/owner/reload.json similarity index 100% rename from languages/uk-UA/owner/reload.json rename to src/languages/uk-UA/owner/reload.json diff --git a/languages/uk-UA/owner/say.json b/src/languages/uk-UA/owner/say.json similarity index 100% rename from languages/uk-UA/owner/say.json rename to src/languages/uk-UA/owner/say.json diff --git a/languages/uk-UA/owner/servers.json b/src/languages/uk-UA/owner/servers.json similarity index 100% rename from languages/uk-UA/owner/servers.json rename to src/languages/uk-UA/owner/servers.json diff --git a/languages/uk-UA/tickets/adduser.json b/src/languages/uk-UA/tickets/adduser.json similarity index 100% rename from languages/uk-UA/tickets/adduser.json rename to src/languages/uk-UA/tickets/adduser.json diff --git a/languages/uk-UA/tickets/closeticket.json b/src/languages/uk-UA/tickets/closeticket.json similarity index 100% rename from languages/uk-UA/tickets/closeticket.json rename to src/languages/uk-UA/tickets/closeticket.json diff --git a/languages/uk-UA/tickets/createticketembed.json b/src/languages/uk-UA/tickets/createticketembed.json similarity index 100% rename from languages/uk-UA/tickets/createticketembed.json rename to src/languages/uk-UA/tickets/createticketembed.json diff --git a/languages/uk-UA/tickets/removeuser.json b/src/languages/uk-UA/tickets/removeuser.json similarity index 100% rename from languages/uk-UA/tickets/removeuser.json rename to src/languages/uk-UA/tickets/removeuser.json diff --git a/base/Guild.js b/src/models/GuildModel.js similarity index 100% rename from base/Guild.js rename to src/models/GuildModel.js diff --git a/base/Member.js b/src/models/MemberModel.js similarity index 100% rename from base/Member.js rename to src/models/MemberModel.js diff --git a/base/User.js b/src/models/UserModel.js similarity index 100% rename from base/User.js rename to src/models/UserModel.js diff --git a/newCommands/Fun/8ball.js b/src/newCommands/Fun/8ball.js similarity index 100% rename from newCommands/Fun/8ball.js rename to src/newCommands/Fun/8ball.js diff --git a/newEvents/ready.js b/src/newEvents/ready.js similarity index 100% rename from newEvents/ready.js rename to src/newEvents/ready.js diff --git a/src/structures/client.js b/src/structures/client.js new file mode 100644 index 00000000..d614123d --- /dev/null +++ b/src/structures/client.js @@ -0,0 +1,28 @@ +import { Client } from "discord.js"; +import { config } from "../../config.js"; +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"; + +export class ExtendedClient extends Client { + /** + * @param {import("discord.js").ClientOptions} options + */ + constructor(options) { + super(options); + this.adapter = new MongooseAdapter(config.mongoDB); + } + + async init() { + try { + await this.adapter.connect(); + + return this.login(config.token) + .then(async () => await Promise.all([initCommands(), initEvents()])) + .catch(console.error); + } catch (error) { + logger.error(error); + } + } +} diff --git a/utils/get-path.js b/src/utils/get-path.js similarity index 65% rename from utils/get-path.js rename to src/utils/get-path.js index 800ce749..805847d7 100644 --- a/utils/get-path.js +++ b/src/utils/get-path.js @@ -1,12 +1,15 @@ 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 files = await fs.readdir(directory, { withFileTypes: true }); + 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); diff --git a/utils/resolve-file.js b/src/utils/resolve-file.js similarity index 63% rename from utils/resolve-file.js rename to src/utils/resolve-file.js index 58264449..4f2727d9 100644 --- a/utils/resolve-file.js +++ b/src/utils/resolve-file.js @@ -1,4 +1,5 @@ import path from "node:path"; +import { PROJECT_ROOT } from "../constants/index.js"; /** * Convert a local file path to a file URL. @@ -6,6 +7,6 @@ import path from "node:path"; * @returns {string} file URL */ export const toFileURL = filePath => { - const resolvedPath = path.resolve(filePath); + const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(PROJECT_ROOT, filePath); return "file://" + resolvedPath.replace(/\\\\|\\/g, "/"); }; From c0f14df72648d40e841fd35966737225225998dd Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 9 Dec 2024 13:40:16 +0300 Subject: [PATCH 15/37] refactor (languages): change dir structure, meta structure --- src/commands/Music/nowplaying.js | 2 +- .../languages/en-US/administration/addemoji.json | 0 .../languages/en-US/administration/automod.json | 0 .../languages/en-US/administration/autorole.json | 0 .../languages/en-US/administration/config.json | 0 .../languages/en-US/administration/deletemod.json | 0 .../languages/en-US/administration/goodbye.json | 0 .../languages/en-US/administration/selectroles.json | 0 .../languages/en-US/administration/set.json | 0 .../languages/en-US/administration/setlang.json | 0 .../languages/en-US/administration/stealemoji.json | 0 .../languages/en-US/administration/welcome.json | 0 .../languages/en-US/beatrun/courses.json | 0 src/{ => services}/languages/en-US/common.json | 0 .../languages/en-US/economy/achievements.json | 0 src/{ => services}/languages/en-US/economy/bank.json | 0 .../languages/en-US/economy/birthdate.json | 0 .../languages/en-US/economy/divorce.json | 0 .../languages/en-US/economy/importmee6.json | 0 .../languages/en-US/economy/leaderboard.json | 0 .../languages/en-US/economy/marry.json | 0 .../languages/en-US/economy/money.json | 0 src/{ => services}/languages/en-US/economy/pay.json | 0 .../languages/en-US/economy/profile.json | 0 src/{ => services}/languages/en-US/economy/rep.json | 0 src/{ => services}/languages/en-US/economy/rob.json | 0 .../languages/en-US/economy/setbio.json | 0 .../languages/en-US/economy/slots.json | 0 .../languages/en-US/economy/transactions.json | 0 src/{ => services}/languages/en-US/economy/work.json | 0 src/{ => services}/languages/en-US/fun/8ball.json | 0 src/{ => services}/languages/en-US/fun/cat.json | 0 src/{ => services}/languages/en-US/fun/dog.json | 0 src/{ => services}/languages/en-US/fun/lmgtfy.json | 0 src/{ => services}/languages/en-US/fun/lovecalc.json | 0 src/{ => services}/languages/en-US/fun/memes.json | 0 src/{ => services}/languages/en-US/fun/number.json | 0 .../languages/en-US/fun/tictactoe.json | 0 src/{ => services}/languages/en-US/general/afk.json | 0 .../languages/en-US/general/avatar.json | 0 .../languages/en-US/general/boosters.json | 0 .../languages/en-US/general/emoji.json | 0 src/{ => services}/languages/en-US/general/help.json | 0 src/{ => services}/languages/en-US/general/info.json | 0 .../languages/en-US/general/minecraft.json | 0 src/{ => services}/languages/en-US/general/ping.json | 0 .../languages/en-US/general/remindme.json | 0 .../languages/en-US/general/reminds.json | 0 .../languages/en-US/general/report.json | 0 .../languages/en-US/general/shorturl.json | 0 .../languages/en-US/general/staff.json | 0 .../languages/en-US/general/stats.json | 0 .../languages/en-US/general/suggest.json | 0 .../languages/en-US/general/whois.json | 0 src/{ => services}/languages/en-US/iat/checkjar.json | 0 src/{ => services}/languages/en-US/misc.json | 0 .../languages/en-US/moderation/ban.json | 0 .../languages/en-US/moderation/clear.json | 0 .../languages/en-US/moderation/clearwarns.json | 0 .../languages/en-US/moderation/giveaway.json | 0 .../languages/en-US/moderation/kick.json | 0 .../languages/en-US/moderation/unban.json | 0 .../languages/en-US/moderation/untimeout.json | 0 .../languages/en-US/moderation/warn.json | 0 .../languages/en-US/moderation/warns.json | 0 src/{ => services}/languages/en-US/music/back.json | 0 src/{ => services}/languages/en-US/music/clips.json | 0 src/{ => services}/languages/en-US/music/loop.json | 0 .../languages/en-US/music/nowplaying.json | 0 src/{ => services}/languages/en-US/music/play.json | 0 src/{ => services}/languages/en-US/music/queue.json | 0 src/{ => services}/languages/en-US/music/seek.json | 0 .../languages/en-US/music/shuffle.json | 0 src/{ => services}/languages/en-US/music/skip.json | 0 src/{ => services}/languages/en-US/music/stop.json | 0 src/{ => services}/languages/en-US/music/volume.json | 0 .../languages/en-US/owner/announcement.json | 0 src/{ => services}/languages/en-US/owner/debug.json | 0 src/{ => services}/languages/en-US/owner/eval.json | 0 src/{ => services}/languages/en-US/owner/reload.json | 0 src/{ => services}/languages/en-US/owner/say.json | 0 .../languages/en-US/owner/servers.json | 0 .../languages/en-US/tickets/adduser.json | 0 .../languages/en-US/tickets/closeticket.json | 0 .../languages/en-US/tickets/createticketembed.json | 0 .../languages/en-US/tickets/removeuser.json | 0 src/{ => services}/languages/language-meta.js | 12 ++++++------ .../languages/ru-RU/administration/addemoji.json | 0 .../languages/ru-RU/administration/automod.json | 0 .../languages/ru-RU/administration/autorole.json | 0 .../languages/ru-RU/administration/config.json | 0 .../languages/ru-RU/administration/deletemod.json | 0 .../languages/ru-RU/administration/goodbye.json | 0 .../languages/ru-RU/administration/selectroles.json | 0 .../languages/ru-RU/administration/set.json | 0 .../languages/ru-RU/administration/setlang.json | 0 .../languages/ru-RU/administration/stealemoji.json | 0 .../languages/ru-RU/administration/welcome.json | 0 .../languages/ru-RU/beatrun/courses.json | 0 src/{ => services}/languages/ru-RU/common.json | 0 .../languages/ru-RU/economy/achievements.json | 0 src/{ => services}/languages/ru-RU/economy/bank.json | 0 .../languages/ru-RU/economy/birthdate.json | 0 .../languages/ru-RU/economy/divorce.json | 0 .../languages/ru-RU/economy/importmee6.json | 0 .../languages/ru-RU/economy/leaderboard.json | 0 .../languages/ru-RU/economy/marry.json | 0 .../languages/ru-RU/economy/money.json | 0 src/{ => services}/languages/ru-RU/economy/pay.json | 0 .../languages/ru-RU/economy/profile.json | 0 src/{ => services}/languages/ru-RU/economy/rep.json | 0 src/{ => services}/languages/ru-RU/economy/rob.json | 0 .../languages/ru-RU/economy/setbio.json | 0 .../languages/ru-RU/economy/slots.json | 0 .../languages/ru-RU/economy/transactions.json | 0 src/{ => services}/languages/ru-RU/economy/work.json | 0 src/{ => services}/languages/ru-RU/fun/8ball.json | 0 src/{ => services}/languages/ru-RU/fun/cat.json | 0 src/{ => services}/languages/ru-RU/fun/dog.json | 0 src/{ => services}/languages/ru-RU/fun/lmgtfy.json | 0 src/{ => services}/languages/ru-RU/fun/lovecalc.json | 0 src/{ => services}/languages/ru-RU/fun/memes.json | 0 src/{ => services}/languages/ru-RU/fun/number.json | 0 .../languages/ru-RU/fun/tictactoe.json | 0 src/{ => services}/languages/ru-RU/general/afk.json | 0 .../languages/ru-RU/general/avatar.json | 0 .../languages/ru-RU/general/boosters.json | 0 .../languages/ru-RU/general/emoji.json | 0 src/{ => services}/languages/ru-RU/general/help.json | 0 src/{ => services}/languages/ru-RU/general/info.json | 0 .../languages/ru-RU/general/minecraft.json | 0 src/{ => services}/languages/ru-RU/general/ping.json | 0 .../languages/ru-RU/general/remindme.json | 0 .../languages/ru-RU/general/reminds.json | 0 .../languages/ru-RU/general/report.json | 0 .../languages/ru-RU/general/shorturl.json | 0 .../languages/ru-RU/general/staff.json | 0 .../languages/ru-RU/general/stats.json | 0 .../languages/ru-RU/general/suggest.json | 0 .../languages/ru-RU/general/whois.json | 0 src/{ => services}/languages/ru-RU/iat/checkjar.json | 0 src/{ => services}/languages/ru-RU/misc.json | 0 .../languages/ru-RU/moderation/ban.json | 0 .../languages/ru-RU/moderation/clear.json | 0 .../languages/ru-RU/moderation/clearwarns.json | 0 .../languages/ru-RU/moderation/giveaway.json | 0 .../languages/ru-RU/moderation/kick.json | 0 .../languages/ru-RU/moderation/unban.json | 0 .../languages/ru-RU/moderation/untimeout.json | 0 .../languages/ru-RU/moderation/warn.json | 0 .../languages/ru-RU/moderation/warns.json | 0 src/{ => services}/languages/ru-RU/music/back.json | 0 src/{ => services}/languages/ru-RU/music/clips.json | 0 src/{ => services}/languages/ru-RU/music/loop.json | 0 .../languages/ru-RU/music/nowplaying.json | 0 src/{ => services}/languages/ru-RU/music/play.json | 0 src/{ => services}/languages/ru-RU/music/queue.json | 0 src/{ => services}/languages/ru-RU/music/seek.json | 0 .../languages/ru-RU/music/shuffle.json | 0 src/{ => services}/languages/ru-RU/music/skip.json | 0 src/{ => services}/languages/ru-RU/music/stop.json | 0 src/{ => services}/languages/ru-RU/music/volume.json | 0 .../languages/ru-RU/owner/announcement.json | 0 src/{ => services}/languages/ru-RU/owner/debug.json | 0 src/{ => services}/languages/ru-RU/owner/eval.json | 0 src/{ => services}/languages/ru-RU/owner/reload.json | 0 src/{ => services}/languages/ru-RU/owner/say.json | 0 .../languages/ru-RU/owner/servers.json | 0 .../languages/ru-RU/tickets/adduser.json | 0 .../languages/ru-RU/tickets/closeticket.json | 0 .../languages/ru-RU/tickets/createticketembed.json | 0 .../languages/ru-RU/tickets/removeuser.json | 0 .../languages/uk-UA/administration/addemoji.json | 0 .../languages/uk-UA/administration/automod.json | 0 .../languages/uk-UA/administration/autorole.json | 0 .../languages/uk-UA/administration/config.json | 0 .../languages/uk-UA/administration/deletemod.json | 0 .../languages/uk-UA/administration/goodbye.json | 0 .../languages/uk-UA/administration/selectroles.json | 0 .../languages/uk-UA/administration/set.json | 0 .../languages/uk-UA/administration/setlang.json | 0 .../languages/uk-UA/administration/stealemoji.json | 0 .../languages/uk-UA/administration/welcome.json | 0 .../languages/uk-UA/beatrun/courses.json | 0 src/{ => services}/languages/uk-UA/common.json | 0 .../languages/uk-UA/economy/achievements.json | 0 src/{ => services}/languages/uk-UA/economy/bank.json | 0 .../languages/uk-UA/economy/birthdate.json | 0 .../languages/uk-UA/economy/divorce.json | 0 .../languages/uk-UA/economy/importmee6.json | 0 .../languages/uk-UA/economy/leaderboard.json | 0 .../languages/uk-UA/economy/marry.json | 0 .../languages/uk-UA/economy/money.json | 0 src/{ => services}/languages/uk-UA/economy/pay.json | 0 .../languages/uk-UA/economy/profile.json | 0 src/{ => services}/languages/uk-UA/economy/rep.json | 0 src/{ => services}/languages/uk-UA/economy/rob.json | 0 .../languages/uk-UA/economy/setbio.json | 0 .../languages/uk-UA/economy/slots.json | 0 .../languages/uk-UA/economy/transactions.json | 0 src/{ => services}/languages/uk-UA/economy/work.json | 0 src/{ => services}/languages/uk-UA/fun/8ball.json | 0 src/{ => services}/languages/uk-UA/fun/cat.json | 0 src/{ => services}/languages/uk-UA/fun/dog.json | 0 src/{ => services}/languages/uk-UA/fun/lmgtfy.json | 0 src/{ => services}/languages/uk-UA/fun/lovecalc.json | 0 src/{ => services}/languages/uk-UA/fun/memes.json | 0 src/{ => services}/languages/uk-UA/fun/number.json | 0 .../languages/uk-UA/fun/tictactoe.json | 0 src/{ => services}/languages/uk-UA/general/afk.json | 0 .../languages/uk-UA/general/avatar.json | 0 .../languages/uk-UA/general/boosters.json | 0 .../languages/uk-UA/general/emoji.json | 0 src/{ => services}/languages/uk-UA/general/help.json | 0 src/{ => services}/languages/uk-UA/general/info.json | 0 .../languages/uk-UA/general/minecraft.json | 0 src/{ => services}/languages/uk-UA/general/ping.json | 0 .../languages/uk-UA/general/remindme.json | 0 .../languages/uk-UA/general/reminds.json | 0 .../languages/uk-UA/general/report.json | 0 .../languages/uk-UA/general/shorturl.json | 0 .../languages/uk-UA/general/staff.json | 0 .../languages/uk-UA/general/stats.json | 0 .../languages/uk-UA/general/suggest.json | 0 .../languages/uk-UA/general/whois.json | 0 src/{ => services}/languages/uk-UA/iat/checkjar.json | 0 src/{ => services}/languages/uk-UA/misc.json | 0 .../languages/uk-UA/moderation/ban.json | 0 .../languages/uk-UA/moderation/clear.json | 0 .../languages/uk-UA/moderation/clearwarns.json | 0 .../languages/uk-UA/moderation/giveaway.json | 0 .../languages/uk-UA/moderation/kick.json | 0 .../languages/uk-UA/moderation/unban.json | 0 .../languages/uk-UA/moderation/untimeout.json | 0 .../languages/uk-UA/moderation/warn.json | 0 .../languages/uk-UA/moderation/warns.json | 0 src/{ => services}/languages/uk-UA/music/back.json | 0 src/{ => services}/languages/uk-UA/music/clips.json | 0 src/{ => services}/languages/uk-UA/music/loop.json | 0 .../languages/uk-UA/music/nowplaying.json | 0 src/{ => services}/languages/uk-UA/music/play.json | 0 src/{ => services}/languages/uk-UA/music/queue.json | 0 src/{ => services}/languages/uk-UA/music/seek.json | 0 .../languages/uk-UA/music/shuffle.json | 0 src/{ => services}/languages/uk-UA/music/skip.json | 0 src/{ => services}/languages/uk-UA/music/stop.json | 0 src/{ => services}/languages/uk-UA/music/volume.json | 0 .../languages/uk-UA/owner/announcement.json | 0 src/{ => services}/languages/uk-UA/owner/debug.json | 0 src/{ => services}/languages/uk-UA/owner/eval.json | 0 src/{ => services}/languages/uk-UA/owner/reload.json | 0 src/{ => services}/languages/uk-UA/owner/say.json | 0 .../languages/uk-UA/owner/servers.json | 0 .../languages/uk-UA/tickets/adduser.json | 0 .../languages/uk-UA/tickets/closeticket.json | 0 .../languages/uk-UA/tickets/createticketembed.json | 0 .../languages/uk-UA/tickets/removeuser.json | 0 257 files changed, 7 insertions(+), 7 deletions(-) rename src/{ => services}/languages/en-US/administration/addemoji.json (100%) rename src/{ => services}/languages/en-US/administration/automod.json (100%) rename src/{ => services}/languages/en-US/administration/autorole.json (100%) rename src/{ => services}/languages/en-US/administration/config.json (100%) rename src/{ => services}/languages/en-US/administration/deletemod.json (100%) rename src/{ => services}/languages/en-US/administration/goodbye.json (100%) rename src/{ => services}/languages/en-US/administration/selectroles.json (100%) rename src/{ => services}/languages/en-US/administration/set.json (100%) rename src/{ => services}/languages/en-US/administration/setlang.json (100%) rename src/{ => services}/languages/en-US/administration/stealemoji.json (100%) rename src/{ => services}/languages/en-US/administration/welcome.json (100%) rename src/{ => services}/languages/en-US/beatrun/courses.json (100%) rename src/{ => services}/languages/en-US/common.json (100%) rename src/{ => services}/languages/en-US/economy/achievements.json (100%) rename src/{ => services}/languages/en-US/economy/bank.json (100%) rename src/{ => services}/languages/en-US/economy/birthdate.json (100%) rename src/{ => services}/languages/en-US/economy/divorce.json (100%) rename src/{ => services}/languages/en-US/economy/importmee6.json (100%) rename src/{ => services}/languages/en-US/economy/leaderboard.json (100%) rename src/{ => services}/languages/en-US/economy/marry.json (100%) rename src/{ => services}/languages/en-US/economy/money.json (100%) rename src/{ => services}/languages/en-US/economy/pay.json (100%) rename src/{ => services}/languages/en-US/economy/profile.json (100%) rename src/{ => services}/languages/en-US/economy/rep.json (100%) rename src/{ => services}/languages/en-US/economy/rob.json (100%) rename src/{ => services}/languages/en-US/economy/setbio.json (100%) rename src/{ => services}/languages/en-US/economy/slots.json (100%) rename src/{ => services}/languages/en-US/economy/transactions.json (100%) rename src/{ => services}/languages/en-US/economy/work.json (100%) rename src/{ => services}/languages/en-US/fun/8ball.json (100%) rename src/{ => services}/languages/en-US/fun/cat.json (100%) rename src/{ => services}/languages/en-US/fun/dog.json (100%) rename src/{ => services}/languages/en-US/fun/lmgtfy.json (100%) rename src/{ => services}/languages/en-US/fun/lovecalc.json (100%) rename src/{ => services}/languages/en-US/fun/memes.json (100%) rename src/{ => services}/languages/en-US/fun/number.json (100%) rename src/{ => services}/languages/en-US/fun/tictactoe.json (100%) rename src/{ => services}/languages/en-US/general/afk.json (100%) rename src/{ => services}/languages/en-US/general/avatar.json (100%) rename src/{ => services}/languages/en-US/general/boosters.json (100%) rename src/{ => services}/languages/en-US/general/emoji.json (100%) rename src/{ => services}/languages/en-US/general/help.json (100%) rename src/{ => services}/languages/en-US/general/info.json (100%) rename src/{ => services}/languages/en-US/general/minecraft.json (100%) rename src/{ => services}/languages/en-US/general/ping.json (100%) rename src/{ => services}/languages/en-US/general/remindme.json (100%) rename src/{ => services}/languages/en-US/general/reminds.json (100%) rename src/{ => services}/languages/en-US/general/report.json (100%) rename src/{ => services}/languages/en-US/general/shorturl.json (100%) rename src/{ => services}/languages/en-US/general/staff.json (100%) rename src/{ => services}/languages/en-US/general/stats.json (100%) rename src/{ => services}/languages/en-US/general/suggest.json (100%) rename src/{ => services}/languages/en-US/general/whois.json (100%) rename src/{ => services}/languages/en-US/iat/checkjar.json (100%) rename src/{ => services}/languages/en-US/misc.json (100%) rename src/{ => services}/languages/en-US/moderation/ban.json (100%) rename src/{ => services}/languages/en-US/moderation/clear.json (100%) rename src/{ => services}/languages/en-US/moderation/clearwarns.json (100%) rename src/{ => services}/languages/en-US/moderation/giveaway.json (100%) rename src/{ => services}/languages/en-US/moderation/kick.json (100%) rename src/{ => services}/languages/en-US/moderation/unban.json (100%) rename src/{ => services}/languages/en-US/moderation/untimeout.json (100%) rename src/{ => services}/languages/en-US/moderation/warn.json (100%) rename src/{ => services}/languages/en-US/moderation/warns.json (100%) rename src/{ => services}/languages/en-US/music/back.json (100%) rename src/{ => services}/languages/en-US/music/clips.json (100%) rename src/{ => services}/languages/en-US/music/loop.json (100%) rename src/{ => services}/languages/en-US/music/nowplaying.json (100%) rename src/{ => services}/languages/en-US/music/play.json (100%) rename src/{ => services}/languages/en-US/music/queue.json (100%) rename src/{ => services}/languages/en-US/music/seek.json (100%) rename src/{ => services}/languages/en-US/music/shuffle.json (100%) rename src/{ => services}/languages/en-US/music/skip.json (100%) rename src/{ => services}/languages/en-US/music/stop.json (100%) rename src/{ => services}/languages/en-US/music/volume.json (100%) rename src/{ => services}/languages/en-US/owner/announcement.json (100%) rename src/{ => services}/languages/en-US/owner/debug.json (100%) rename src/{ => services}/languages/en-US/owner/eval.json (100%) rename src/{ => services}/languages/en-US/owner/reload.json (100%) rename src/{ => services}/languages/en-US/owner/say.json (100%) rename src/{ => services}/languages/en-US/owner/servers.json (100%) rename src/{ => services}/languages/en-US/tickets/adduser.json (100%) rename src/{ => services}/languages/en-US/tickets/closeticket.json (100%) rename src/{ => services}/languages/en-US/tickets/createticketembed.json (100%) rename src/{ => services}/languages/en-US/tickets/removeuser.json (100%) rename src/{ => services}/languages/language-meta.js (55%) rename src/{ => services}/languages/ru-RU/administration/addemoji.json (100%) rename src/{ => services}/languages/ru-RU/administration/automod.json (100%) rename src/{ => services}/languages/ru-RU/administration/autorole.json (100%) rename src/{ => services}/languages/ru-RU/administration/config.json (100%) rename src/{ => services}/languages/ru-RU/administration/deletemod.json (100%) rename src/{ => services}/languages/ru-RU/administration/goodbye.json (100%) rename src/{ => services}/languages/ru-RU/administration/selectroles.json (100%) rename src/{ => services}/languages/ru-RU/administration/set.json (100%) rename src/{ => services}/languages/ru-RU/administration/setlang.json (100%) rename src/{ => services}/languages/ru-RU/administration/stealemoji.json (100%) rename src/{ => services}/languages/ru-RU/administration/welcome.json (100%) rename src/{ => services}/languages/ru-RU/beatrun/courses.json (100%) rename src/{ => services}/languages/ru-RU/common.json (100%) rename src/{ => services}/languages/ru-RU/economy/achievements.json (100%) rename src/{ => services}/languages/ru-RU/economy/bank.json (100%) rename src/{ => services}/languages/ru-RU/economy/birthdate.json (100%) rename src/{ => services}/languages/ru-RU/economy/divorce.json (100%) rename src/{ => services}/languages/ru-RU/economy/importmee6.json (100%) rename src/{ => services}/languages/ru-RU/economy/leaderboard.json (100%) rename src/{ => services}/languages/ru-RU/economy/marry.json (100%) rename src/{ => services}/languages/ru-RU/economy/money.json (100%) rename src/{ => services}/languages/ru-RU/economy/pay.json (100%) rename src/{ => services}/languages/ru-RU/economy/profile.json (100%) rename src/{ => services}/languages/ru-RU/economy/rep.json (100%) rename src/{ => services}/languages/ru-RU/economy/rob.json (100%) rename src/{ => services}/languages/ru-RU/economy/setbio.json (100%) rename src/{ => services}/languages/ru-RU/economy/slots.json (100%) rename src/{ => services}/languages/ru-RU/economy/transactions.json (100%) rename src/{ => services}/languages/ru-RU/economy/work.json (100%) rename src/{ => services}/languages/ru-RU/fun/8ball.json (100%) rename src/{ => services}/languages/ru-RU/fun/cat.json (100%) rename src/{ => services}/languages/ru-RU/fun/dog.json (100%) rename src/{ => services}/languages/ru-RU/fun/lmgtfy.json (100%) rename src/{ => services}/languages/ru-RU/fun/lovecalc.json (100%) rename src/{ => services}/languages/ru-RU/fun/memes.json (100%) rename src/{ => services}/languages/ru-RU/fun/number.json (100%) rename src/{ => services}/languages/ru-RU/fun/tictactoe.json (100%) rename src/{ => services}/languages/ru-RU/general/afk.json (100%) rename src/{ => services}/languages/ru-RU/general/avatar.json (100%) rename src/{ => services}/languages/ru-RU/general/boosters.json (100%) rename src/{ => services}/languages/ru-RU/general/emoji.json (100%) rename src/{ => services}/languages/ru-RU/general/help.json (100%) rename src/{ => services}/languages/ru-RU/general/info.json (100%) rename src/{ => services}/languages/ru-RU/general/minecraft.json (100%) rename src/{ => services}/languages/ru-RU/general/ping.json (100%) rename src/{ => services}/languages/ru-RU/general/remindme.json (100%) rename src/{ => services}/languages/ru-RU/general/reminds.json (100%) rename src/{ => services}/languages/ru-RU/general/report.json (100%) rename src/{ => services}/languages/ru-RU/general/shorturl.json (100%) rename src/{ => services}/languages/ru-RU/general/staff.json (100%) rename src/{ => services}/languages/ru-RU/general/stats.json (100%) rename src/{ => services}/languages/ru-RU/general/suggest.json (100%) rename src/{ => services}/languages/ru-RU/general/whois.json (100%) rename src/{ => services}/languages/ru-RU/iat/checkjar.json (100%) rename src/{ => services}/languages/ru-RU/misc.json (100%) rename src/{ => services}/languages/ru-RU/moderation/ban.json (100%) rename src/{ => services}/languages/ru-RU/moderation/clear.json (100%) rename src/{ => services}/languages/ru-RU/moderation/clearwarns.json (100%) rename src/{ => services}/languages/ru-RU/moderation/giveaway.json (100%) rename src/{ => services}/languages/ru-RU/moderation/kick.json (100%) rename src/{ => services}/languages/ru-RU/moderation/unban.json (100%) rename src/{ => services}/languages/ru-RU/moderation/untimeout.json (100%) rename src/{ => services}/languages/ru-RU/moderation/warn.json (100%) rename src/{ => services}/languages/ru-RU/moderation/warns.json (100%) rename src/{ => services}/languages/ru-RU/music/back.json (100%) rename src/{ => services}/languages/ru-RU/music/clips.json (100%) rename src/{ => services}/languages/ru-RU/music/loop.json (100%) rename src/{ => services}/languages/ru-RU/music/nowplaying.json (100%) rename src/{ => services}/languages/ru-RU/music/play.json (100%) rename src/{ => services}/languages/ru-RU/music/queue.json (100%) rename src/{ => services}/languages/ru-RU/music/seek.json (100%) rename src/{ => services}/languages/ru-RU/music/shuffle.json (100%) rename src/{ => services}/languages/ru-RU/music/skip.json (100%) rename src/{ => services}/languages/ru-RU/music/stop.json (100%) rename src/{ => services}/languages/ru-RU/music/volume.json (100%) rename src/{ => services}/languages/ru-RU/owner/announcement.json (100%) rename src/{ => services}/languages/ru-RU/owner/debug.json (100%) rename src/{ => services}/languages/ru-RU/owner/eval.json (100%) rename src/{ => services}/languages/ru-RU/owner/reload.json (100%) rename src/{ => services}/languages/ru-RU/owner/say.json (100%) rename src/{ => services}/languages/ru-RU/owner/servers.json (100%) rename src/{ => services}/languages/ru-RU/tickets/adduser.json (100%) rename src/{ => services}/languages/ru-RU/tickets/closeticket.json (100%) rename src/{ => services}/languages/ru-RU/tickets/createticketembed.json (100%) rename src/{ => services}/languages/ru-RU/tickets/removeuser.json (100%) rename src/{ => services}/languages/uk-UA/administration/addemoji.json (100%) rename src/{ => services}/languages/uk-UA/administration/automod.json (100%) rename src/{ => services}/languages/uk-UA/administration/autorole.json (100%) rename src/{ => services}/languages/uk-UA/administration/config.json (100%) rename src/{ => services}/languages/uk-UA/administration/deletemod.json (100%) rename src/{ => services}/languages/uk-UA/administration/goodbye.json (100%) rename src/{ => services}/languages/uk-UA/administration/selectroles.json (100%) rename src/{ => services}/languages/uk-UA/administration/set.json (100%) rename src/{ => services}/languages/uk-UA/administration/setlang.json (100%) rename src/{ => services}/languages/uk-UA/administration/stealemoji.json (100%) rename src/{ => services}/languages/uk-UA/administration/welcome.json (100%) rename src/{ => services}/languages/uk-UA/beatrun/courses.json (100%) rename src/{ => services}/languages/uk-UA/common.json (100%) rename src/{ => services}/languages/uk-UA/economy/achievements.json (100%) rename src/{ => services}/languages/uk-UA/economy/bank.json (100%) rename src/{ => services}/languages/uk-UA/economy/birthdate.json (100%) rename src/{ => services}/languages/uk-UA/economy/divorce.json (100%) rename src/{ => services}/languages/uk-UA/economy/importmee6.json (100%) rename src/{ => services}/languages/uk-UA/economy/leaderboard.json (100%) rename src/{ => services}/languages/uk-UA/economy/marry.json (100%) rename src/{ => services}/languages/uk-UA/economy/money.json (100%) rename src/{ => services}/languages/uk-UA/economy/pay.json (100%) rename src/{ => services}/languages/uk-UA/economy/profile.json (100%) rename src/{ => services}/languages/uk-UA/economy/rep.json (100%) rename src/{ => services}/languages/uk-UA/economy/rob.json (100%) rename src/{ => services}/languages/uk-UA/economy/setbio.json (100%) rename src/{ => services}/languages/uk-UA/economy/slots.json (100%) rename src/{ => services}/languages/uk-UA/economy/transactions.json (100%) rename src/{ => services}/languages/uk-UA/economy/work.json (100%) rename src/{ => services}/languages/uk-UA/fun/8ball.json (100%) rename src/{ => services}/languages/uk-UA/fun/cat.json (100%) rename src/{ => services}/languages/uk-UA/fun/dog.json (100%) rename src/{ => services}/languages/uk-UA/fun/lmgtfy.json (100%) rename src/{ => services}/languages/uk-UA/fun/lovecalc.json (100%) rename src/{ => services}/languages/uk-UA/fun/memes.json (100%) rename src/{ => services}/languages/uk-UA/fun/number.json (100%) rename src/{ => services}/languages/uk-UA/fun/tictactoe.json (100%) rename src/{ => services}/languages/uk-UA/general/afk.json (100%) rename src/{ => services}/languages/uk-UA/general/avatar.json (100%) rename src/{ => services}/languages/uk-UA/general/boosters.json (100%) rename src/{ => services}/languages/uk-UA/general/emoji.json (100%) rename src/{ => services}/languages/uk-UA/general/help.json (100%) rename src/{ => services}/languages/uk-UA/general/info.json (100%) rename src/{ => services}/languages/uk-UA/general/minecraft.json (100%) rename src/{ => services}/languages/uk-UA/general/ping.json (100%) rename src/{ => services}/languages/uk-UA/general/remindme.json (100%) rename src/{ => services}/languages/uk-UA/general/reminds.json (100%) rename src/{ => services}/languages/uk-UA/general/report.json (100%) rename src/{ => services}/languages/uk-UA/general/shorturl.json (100%) rename src/{ => services}/languages/uk-UA/general/staff.json (100%) rename src/{ => services}/languages/uk-UA/general/stats.json (100%) rename src/{ => services}/languages/uk-UA/general/suggest.json (100%) rename src/{ => services}/languages/uk-UA/general/whois.json (100%) rename src/{ => services}/languages/uk-UA/iat/checkjar.json (100%) rename src/{ => services}/languages/uk-UA/misc.json (100%) rename src/{ => services}/languages/uk-UA/moderation/ban.json (100%) rename src/{ => services}/languages/uk-UA/moderation/clear.json (100%) rename src/{ => services}/languages/uk-UA/moderation/clearwarns.json (100%) rename src/{ => services}/languages/uk-UA/moderation/giveaway.json (100%) rename src/{ => services}/languages/uk-UA/moderation/kick.json (100%) rename src/{ => services}/languages/uk-UA/moderation/unban.json (100%) rename src/{ => services}/languages/uk-UA/moderation/untimeout.json (100%) rename src/{ => services}/languages/uk-UA/moderation/warn.json (100%) rename src/{ => services}/languages/uk-UA/moderation/warns.json (100%) rename src/{ => services}/languages/uk-UA/music/back.json (100%) rename src/{ => services}/languages/uk-UA/music/clips.json (100%) rename src/{ => services}/languages/uk-UA/music/loop.json (100%) rename src/{ => services}/languages/uk-UA/music/nowplaying.json (100%) rename src/{ => services}/languages/uk-UA/music/play.json (100%) rename src/{ => services}/languages/uk-UA/music/queue.json (100%) rename src/{ => services}/languages/uk-UA/music/seek.json (100%) rename src/{ => services}/languages/uk-UA/music/shuffle.json (100%) rename src/{ => services}/languages/uk-UA/music/skip.json (100%) rename src/{ => services}/languages/uk-UA/music/stop.json (100%) rename src/{ => services}/languages/uk-UA/music/volume.json (100%) rename src/{ => services}/languages/uk-UA/owner/announcement.json (100%) rename src/{ => services}/languages/uk-UA/owner/debug.json (100%) rename src/{ => services}/languages/uk-UA/owner/eval.json (100%) rename src/{ => services}/languages/uk-UA/owner/reload.json (100%) rename src/{ => services}/languages/uk-UA/owner/say.json (100%) rename src/{ => services}/languages/uk-UA/owner/servers.json (100%) rename src/{ => services}/languages/uk-UA/tickets/adduser.json (100%) rename src/{ => services}/languages/uk-UA/tickets/closeticket.json (100%) rename src/{ => services}/languages/uk-UA/tickets/createticketembed.json (100%) rename src/{ => services}/languages/uk-UA/tickets/removeuser.json (100%) diff --git a/src/commands/Music/nowplaying.js b/src/commands/Music/nowplaying.js index d4667b1a..f5efe5e1 100644 --- a/src/commands/Music/nowplaying.js +++ b/src/commands/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/src/languages/en-US/administration/addemoji.json b/src/services/languages/en-US/administration/addemoji.json similarity index 100% rename from src/languages/en-US/administration/addemoji.json rename to src/services/languages/en-US/administration/addemoji.json diff --git a/src/languages/en-US/administration/automod.json b/src/services/languages/en-US/administration/automod.json similarity index 100% rename from src/languages/en-US/administration/automod.json rename to src/services/languages/en-US/administration/automod.json diff --git a/src/languages/en-US/administration/autorole.json b/src/services/languages/en-US/administration/autorole.json similarity index 100% rename from src/languages/en-US/administration/autorole.json rename to src/services/languages/en-US/administration/autorole.json diff --git a/src/languages/en-US/administration/config.json b/src/services/languages/en-US/administration/config.json similarity index 100% rename from src/languages/en-US/administration/config.json rename to src/services/languages/en-US/administration/config.json diff --git a/src/languages/en-US/administration/deletemod.json b/src/services/languages/en-US/administration/deletemod.json similarity index 100% rename from src/languages/en-US/administration/deletemod.json rename to src/services/languages/en-US/administration/deletemod.json diff --git a/src/languages/en-US/administration/goodbye.json b/src/services/languages/en-US/administration/goodbye.json similarity index 100% rename from src/languages/en-US/administration/goodbye.json rename to src/services/languages/en-US/administration/goodbye.json diff --git a/src/languages/en-US/administration/selectroles.json b/src/services/languages/en-US/administration/selectroles.json similarity index 100% rename from src/languages/en-US/administration/selectroles.json rename to src/services/languages/en-US/administration/selectroles.json diff --git a/src/languages/en-US/administration/set.json b/src/services/languages/en-US/administration/set.json similarity index 100% rename from src/languages/en-US/administration/set.json rename to src/services/languages/en-US/administration/set.json diff --git a/src/languages/en-US/administration/setlang.json b/src/services/languages/en-US/administration/setlang.json similarity index 100% rename from src/languages/en-US/administration/setlang.json rename to src/services/languages/en-US/administration/setlang.json diff --git a/src/languages/en-US/administration/stealemoji.json b/src/services/languages/en-US/administration/stealemoji.json similarity index 100% rename from src/languages/en-US/administration/stealemoji.json rename to src/services/languages/en-US/administration/stealemoji.json diff --git a/src/languages/en-US/administration/welcome.json b/src/services/languages/en-US/administration/welcome.json similarity index 100% rename from src/languages/en-US/administration/welcome.json rename to src/services/languages/en-US/administration/welcome.json diff --git a/src/languages/en-US/beatrun/courses.json b/src/services/languages/en-US/beatrun/courses.json similarity index 100% rename from src/languages/en-US/beatrun/courses.json rename to src/services/languages/en-US/beatrun/courses.json diff --git a/src/languages/en-US/common.json b/src/services/languages/en-US/common.json similarity index 100% rename from src/languages/en-US/common.json rename to src/services/languages/en-US/common.json diff --git a/src/languages/en-US/economy/achievements.json b/src/services/languages/en-US/economy/achievements.json similarity index 100% rename from src/languages/en-US/economy/achievements.json rename to src/services/languages/en-US/economy/achievements.json diff --git a/src/languages/en-US/economy/bank.json b/src/services/languages/en-US/economy/bank.json similarity index 100% rename from src/languages/en-US/economy/bank.json rename to src/services/languages/en-US/economy/bank.json diff --git a/src/languages/en-US/economy/birthdate.json b/src/services/languages/en-US/economy/birthdate.json similarity index 100% rename from src/languages/en-US/economy/birthdate.json rename to src/services/languages/en-US/economy/birthdate.json diff --git a/src/languages/en-US/economy/divorce.json b/src/services/languages/en-US/economy/divorce.json similarity index 100% rename from src/languages/en-US/economy/divorce.json rename to src/services/languages/en-US/economy/divorce.json diff --git a/src/languages/en-US/economy/importmee6.json b/src/services/languages/en-US/economy/importmee6.json similarity index 100% rename from src/languages/en-US/economy/importmee6.json rename to src/services/languages/en-US/economy/importmee6.json diff --git a/src/languages/en-US/economy/leaderboard.json b/src/services/languages/en-US/economy/leaderboard.json similarity index 100% rename from src/languages/en-US/economy/leaderboard.json rename to src/services/languages/en-US/economy/leaderboard.json diff --git a/src/languages/en-US/economy/marry.json b/src/services/languages/en-US/economy/marry.json similarity index 100% rename from src/languages/en-US/economy/marry.json rename to src/services/languages/en-US/economy/marry.json diff --git a/src/languages/en-US/economy/money.json b/src/services/languages/en-US/economy/money.json similarity index 100% rename from src/languages/en-US/economy/money.json rename to src/services/languages/en-US/economy/money.json diff --git a/src/languages/en-US/economy/pay.json b/src/services/languages/en-US/economy/pay.json similarity index 100% rename from src/languages/en-US/economy/pay.json rename to src/services/languages/en-US/economy/pay.json diff --git a/src/languages/en-US/economy/profile.json b/src/services/languages/en-US/economy/profile.json similarity index 100% rename from src/languages/en-US/economy/profile.json rename to src/services/languages/en-US/economy/profile.json diff --git a/src/languages/en-US/economy/rep.json b/src/services/languages/en-US/economy/rep.json similarity index 100% rename from src/languages/en-US/economy/rep.json rename to src/services/languages/en-US/economy/rep.json diff --git a/src/languages/en-US/economy/rob.json b/src/services/languages/en-US/economy/rob.json similarity index 100% rename from src/languages/en-US/economy/rob.json rename to src/services/languages/en-US/economy/rob.json diff --git a/src/languages/en-US/economy/setbio.json b/src/services/languages/en-US/economy/setbio.json similarity index 100% rename from src/languages/en-US/economy/setbio.json rename to src/services/languages/en-US/economy/setbio.json diff --git a/src/languages/en-US/economy/slots.json b/src/services/languages/en-US/economy/slots.json similarity index 100% rename from src/languages/en-US/economy/slots.json rename to src/services/languages/en-US/economy/slots.json diff --git a/src/languages/en-US/economy/transactions.json b/src/services/languages/en-US/economy/transactions.json similarity index 100% rename from src/languages/en-US/economy/transactions.json rename to src/services/languages/en-US/economy/transactions.json diff --git a/src/languages/en-US/economy/work.json b/src/services/languages/en-US/economy/work.json similarity index 100% rename from src/languages/en-US/economy/work.json rename to src/services/languages/en-US/economy/work.json diff --git a/src/languages/en-US/fun/8ball.json b/src/services/languages/en-US/fun/8ball.json similarity index 100% rename from src/languages/en-US/fun/8ball.json rename to src/services/languages/en-US/fun/8ball.json diff --git a/src/languages/en-US/fun/cat.json b/src/services/languages/en-US/fun/cat.json similarity index 100% rename from src/languages/en-US/fun/cat.json rename to src/services/languages/en-US/fun/cat.json diff --git a/src/languages/en-US/fun/dog.json b/src/services/languages/en-US/fun/dog.json similarity index 100% rename from src/languages/en-US/fun/dog.json rename to src/services/languages/en-US/fun/dog.json diff --git a/src/languages/en-US/fun/lmgtfy.json b/src/services/languages/en-US/fun/lmgtfy.json similarity index 100% rename from src/languages/en-US/fun/lmgtfy.json rename to src/services/languages/en-US/fun/lmgtfy.json diff --git a/src/languages/en-US/fun/lovecalc.json b/src/services/languages/en-US/fun/lovecalc.json similarity index 100% rename from src/languages/en-US/fun/lovecalc.json rename to src/services/languages/en-US/fun/lovecalc.json diff --git a/src/languages/en-US/fun/memes.json b/src/services/languages/en-US/fun/memes.json similarity index 100% rename from src/languages/en-US/fun/memes.json rename to src/services/languages/en-US/fun/memes.json diff --git a/src/languages/en-US/fun/number.json b/src/services/languages/en-US/fun/number.json similarity index 100% rename from src/languages/en-US/fun/number.json rename to src/services/languages/en-US/fun/number.json diff --git a/src/languages/en-US/fun/tictactoe.json b/src/services/languages/en-US/fun/tictactoe.json similarity index 100% rename from src/languages/en-US/fun/tictactoe.json rename to src/services/languages/en-US/fun/tictactoe.json diff --git a/src/languages/en-US/general/afk.json b/src/services/languages/en-US/general/afk.json similarity index 100% rename from src/languages/en-US/general/afk.json rename to src/services/languages/en-US/general/afk.json diff --git a/src/languages/en-US/general/avatar.json b/src/services/languages/en-US/general/avatar.json similarity index 100% rename from src/languages/en-US/general/avatar.json rename to src/services/languages/en-US/general/avatar.json diff --git a/src/languages/en-US/general/boosters.json b/src/services/languages/en-US/general/boosters.json similarity index 100% rename from src/languages/en-US/general/boosters.json rename to src/services/languages/en-US/general/boosters.json diff --git a/src/languages/en-US/general/emoji.json b/src/services/languages/en-US/general/emoji.json similarity index 100% rename from src/languages/en-US/general/emoji.json rename to src/services/languages/en-US/general/emoji.json diff --git a/src/languages/en-US/general/help.json b/src/services/languages/en-US/general/help.json similarity index 100% rename from src/languages/en-US/general/help.json rename to src/services/languages/en-US/general/help.json diff --git a/src/languages/en-US/general/info.json b/src/services/languages/en-US/general/info.json similarity index 100% rename from src/languages/en-US/general/info.json rename to src/services/languages/en-US/general/info.json diff --git a/src/languages/en-US/general/minecraft.json b/src/services/languages/en-US/general/minecraft.json similarity index 100% rename from src/languages/en-US/general/minecraft.json rename to src/services/languages/en-US/general/minecraft.json diff --git a/src/languages/en-US/general/ping.json b/src/services/languages/en-US/general/ping.json similarity index 100% rename from src/languages/en-US/general/ping.json rename to src/services/languages/en-US/general/ping.json diff --git a/src/languages/en-US/general/remindme.json b/src/services/languages/en-US/general/remindme.json similarity index 100% rename from src/languages/en-US/general/remindme.json rename to src/services/languages/en-US/general/remindme.json diff --git a/src/languages/en-US/general/reminds.json b/src/services/languages/en-US/general/reminds.json similarity index 100% rename from src/languages/en-US/general/reminds.json rename to src/services/languages/en-US/general/reminds.json diff --git a/src/languages/en-US/general/report.json b/src/services/languages/en-US/general/report.json similarity index 100% rename from src/languages/en-US/general/report.json rename to src/services/languages/en-US/general/report.json diff --git a/src/languages/en-US/general/shorturl.json b/src/services/languages/en-US/general/shorturl.json similarity index 100% rename from src/languages/en-US/general/shorturl.json rename to src/services/languages/en-US/general/shorturl.json diff --git a/src/languages/en-US/general/staff.json b/src/services/languages/en-US/general/staff.json similarity index 100% rename from src/languages/en-US/general/staff.json rename to src/services/languages/en-US/general/staff.json diff --git a/src/languages/en-US/general/stats.json b/src/services/languages/en-US/general/stats.json similarity index 100% rename from src/languages/en-US/general/stats.json rename to src/services/languages/en-US/general/stats.json diff --git a/src/languages/en-US/general/suggest.json b/src/services/languages/en-US/general/suggest.json similarity index 100% rename from src/languages/en-US/general/suggest.json rename to src/services/languages/en-US/general/suggest.json diff --git a/src/languages/en-US/general/whois.json b/src/services/languages/en-US/general/whois.json similarity index 100% rename from src/languages/en-US/general/whois.json rename to src/services/languages/en-US/general/whois.json diff --git a/src/languages/en-US/iat/checkjar.json b/src/services/languages/en-US/iat/checkjar.json similarity index 100% rename from src/languages/en-US/iat/checkjar.json rename to src/services/languages/en-US/iat/checkjar.json diff --git a/src/languages/en-US/misc.json b/src/services/languages/en-US/misc.json similarity index 100% rename from src/languages/en-US/misc.json rename to src/services/languages/en-US/misc.json diff --git a/src/languages/en-US/moderation/ban.json b/src/services/languages/en-US/moderation/ban.json similarity index 100% rename from src/languages/en-US/moderation/ban.json rename to src/services/languages/en-US/moderation/ban.json diff --git a/src/languages/en-US/moderation/clear.json b/src/services/languages/en-US/moderation/clear.json similarity index 100% rename from src/languages/en-US/moderation/clear.json rename to src/services/languages/en-US/moderation/clear.json diff --git a/src/languages/en-US/moderation/clearwarns.json b/src/services/languages/en-US/moderation/clearwarns.json similarity index 100% rename from src/languages/en-US/moderation/clearwarns.json rename to src/services/languages/en-US/moderation/clearwarns.json diff --git a/src/languages/en-US/moderation/giveaway.json b/src/services/languages/en-US/moderation/giveaway.json similarity index 100% rename from src/languages/en-US/moderation/giveaway.json rename to src/services/languages/en-US/moderation/giveaway.json diff --git a/src/languages/en-US/moderation/kick.json b/src/services/languages/en-US/moderation/kick.json similarity index 100% rename from src/languages/en-US/moderation/kick.json rename to src/services/languages/en-US/moderation/kick.json diff --git a/src/languages/en-US/moderation/unban.json b/src/services/languages/en-US/moderation/unban.json similarity index 100% rename from src/languages/en-US/moderation/unban.json rename to src/services/languages/en-US/moderation/unban.json diff --git a/src/languages/en-US/moderation/untimeout.json b/src/services/languages/en-US/moderation/untimeout.json similarity index 100% rename from src/languages/en-US/moderation/untimeout.json rename to src/services/languages/en-US/moderation/untimeout.json diff --git a/src/languages/en-US/moderation/warn.json b/src/services/languages/en-US/moderation/warn.json similarity index 100% rename from src/languages/en-US/moderation/warn.json rename to src/services/languages/en-US/moderation/warn.json diff --git a/src/languages/en-US/moderation/warns.json b/src/services/languages/en-US/moderation/warns.json similarity index 100% rename from src/languages/en-US/moderation/warns.json rename to src/services/languages/en-US/moderation/warns.json diff --git a/src/languages/en-US/music/back.json b/src/services/languages/en-US/music/back.json similarity index 100% rename from src/languages/en-US/music/back.json rename to src/services/languages/en-US/music/back.json diff --git a/src/languages/en-US/music/clips.json b/src/services/languages/en-US/music/clips.json similarity index 100% rename from src/languages/en-US/music/clips.json rename to src/services/languages/en-US/music/clips.json diff --git a/src/languages/en-US/music/loop.json b/src/services/languages/en-US/music/loop.json similarity index 100% rename from src/languages/en-US/music/loop.json rename to src/services/languages/en-US/music/loop.json diff --git a/src/languages/en-US/music/nowplaying.json b/src/services/languages/en-US/music/nowplaying.json similarity index 100% rename from src/languages/en-US/music/nowplaying.json rename to src/services/languages/en-US/music/nowplaying.json diff --git a/src/languages/en-US/music/play.json b/src/services/languages/en-US/music/play.json similarity index 100% rename from src/languages/en-US/music/play.json rename to src/services/languages/en-US/music/play.json diff --git a/src/languages/en-US/music/queue.json b/src/services/languages/en-US/music/queue.json similarity index 100% rename from src/languages/en-US/music/queue.json rename to src/services/languages/en-US/music/queue.json diff --git a/src/languages/en-US/music/seek.json b/src/services/languages/en-US/music/seek.json similarity index 100% rename from src/languages/en-US/music/seek.json rename to src/services/languages/en-US/music/seek.json diff --git a/src/languages/en-US/music/shuffle.json b/src/services/languages/en-US/music/shuffle.json similarity index 100% rename from src/languages/en-US/music/shuffle.json rename to src/services/languages/en-US/music/shuffle.json diff --git a/src/languages/en-US/music/skip.json b/src/services/languages/en-US/music/skip.json similarity index 100% rename from src/languages/en-US/music/skip.json rename to src/services/languages/en-US/music/skip.json diff --git a/src/languages/en-US/music/stop.json b/src/services/languages/en-US/music/stop.json similarity index 100% rename from src/languages/en-US/music/stop.json rename to src/services/languages/en-US/music/stop.json diff --git a/src/languages/en-US/music/volume.json b/src/services/languages/en-US/music/volume.json similarity index 100% rename from src/languages/en-US/music/volume.json rename to src/services/languages/en-US/music/volume.json diff --git a/src/languages/en-US/owner/announcement.json b/src/services/languages/en-US/owner/announcement.json similarity index 100% rename from src/languages/en-US/owner/announcement.json rename to src/services/languages/en-US/owner/announcement.json diff --git a/src/languages/en-US/owner/debug.json b/src/services/languages/en-US/owner/debug.json similarity index 100% rename from src/languages/en-US/owner/debug.json rename to src/services/languages/en-US/owner/debug.json diff --git a/src/languages/en-US/owner/eval.json b/src/services/languages/en-US/owner/eval.json similarity index 100% rename from src/languages/en-US/owner/eval.json rename to src/services/languages/en-US/owner/eval.json diff --git a/src/languages/en-US/owner/reload.json b/src/services/languages/en-US/owner/reload.json similarity index 100% rename from src/languages/en-US/owner/reload.json rename to src/services/languages/en-US/owner/reload.json diff --git a/src/languages/en-US/owner/say.json b/src/services/languages/en-US/owner/say.json similarity index 100% rename from src/languages/en-US/owner/say.json rename to src/services/languages/en-US/owner/say.json diff --git a/src/languages/en-US/owner/servers.json b/src/services/languages/en-US/owner/servers.json similarity index 100% rename from src/languages/en-US/owner/servers.json rename to src/services/languages/en-US/owner/servers.json diff --git a/src/languages/en-US/tickets/adduser.json b/src/services/languages/en-US/tickets/adduser.json similarity index 100% rename from src/languages/en-US/tickets/adduser.json rename to src/services/languages/en-US/tickets/adduser.json diff --git a/src/languages/en-US/tickets/closeticket.json b/src/services/languages/en-US/tickets/closeticket.json similarity index 100% rename from src/languages/en-US/tickets/closeticket.json rename to src/services/languages/en-US/tickets/closeticket.json diff --git a/src/languages/en-US/tickets/createticketembed.json b/src/services/languages/en-US/tickets/createticketembed.json similarity index 100% rename from src/languages/en-US/tickets/createticketembed.json rename to src/services/languages/en-US/tickets/createticketembed.json diff --git a/src/languages/en-US/tickets/removeuser.json b/src/services/languages/en-US/tickets/removeuser.json similarity index 100% rename from src/languages/en-US/tickets/removeuser.json rename to src/services/languages/en-US/tickets/removeuser.json diff --git a/src/languages/language-meta.js b/src/services/languages/language-meta.js similarity index 55% rename from src/languages/language-meta.js rename to src/services/languages/language-meta.js index cc409b36..78ebc405 100644 --- a/src/languages/language-meta.js +++ b/src/services/languages/language-meta.js @@ -2,22 +2,22 @@ export default [ { name: "en-US", nativeName: "English", - moment: "en", - defaultMomentFormat: "HH:mm:ss, MMMM Do YYYY", + locale: "en-US", + format: "HH:mm:ss, MMMM Do YYYY", default: true, }, { name: "ru-RU", nativeName: "Русский", - moment: "ru", - defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + locale: "ru-RU", + format: "HH:mm:ss, Do MMMM YYYY", default: false, }, { name: "uk-UA", nativeName: "Українська", - moment: "uk", - defaultMomentFormat: "HH:mm:ss, Do MMMM YYYY", + locale: "uk-UA", + format: "HH:mm:ss, Do MMMM YYYY", default: false, }, ]; diff --git a/src/languages/ru-RU/administration/addemoji.json b/src/services/languages/ru-RU/administration/addemoji.json similarity index 100% rename from src/languages/ru-RU/administration/addemoji.json rename to src/services/languages/ru-RU/administration/addemoji.json diff --git a/src/languages/ru-RU/administration/automod.json b/src/services/languages/ru-RU/administration/automod.json similarity index 100% rename from src/languages/ru-RU/administration/automod.json rename to src/services/languages/ru-RU/administration/automod.json diff --git a/src/languages/ru-RU/administration/autorole.json b/src/services/languages/ru-RU/administration/autorole.json similarity index 100% rename from src/languages/ru-RU/administration/autorole.json rename to src/services/languages/ru-RU/administration/autorole.json diff --git a/src/languages/ru-RU/administration/config.json b/src/services/languages/ru-RU/administration/config.json similarity index 100% rename from src/languages/ru-RU/administration/config.json rename to src/services/languages/ru-RU/administration/config.json diff --git a/src/languages/ru-RU/administration/deletemod.json b/src/services/languages/ru-RU/administration/deletemod.json similarity index 100% rename from src/languages/ru-RU/administration/deletemod.json rename to src/services/languages/ru-RU/administration/deletemod.json diff --git a/src/languages/ru-RU/administration/goodbye.json b/src/services/languages/ru-RU/administration/goodbye.json similarity index 100% rename from src/languages/ru-RU/administration/goodbye.json rename to src/services/languages/ru-RU/administration/goodbye.json diff --git a/src/languages/ru-RU/administration/selectroles.json b/src/services/languages/ru-RU/administration/selectroles.json similarity index 100% rename from src/languages/ru-RU/administration/selectroles.json rename to src/services/languages/ru-RU/administration/selectroles.json diff --git a/src/languages/ru-RU/administration/set.json b/src/services/languages/ru-RU/administration/set.json similarity index 100% rename from src/languages/ru-RU/administration/set.json rename to src/services/languages/ru-RU/administration/set.json diff --git a/src/languages/ru-RU/administration/setlang.json b/src/services/languages/ru-RU/administration/setlang.json similarity index 100% rename from src/languages/ru-RU/administration/setlang.json rename to src/services/languages/ru-RU/administration/setlang.json diff --git a/src/languages/ru-RU/administration/stealemoji.json b/src/services/languages/ru-RU/administration/stealemoji.json similarity index 100% rename from src/languages/ru-RU/administration/stealemoji.json rename to src/services/languages/ru-RU/administration/stealemoji.json diff --git a/src/languages/ru-RU/administration/welcome.json b/src/services/languages/ru-RU/administration/welcome.json similarity index 100% rename from src/languages/ru-RU/administration/welcome.json rename to src/services/languages/ru-RU/administration/welcome.json diff --git a/src/languages/ru-RU/beatrun/courses.json b/src/services/languages/ru-RU/beatrun/courses.json similarity index 100% rename from src/languages/ru-RU/beatrun/courses.json rename to src/services/languages/ru-RU/beatrun/courses.json diff --git a/src/languages/ru-RU/common.json b/src/services/languages/ru-RU/common.json similarity index 100% rename from src/languages/ru-RU/common.json rename to src/services/languages/ru-RU/common.json diff --git a/src/languages/ru-RU/economy/achievements.json b/src/services/languages/ru-RU/economy/achievements.json similarity index 100% rename from src/languages/ru-RU/economy/achievements.json rename to src/services/languages/ru-RU/economy/achievements.json diff --git a/src/languages/ru-RU/economy/bank.json b/src/services/languages/ru-RU/economy/bank.json similarity index 100% rename from src/languages/ru-RU/economy/bank.json rename to src/services/languages/ru-RU/economy/bank.json diff --git a/src/languages/ru-RU/economy/birthdate.json b/src/services/languages/ru-RU/economy/birthdate.json similarity index 100% rename from src/languages/ru-RU/economy/birthdate.json rename to src/services/languages/ru-RU/economy/birthdate.json diff --git a/src/languages/ru-RU/economy/divorce.json b/src/services/languages/ru-RU/economy/divorce.json similarity index 100% rename from src/languages/ru-RU/economy/divorce.json rename to src/services/languages/ru-RU/economy/divorce.json diff --git a/src/languages/ru-RU/economy/importmee6.json b/src/services/languages/ru-RU/economy/importmee6.json similarity index 100% rename from src/languages/ru-RU/economy/importmee6.json rename to src/services/languages/ru-RU/economy/importmee6.json diff --git a/src/languages/ru-RU/economy/leaderboard.json b/src/services/languages/ru-RU/economy/leaderboard.json similarity index 100% rename from src/languages/ru-RU/economy/leaderboard.json rename to src/services/languages/ru-RU/economy/leaderboard.json diff --git a/src/languages/ru-RU/economy/marry.json b/src/services/languages/ru-RU/economy/marry.json similarity index 100% rename from src/languages/ru-RU/economy/marry.json rename to src/services/languages/ru-RU/economy/marry.json diff --git a/src/languages/ru-RU/economy/money.json b/src/services/languages/ru-RU/economy/money.json similarity index 100% rename from src/languages/ru-RU/economy/money.json rename to src/services/languages/ru-RU/economy/money.json diff --git a/src/languages/ru-RU/economy/pay.json b/src/services/languages/ru-RU/economy/pay.json similarity index 100% rename from src/languages/ru-RU/economy/pay.json rename to src/services/languages/ru-RU/economy/pay.json diff --git a/src/languages/ru-RU/economy/profile.json b/src/services/languages/ru-RU/economy/profile.json similarity index 100% rename from src/languages/ru-RU/economy/profile.json rename to src/services/languages/ru-RU/economy/profile.json diff --git a/src/languages/ru-RU/economy/rep.json b/src/services/languages/ru-RU/economy/rep.json similarity index 100% rename from src/languages/ru-RU/economy/rep.json rename to src/services/languages/ru-RU/economy/rep.json diff --git a/src/languages/ru-RU/economy/rob.json b/src/services/languages/ru-RU/economy/rob.json similarity index 100% rename from src/languages/ru-RU/economy/rob.json rename to src/services/languages/ru-RU/economy/rob.json diff --git a/src/languages/ru-RU/economy/setbio.json b/src/services/languages/ru-RU/economy/setbio.json similarity index 100% rename from src/languages/ru-RU/economy/setbio.json rename to src/services/languages/ru-RU/economy/setbio.json diff --git a/src/languages/ru-RU/economy/slots.json b/src/services/languages/ru-RU/economy/slots.json similarity index 100% rename from src/languages/ru-RU/economy/slots.json rename to src/services/languages/ru-RU/economy/slots.json diff --git a/src/languages/ru-RU/economy/transactions.json b/src/services/languages/ru-RU/economy/transactions.json similarity index 100% rename from src/languages/ru-RU/economy/transactions.json rename to src/services/languages/ru-RU/economy/transactions.json diff --git a/src/languages/ru-RU/economy/work.json b/src/services/languages/ru-RU/economy/work.json similarity index 100% rename from src/languages/ru-RU/economy/work.json rename to src/services/languages/ru-RU/economy/work.json diff --git a/src/languages/ru-RU/fun/8ball.json b/src/services/languages/ru-RU/fun/8ball.json similarity index 100% rename from src/languages/ru-RU/fun/8ball.json rename to src/services/languages/ru-RU/fun/8ball.json diff --git a/src/languages/ru-RU/fun/cat.json b/src/services/languages/ru-RU/fun/cat.json similarity index 100% rename from src/languages/ru-RU/fun/cat.json rename to src/services/languages/ru-RU/fun/cat.json diff --git a/src/languages/ru-RU/fun/dog.json b/src/services/languages/ru-RU/fun/dog.json similarity index 100% rename from src/languages/ru-RU/fun/dog.json rename to src/services/languages/ru-RU/fun/dog.json diff --git a/src/languages/ru-RU/fun/lmgtfy.json b/src/services/languages/ru-RU/fun/lmgtfy.json similarity index 100% rename from src/languages/ru-RU/fun/lmgtfy.json rename to src/services/languages/ru-RU/fun/lmgtfy.json diff --git a/src/languages/ru-RU/fun/lovecalc.json b/src/services/languages/ru-RU/fun/lovecalc.json similarity index 100% rename from src/languages/ru-RU/fun/lovecalc.json rename to src/services/languages/ru-RU/fun/lovecalc.json diff --git a/src/languages/ru-RU/fun/memes.json b/src/services/languages/ru-RU/fun/memes.json similarity index 100% rename from src/languages/ru-RU/fun/memes.json rename to src/services/languages/ru-RU/fun/memes.json diff --git a/src/languages/ru-RU/fun/number.json b/src/services/languages/ru-RU/fun/number.json similarity index 100% rename from src/languages/ru-RU/fun/number.json rename to src/services/languages/ru-RU/fun/number.json diff --git a/src/languages/ru-RU/fun/tictactoe.json b/src/services/languages/ru-RU/fun/tictactoe.json similarity index 100% rename from src/languages/ru-RU/fun/tictactoe.json rename to src/services/languages/ru-RU/fun/tictactoe.json diff --git a/src/languages/ru-RU/general/afk.json b/src/services/languages/ru-RU/general/afk.json similarity index 100% rename from src/languages/ru-RU/general/afk.json rename to src/services/languages/ru-RU/general/afk.json diff --git a/src/languages/ru-RU/general/avatar.json b/src/services/languages/ru-RU/general/avatar.json similarity index 100% rename from src/languages/ru-RU/general/avatar.json rename to src/services/languages/ru-RU/general/avatar.json diff --git a/src/languages/ru-RU/general/boosters.json b/src/services/languages/ru-RU/general/boosters.json similarity index 100% rename from src/languages/ru-RU/general/boosters.json rename to src/services/languages/ru-RU/general/boosters.json diff --git a/src/languages/ru-RU/general/emoji.json b/src/services/languages/ru-RU/general/emoji.json similarity index 100% rename from src/languages/ru-RU/general/emoji.json rename to src/services/languages/ru-RU/general/emoji.json diff --git a/src/languages/ru-RU/general/help.json b/src/services/languages/ru-RU/general/help.json similarity index 100% rename from src/languages/ru-RU/general/help.json rename to src/services/languages/ru-RU/general/help.json diff --git a/src/languages/ru-RU/general/info.json b/src/services/languages/ru-RU/general/info.json similarity index 100% rename from src/languages/ru-RU/general/info.json rename to src/services/languages/ru-RU/general/info.json diff --git a/src/languages/ru-RU/general/minecraft.json b/src/services/languages/ru-RU/general/minecraft.json similarity index 100% rename from src/languages/ru-RU/general/minecraft.json rename to src/services/languages/ru-RU/general/minecraft.json diff --git a/src/languages/ru-RU/general/ping.json b/src/services/languages/ru-RU/general/ping.json similarity index 100% rename from src/languages/ru-RU/general/ping.json rename to src/services/languages/ru-RU/general/ping.json diff --git a/src/languages/ru-RU/general/remindme.json b/src/services/languages/ru-RU/general/remindme.json similarity index 100% rename from src/languages/ru-RU/general/remindme.json rename to src/services/languages/ru-RU/general/remindme.json diff --git a/src/languages/ru-RU/general/reminds.json b/src/services/languages/ru-RU/general/reminds.json similarity index 100% rename from src/languages/ru-RU/general/reminds.json rename to src/services/languages/ru-RU/general/reminds.json diff --git a/src/languages/ru-RU/general/report.json b/src/services/languages/ru-RU/general/report.json similarity index 100% rename from src/languages/ru-RU/general/report.json rename to src/services/languages/ru-RU/general/report.json diff --git a/src/languages/ru-RU/general/shorturl.json b/src/services/languages/ru-RU/general/shorturl.json similarity index 100% rename from src/languages/ru-RU/general/shorturl.json rename to src/services/languages/ru-RU/general/shorturl.json diff --git a/src/languages/ru-RU/general/staff.json b/src/services/languages/ru-RU/general/staff.json similarity index 100% rename from src/languages/ru-RU/general/staff.json rename to src/services/languages/ru-RU/general/staff.json diff --git a/src/languages/ru-RU/general/stats.json b/src/services/languages/ru-RU/general/stats.json similarity index 100% rename from src/languages/ru-RU/general/stats.json rename to src/services/languages/ru-RU/general/stats.json diff --git a/src/languages/ru-RU/general/suggest.json b/src/services/languages/ru-RU/general/suggest.json similarity index 100% rename from src/languages/ru-RU/general/suggest.json rename to src/services/languages/ru-RU/general/suggest.json diff --git a/src/languages/ru-RU/general/whois.json b/src/services/languages/ru-RU/general/whois.json similarity index 100% rename from src/languages/ru-RU/general/whois.json rename to src/services/languages/ru-RU/general/whois.json diff --git a/src/languages/ru-RU/iat/checkjar.json b/src/services/languages/ru-RU/iat/checkjar.json similarity index 100% rename from src/languages/ru-RU/iat/checkjar.json rename to src/services/languages/ru-RU/iat/checkjar.json diff --git a/src/languages/ru-RU/misc.json b/src/services/languages/ru-RU/misc.json similarity index 100% rename from src/languages/ru-RU/misc.json rename to src/services/languages/ru-RU/misc.json diff --git a/src/languages/ru-RU/moderation/ban.json b/src/services/languages/ru-RU/moderation/ban.json similarity index 100% rename from src/languages/ru-RU/moderation/ban.json rename to src/services/languages/ru-RU/moderation/ban.json diff --git a/src/languages/ru-RU/moderation/clear.json b/src/services/languages/ru-RU/moderation/clear.json similarity index 100% rename from src/languages/ru-RU/moderation/clear.json rename to src/services/languages/ru-RU/moderation/clear.json diff --git a/src/languages/ru-RU/moderation/clearwarns.json b/src/services/languages/ru-RU/moderation/clearwarns.json similarity index 100% rename from src/languages/ru-RU/moderation/clearwarns.json rename to src/services/languages/ru-RU/moderation/clearwarns.json diff --git a/src/languages/ru-RU/moderation/giveaway.json b/src/services/languages/ru-RU/moderation/giveaway.json similarity index 100% rename from src/languages/ru-RU/moderation/giveaway.json rename to src/services/languages/ru-RU/moderation/giveaway.json diff --git a/src/languages/ru-RU/moderation/kick.json b/src/services/languages/ru-RU/moderation/kick.json similarity index 100% rename from src/languages/ru-RU/moderation/kick.json rename to src/services/languages/ru-RU/moderation/kick.json diff --git a/src/languages/ru-RU/moderation/unban.json b/src/services/languages/ru-RU/moderation/unban.json similarity index 100% rename from src/languages/ru-RU/moderation/unban.json rename to src/services/languages/ru-RU/moderation/unban.json diff --git a/src/languages/ru-RU/moderation/untimeout.json b/src/services/languages/ru-RU/moderation/untimeout.json similarity index 100% rename from src/languages/ru-RU/moderation/untimeout.json rename to src/services/languages/ru-RU/moderation/untimeout.json diff --git a/src/languages/ru-RU/moderation/warn.json b/src/services/languages/ru-RU/moderation/warn.json similarity index 100% rename from src/languages/ru-RU/moderation/warn.json rename to src/services/languages/ru-RU/moderation/warn.json diff --git a/src/languages/ru-RU/moderation/warns.json b/src/services/languages/ru-RU/moderation/warns.json similarity index 100% rename from src/languages/ru-RU/moderation/warns.json rename to src/services/languages/ru-RU/moderation/warns.json diff --git a/src/languages/ru-RU/music/back.json b/src/services/languages/ru-RU/music/back.json similarity index 100% rename from src/languages/ru-RU/music/back.json rename to src/services/languages/ru-RU/music/back.json diff --git a/src/languages/ru-RU/music/clips.json b/src/services/languages/ru-RU/music/clips.json similarity index 100% rename from src/languages/ru-RU/music/clips.json rename to src/services/languages/ru-RU/music/clips.json diff --git a/src/languages/ru-RU/music/loop.json b/src/services/languages/ru-RU/music/loop.json similarity index 100% rename from src/languages/ru-RU/music/loop.json rename to src/services/languages/ru-RU/music/loop.json diff --git a/src/languages/ru-RU/music/nowplaying.json b/src/services/languages/ru-RU/music/nowplaying.json similarity index 100% rename from src/languages/ru-RU/music/nowplaying.json rename to src/services/languages/ru-RU/music/nowplaying.json diff --git a/src/languages/ru-RU/music/play.json b/src/services/languages/ru-RU/music/play.json similarity index 100% rename from src/languages/ru-RU/music/play.json rename to src/services/languages/ru-RU/music/play.json diff --git a/src/languages/ru-RU/music/queue.json b/src/services/languages/ru-RU/music/queue.json similarity index 100% rename from src/languages/ru-RU/music/queue.json rename to src/services/languages/ru-RU/music/queue.json diff --git a/src/languages/ru-RU/music/seek.json b/src/services/languages/ru-RU/music/seek.json similarity index 100% rename from src/languages/ru-RU/music/seek.json rename to src/services/languages/ru-RU/music/seek.json diff --git a/src/languages/ru-RU/music/shuffle.json b/src/services/languages/ru-RU/music/shuffle.json similarity index 100% rename from src/languages/ru-RU/music/shuffle.json rename to src/services/languages/ru-RU/music/shuffle.json diff --git a/src/languages/ru-RU/music/skip.json b/src/services/languages/ru-RU/music/skip.json similarity index 100% rename from src/languages/ru-RU/music/skip.json rename to src/services/languages/ru-RU/music/skip.json diff --git a/src/languages/ru-RU/music/stop.json b/src/services/languages/ru-RU/music/stop.json similarity index 100% rename from src/languages/ru-RU/music/stop.json rename to src/services/languages/ru-RU/music/stop.json diff --git a/src/languages/ru-RU/music/volume.json b/src/services/languages/ru-RU/music/volume.json similarity index 100% rename from src/languages/ru-RU/music/volume.json rename to src/services/languages/ru-RU/music/volume.json diff --git a/src/languages/ru-RU/owner/announcement.json b/src/services/languages/ru-RU/owner/announcement.json similarity index 100% rename from src/languages/ru-RU/owner/announcement.json rename to src/services/languages/ru-RU/owner/announcement.json diff --git a/src/languages/ru-RU/owner/debug.json b/src/services/languages/ru-RU/owner/debug.json similarity index 100% rename from src/languages/ru-RU/owner/debug.json rename to src/services/languages/ru-RU/owner/debug.json diff --git a/src/languages/ru-RU/owner/eval.json b/src/services/languages/ru-RU/owner/eval.json similarity index 100% rename from src/languages/ru-RU/owner/eval.json rename to src/services/languages/ru-RU/owner/eval.json diff --git a/src/languages/ru-RU/owner/reload.json b/src/services/languages/ru-RU/owner/reload.json similarity index 100% rename from src/languages/ru-RU/owner/reload.json rename to src/services/languages/ru-RU/owner/reload.json diff --git a/src/languages/ru-RU/owner/say.json b/src/services/languages/ru-RU/owner/say.json similarity index 100% rename from src/languages/ru-RU/owner/say.json rename to src/services/languages/ru-RU/owner/say.json diff --git a/src/languages/ru-RU/owner/servers.json b/src/services/languages/ru-RU/owner/servers.json similarity index 100% rename from src/languages/ru-RU/owner/servers.json rename to src/services/languages/ru-RU/owner/servers.json diff --git a/src/languages/ru-RU/tickets/adduser.json b/src/services/languages/ru-RU/tickets/adduser.json similarity index 100% rename from src/languages/ru-RU/tickets/adduser.json rename to src/services/languages/ru-RU/tickets/adduser.json diff --git a/src/languages/ru-RU/tickets/closeticket.json b/src/services/languages/ru-RU/tickets/closeticket.json similarity index 100% rename from src/languages/ru-RU/tickets/closeticket.json rename to src/services/languages/ru-RU/tickets/closeticket.json diff --git a/src/languages/ru-RU/tickets/createticketembed.json b/src/services/languages/ru-RU/tickets/createticketembed.json similarity index 100% rename from src/languages/ru-RU/tickets/createticketembed.json rename to src/services/languages/ru-RU/tickets/createticketembed.json diff --git a/src/languages/ru-RU/tickets/removeuser.json b/src/services/languages/ru-RU/tickets/removeuser.json similarity index 100% rename from src/languages/ru-RU/tickets/removeuser.json rename to src/services/languages/ru-RU/tickets/removeuser.json diff --git a/src/languages/uk-UA/administration/addemoji.json b/src/services/languages/uk-UA/administration/addemoji.json similarity index 100% rename from src/languages/uk-UA/administration/addemoji.json rename to src/services/languages/uk-UA/administration/addemoji.json diff --git a/src/languages/uk-UA/administration/automod.json b/src/services/languages/uk-UA/administration/automod.json similarity index 100% rename from src/languages/uk-UA/administration/automod.json rename to src/services/languages/uk-UA/administration/automod.json diff --git a/src/languages/uk-UA/administration/autorole.json b/src/services/languages/uk-UA/administration/autorole.json similarity index 100% rename from src/languages/uk-UA/administration/autorole.json rename to src/services/languages/uk-UA/administration/autorole.json diff --git a/src/languages/uk-UA/administration/config.json b/src/services/languages/uk-UA/administration/config.json similarity index 100% rename from src/languages/uk-UA/administration/config.json rename to src/services/languages/uk-UA/administration/config.json diff --git a/src/languages/uk-UA/administration/deletemod.json b/src/services/languages/uk-UA/administration/deletemod.json similarity index 100% rename from src/languages/uk-UA/administration/deletemod.json rename to src/services/languages/uk-UA/administration/deletemod.json diff --git a/src/languages/uk-UA/administration/goodbye.json b/src/services/languages/uk-UA/administration/goodbye.json similarity index 100% rename from src/languages/uk-UA/administration/goodbye.json rename to src/services/languages/uk-UA/administration/goodbye.json diff --git a/src/languages/uk-UA/administration/selectroles.json b/src/services/languages/uk-UA/administration/selectroles.json similarity index 100% rename from src/languages/uk-UA/administration/selectroles.json rename to src/services/languages/uk-UA/administration/selectroles.json diff --git a/src/languages/uk-UA/administration/set.json b/src/services/languages/uk-UA/administration/set.json similarity index 100% rename from src/languages/uk-UA/administration/set.json rename to src/services/languages/uk-UA/administration/set.json diff --git a/src/languages/uk-UA/administration/setlang.json b/src/services/languages/uk-UA/administration/setlang.json similarity index 100% rename from src/languages/uk-UA/administration/setlang.json rename to src/services/languages/uk-UA/administration/setlang.json diff --git a/src/languages/uk-UA/administration/stealemoji.json b/src/services/languages/uk-UA/administration/stealemoji.json similarity index 100% rename from src/languages/uk-UA/administration/stealemoji.json rename to src/services/languages/uk-UA/administration/stealemoji.json diff --git a/src/languages/uk-UA/administration/welcome.json b/src/services/languages/uk-UA/administration/welcome.json similarity index 100% rename from src/languages/uk-UA/administration/welcome.json rename to src/services/languages/uk-UA/administration/welcome.json diff --git a/src/languages/uk-UA/beatrun/courses.json b/src/services/languages/uk-UA/beatrun/courses.json similarity index 100% rename from src/languages/uk-UA/beatrun/courses.json rename to src/services/languages/uk-UA/beatrun/courses.json diff --git a/src/languages/uk-UA/common.json b/src/services/languages/uk-UA/common.json similarity index 100% rename from src/languages/uk-UA/common.json rename to src/services/languages/uk-UA/common.json diff --git a/src/languages/uk-UA/economy/achievements.json b/src/services/languages/uk-UA/economy/achievements.json similarity index 100% rename from src/languages/uk-UA/economy/achievements.json rename to src/services/languages/uk-UA/economy/achievements.json diff --git a/src/languages/uk-UA/economy/bank.json b/src/services/languages/uk-UA/economy/bank.json similarity index 100% rename from src/languages/uk-UA/economy/bank.json rename to src/services/languages/uk-UA/economy/bank.json diff --git a/src/languages/uk-UA/economy/birthdate.json b/src/services/languages/uk-UA/economy/birthdate.json similarity index 100% rename from src/languages/uk-UA/economy/birthdate.json rename to src/services/languages/uk-UA/economy/birthdate.json diff --git a/src/languages/uk-UA/economy/divorce.json b/src/services/languages/uk-UA/economy/divorce.json similarity index 100% rename from src/languages/uk-UA/economy/divorce.json rename to src/services/languages/uk-UA/economy/divorce.json diff --git a/src/languages/uk-UA/economy/importmee6.json b/src/services/languages/uk-UA/economy/importmee6.json similarity index 100% rename from src/languages/uk-UA/economy/importmee6.json rename to src/services/languages/uk-UA/economy/importmee6.json diff --git a/src/languages/uk-UA/economy/leaderboard.json b/src/services/languages/uk-UA/economy/leaderboard.json similarity index 100% rename from src/languages/uk-UA/economy/leaderboard.json rename to src/services/languages/uk-UA/economy/leaderboard.json diff --git a/src/languages/uk-UA/economy/marry.json b/src/services/languages/uk-UA/economy/marry.json similarity index 100% rename from src/languages/uk-UA/economy/marry.json rename to src/services/languages/uk-UA/economy/marry.json diff --git a/src/languages/uk-UA/economy/money.json b/src/services/languages/uk-UA/economy/money.json similarity index 100% rename from src/languages/uk-UA/economy/money.json rename to src/services/languages/uk-UA/economy/money.json diff --git a/src/languages/uk-UA/economy/pay.json b/src/services/languages/uk-UA/economy/pay.json similarity index 100% rename from src/languages/uk-UA/economy/pay.json rename to src/services/languages/uk-UA/economy/pay.json diff --git a/src/languages/uk-UA/economy/profile.json b/src/services/languages/uk-UA/economy/profile.json similarity index 100% rename from src/languages/uk-UA/economy/profile.json rename to src/services/languages/uk-UA/economy/profile.json diff --git a/src/languages/uk-UA/economy/rep.json b/src/services/languages/uk-UA/economy/rep.json similarity index 100% rename from src/languages/uk-UA/economy/rep.json rename to src/services/languages/uk-UA/economy/rep.json diff --git a/src/languages/uk-UA/economy/rob.json b/src/services/languages/uk-UA/economy/rob.json similarity index 100% rename from src/languages/uk-UA/economy/rob.json rename to src/services/languages/uk-UA/economy/rob.json diff --git a/src/languages/uk-UA/economy/setbio.json b/src/services/languages/uk-UA/economy/setbio.json similarity index 100% rename from src/languages/uk-UA/economy/setbio.json rename to src/services/languages/uk-UA/economy/setbio.json diff --git a/src/languages/uk-UA/economy/slots.json b/src/services/languages/uk-UA/economy/slots.json similarity index 100% rename from src/languages/uk-UA/economy/slots.json rename to src/services/languages/uk-UA/economy/slots.json diff --git a/src/languages/uk-UA/economy/transactions.json b/src/services/languages/uk-UA/economy/transactions.json similarity index 100% rename from src/languages/uk-UA/economy/transactions.json rename to src/services/languages/uk-UA/economy/transactions.json diff --git a/src/languages/uk-UA/economy/work.json b/src/services/languages/uk-UA/economy/work.json similarity index 100% rename from src/languages/uk-UA/economy/work.json rename to src/services/languages/uk-UA/economy/work.json diff --git a/src/languages/uk-UA/fun/8ball.json b/src/services/languages/uk-UA/fun/8ball.json similarity index 100% rename from src/languages/uk-UA/fun/8ball.json rename to src/services/languages/uk-UA/fun/8ball.json diff --git a/src/languages/uk-UA/fun/cat.json b/src/services/languages/uk-UA/fun/cat.json similarity index 100% rename from src/languages/uk-UA/fun/cat.json rename to src/services/languages/uk-UA/fun/cat.json diff --git a/src/languages/uk-UA/fun/dog.json b/src/services/languages/uk-UA/fun/dog.json similarity index 100% rename from src/languages/uk-UA/fun/dog.json rename to src/services/languages/uk-UA/fun/dog.json diff --git a/src/languages/uk-UA/fun/lmgtfy.json b/src/services/languages/uk-UA/fun/lmgtfy.json similarity index 100% rename from src/languages/uk-UA/fun/lmgtfy.json rename to src/services/languages/uk-UA/fun/lmgtfy.json diff --git a/src/languages/uk-UA/fun/lovecalc.json b/src/services/languages/uk-UA/fun/lovecalc.json similarity index 100% rename from src/languages/uk-UA/fun/lovecalc.json rename to src/services/languages/uk-UA/fun/lovecalc.json diff --git a/src/languages/uk-UA/fun/memes.json b/src/services/languages/uk-UA/fun/memes.json similarity index 100% rename from src/languages/uk-UA/fun/memes.json rename to src/services/languages/uk-UA/fun/memes.json diff --git a/src/languages/uk-UA/fun/number.json b/src/services/languages/uk-UA/fun/number.json similarity index 100% rename from src/languages/uk-UA/fun/number.json rename to src/services/languages/uk-UA/fun/number.json diff --git a/src/languages/uk-UA/fun/tictactoe.json b/src/services/languages/uk-UA/fun/tictactoe.json similarity index 100% rename from src/languages/uk-UA/fun/tictactoe.json rename to src/services/languages/uk-UA/fun/tictactoe.json diff --git a/src/languages/uk-UA/general/afk.json b/src/services/languages/uk-UA/general/afk.json similarity index 100% rename from src/languages/uk-UA/general/afk.json rename to src/services/languages/uk-UA/general/afk.json diff --git a/src/languages/uk-UA/general/avatar.json b/src/services/languages/uk-UA/general/avatar.json similarity index 100% rename from src/languages/uk-UA/general/avatar.json rename to src/services/languages/uk-UA/general/avatar.json diff --git a/src/languages/uk-UA/general/boosters.json b/src/services/languages/uk-UA/general/boosters.json similarity index 100% rename from src/languages/uk-UA/general/boosters.json rename to src/services/languages/uk-UA/general/boosters.json diff --git a/src/languages/uk-UA/general/emoji.json b/src/services/languages/uk-UA/general/emoji.json similarity index 100% rename from src/languages/uk-UA/general/emoji.json rename to src/services/languages/uk-UA/general/emoji.json diff --git a/src/languages/uk-UA/general/help.json b/src/services/languages/uk-UA/general/help.json similarity index 100% rename from src/languages/uk-UA/general/help.json rename to src/services/languages/uk-UA/general/help.json diff --git a/src/languages/uk-UA/general/info.json b/src/services/languages/uk-UA/general/info.json similarity index 100% rename from src/languages/uk-UA/general/info.json rename to src/services/languages/uk-UA/general/info.json diff --git a/src/languages/uk-UA/general/minecraft.json b/src/services/languages/uk-UA/general/minecraft.json similarity index 100% rename from src/languages/uk-UA/general/minecraft.json rename to src/services/languages/uk-UA/general/minecraft.json diff --git a/src/languages/uk-UA/general/ping.json b/src/services/languages/uk-UA/general/ping.json similarity index 100% rename from src/languages/uk-UA/general/ping.json rename to src/services/languages/uk-UA/general/ping.json diff --git a/src/languages/uk-UA/general/remindme.json b/src/services/languages/uk-UA/general/remindme.json similarity index 100% rename from src/languages/uk-UA/general/remindme.json rename to src/services/languages/uk-UA/general/remindme.json diff --git a/src/languages/uk-UA/general/reminds.json b/src/services/languages/uk-UA/general/reminds.json similarity index 100% rename from src/languages/uk-UA/general/reminds.json rename to src/services/languages/uk-UA/general/reminds.json diff --git a/src/languages/uk-UA/general/report.json b/src/services/languages/uk-UA/general/report.json similarity index 100% rename from src/languages/uk-UA/general/report.json rename to src/services/languages/uk-UA/general/report.json diff --git a/src/languages/uk-UA/general/shorturl.json b/src/services/languages/uk-UA/general/shorturl.json similarity index 100% rename from src/languages/uk-UA/general/shorturl.json rename to src/services/languages/uk-UA/general/shorturl.json diff --git a/src/languages/uk-UA/general/staff.json b/src/services/languages/uk-UA/general/staff.json similarity index 100% rename from src/languages/uk-UA/general/staff.json rename to src/services/languages/uk-UA/general/staff.json diff --git a/src/languages/uk-UA/general/stats.json b/src/services/languages/uk-UA/general/stats.json similarity index 100% rename from src/languages/uk-UA/general/stats.json rename to src/services/languages/uk-UA/general/stats.json diff --git a/src/languages/uk-UA/general/suggest.json b/src/services/languages/uk-UA/general/suggest.json similarity index 100% rename from src/languages/uk-UA/general/suggest.json rename to src/services/languages/uk-UA/general/suggest.json diff --git a/src/languages/uk-UA/general/whois.json b/src/services/languages/uk-UA/general/whois.json similarity index 100% rename from src/languages/uk-UA/general/whois.json rename to src/services/languages/uk-UA/general/whois.json diff --git a/src/languages/uk-UA/iat/checkjar.json b/src/services/languages/uk-UA/iat/checkjar.json similarity index 100% rename from src/languages/uk-UA/iat/checkjar.json rename to src/services/languages/uk-UA/iat/checkjar.json diff --git a/src/languages/uk-UA/misc.json b/src/services/languages/uk-UA/misc.json similarity index 100% rename from src/languages/uk-UA/misc.json rename to src/services/languages/uk-UA/misc.json diff --git a/src/languages/uk-UA/moderation/ban.json b/src/services/languages/uk-UA/moderation/ban.json similarity index 100% rename from src/languages/uk-UA/moderation/ban.json rename to src/services/languages/uk-UA/moderation/ban.json diff --git a/src/languages/uk-UA/moderation/clear.json b/src/services/languages/uk-UA/moderation/clear.json similarity index 100% rename from src/languages/uk-UA/moderation/clear.json rename to src/services/languages/uk-UA/moderation/clear.json diff --git a/src/languages/uk-UA/moderation/clearwarns.json b/src/services/languages/uk-UA/moderation/clearwarns.json similarity index 100% rename from src/languages/uk-UA/moderation/clearwarns.json rename to src/services/languages/uk-UA/moderation/clearwarns.json diff --git a/src/languages/uk-UA/moderation/giveaway.json b/src/services/languages/uk-UA/moderation/giveaway.json similarity index 100% rename from src/languages/uk-UA/moderation/giveaway.json rename to src/services/languages/uk-UA/moderation/giveaway.json diff --git a/src/languages/uk-UA/moderation/kick.json b/src/services/languages/uk-UA/moderation/kick.json similarity index 100% rename from src/languages/uk-UA/moderation/kick.json rename to src/services/languages/uk-UA/moderation/kick.json diff --git a/src/languages/uk-UA/moderation/unban.json b/src/services/languages/uk-UA/moderation/unban.json similarity index 100% rename from src/languages/uk-UA/moderation/unban.json rename to src/services/languages/uk-UA/moderation/unban.json diff --git a/src/languages/uk-UA/moderation/untimeout.json b/src/services/languages/uk-UA/moderation/untimeout.json similarity index 100% rename from src/languages/uk-UA/moderation/untimeout.json rename to src/services/languages/uk-UA/moderation/untimeout.json diff --git a/src/languages/uk-UA/moderation/warn.json b/src/services/languages/uk-UA/moderation/warn.json similarity index 100% rename from src/languages/uk-UA/moderation/warn.json rename to src/services/languages/uk-UA/moderation/warn.json diff --git a/src/languages/uk-UA/moderation/warns.json b/src/services/languages/uk-UA/moderation/warns.json similarity index 100% rename from src/languages/uk-UA/moderation/warns.json rename to src/services/languages/uk-UA/moderation/warns.json diff --git a/src/languages/uk-UA/music/back.json b/src/services/languages/uk-UA/music/back.json similarity index 100% rename from src/languages/uk-UA/music/back.json rename to src/services/languages/uk-UA/music/back.json diff --git a/src/languages/uk-UA/music/clips.json b/src/services/languages/uk-UA/music/clips.json similarity index 100% rename from src/languages/uk-UA/music/clips.json rename to src/services/languages/uk-UA/music/clips.json diff --git a/src/languages/uk-UA/music/loop.json b/src/services/languages/uk-UA/music/loop.json similarity index 100% rename from src/languages/uk-UA/music/loop.json rename to src/services/languages/uk-UA/music/loop.json diff --git a/src/languages/uk-UA/music/nowplaying.json b/src/services/languages/uk-UA/music/nowplaying.json similarity index 100% rename from src/languages/uk-UA/music/nowplaying.json rename to src/services/languages/uk-UA/music/nowplaying.json diff --git a/src/languages/uk-UA/music/play.json b/src/services/languages/uk-UA/music/play.json similarity index 100% rename from src/languages/uk-UA/music/play.json rename to src/services/languages/uk-UA/music/play.json diff --git a/src/languages/uk-UA/music/queue.json b/src/services/languages/uk-UA/music/queue.json similarity index 100% rename from src/languages/uk-UA/music/queue.json rename to src/services/languages/uk-UA/music/queue.json diff --git a/src/languages/uk-UA/music/seek.json b/src/services/languages/uk-UA/music/seek.json similarity index 100% rename from src/languages/uk-UA/music/seek.json rename to src/services/languages/uk-UA/music/seek.json diff --git a/src/languages/uk-UA/music/shuffle.json b/src/services/languages/uk-UA/music/shuffle.json similarity index 100% rename from src/languages/uk-UA/music/shuffle.json rename to src/services/languages/uk-UA/music/shuffle.json diff --git a/src/languages/uk-UA/music/skip.json b/src/services/languages/uk-UA/music/skip.json similarity index 100% rename from src/languages/uk-UA/music/skip.json rename to src/services/languages/uk-UA/music/skip.json diff --git a/src/languages/uk-UA/music/stop.json b/src/services/languages/uk-UA/music/stop.json similarity index 100% rename from src/languages/uk-UA/music/stop.json rename to src/services/languages/uk-UA/music/stop.json diff --git a/src/languages/uk-UA/music/volume.json b/src/services/languages/uk-UA/music/volume.json similarity index 100% rename from src/languages/uk-UA/music/volume.json rename to src/services/languages/uk-UA/music/volume.json diff --git a/src/languages/uk-UA/owner/announcement.json b/src/services/languages/uk-UA/owner/announcement.json similarity index 100% rename from src/languages/uk-UA/owner/announcement.json rename to src/services/languages/uk-UA/owner/announcement.json diff --git a/src/languages/uk-UA/owner/debug.json b/src/services/languages/uk-UA/owner/debug.json similarity index 100% rename from src/languages/uk-UA/owner/debug.json rename to src/services/languages/uk-UA/owner/debug.json diff --git a/src/languages/uk-UA/owner/eval.json b/src/services/languages/uk-UA/owner/eval.json similarity index 100% rename from src/languages/uk-UA/owner/eval.json rename to src/services/languages/uk-UA/owner/eval.json diff --git a/src/languages/uk-UA/owner/reload.json b/src/services/languages/uk-UA/owner/reload.json similarity index 100% rename from src/languages/uk-UA/owner/reload.json rename to src/services/languages/uk-UA/owner/reload.json diff --git a/src/languages/uk-UA/owner/say.json b/src/services/languages/uk-UA/owner/say.json similarity index 100% rename from src/languages/uk-UA/owner/say.json rename to src/services/languages/uk-UA/owner/say.json diff --git a/src/languages/uk-UA/owner/servers.json b/src/services/languages/uk-UA/owner/servers.json similarity index 100% rename from src/languages/uk-UA/owner/servers.json rename to src/services/languages/uk-UA/owner/servers.json diff --git a/src/languages/uk-UA/tickets/adduser.json b/src/services/languages/uk-UA/tickets/adduser.json similarity index 100% rename from src/languages/uk-UA/tickets/adduser.json rename to src/services/languages/uk-UA/tickets/adduser.json diff --git a/src/languages/uk-UA/tickets/closeticket.json b/src/services/languages/uk-UA/tickets/closeticket.json similarity index 100% rename from src/languages/uk-UA/tickets/closeticket.json rename to src/services/languages/uk-UA/tickets/closeticket.json diff --git a/src/languages/uk-UA/tickets/createticketembed.json b/src/services/languages/uk-UA/tickets/createticketembed.json similarity index 100% rename from src/languages/uk-UA/tickets/createticketembed.json rename to src/services/languages/uk-UA/tickets/createticketembed.json diff --git a/src/languages/uk-UA/tickets/removeuser.json b/src/services/languages/uk-UA/tickets/removeuser.json similarity index 100% rename from src/languages/uk-UA/tickets/removeuser.json rename to src/services/languages/uk-UA/tickets/removeuser.json From c8f73bef1efe44439f6275ba23b2035f1bc7f78d Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 9 Dec 2024 13:41:36 +0300 Subject: [PATCH 16/37] refactor: delete useless depend moment --- package.json | 1 - pnpm-lock.yaml | 8 -------- src/commands/IAT/checkjar.js | 5 ++--- src/helpers/functions.js | 24 ++++-------------------- 4 files changed, 6 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 1b98402d..f00df321 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "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" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6b4d075..4740b050 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,9 +56,6 @@ importers: 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) @@ -1099,9 +1096,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==} @@ -2748,8 +2742,6 @@ snapshots: mkdirp@1.0.4: {} - moment@2.30.1: {} - mongodb-connection-string-url@3.0.1: dependencies: '@types/whatwg-url': 11.0.5 diff --git a/src/commands/IAT/checkjar.js b/src/commands/IAT/checkjar.js index 8618c3f4..2aeb8965 100644 --- a/src/commands/IAT/checkjar.js +++ b/src/commands/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/src/helpers/functions.js b/src/helpers/functions.js index 38cbb15b..578d6f55 100644 --- a/src/helpers/functions.js +++ b/src/helpers/functions.js @@ -1,5 +1,3 @@ -import moment from "moment"; - /** * Asynchronously iterates over a collection and executes a callback function for each item. * @@ -69,6 +67,7 @@ export function randomNum(min = 0, max = 100) { return Math.floor(Math.random() * (max - min + 1) + min); } + /** * Formats a date for the specified client and locale. * @@ -79,24 +78,9 @@ export function randomNum(min = 0, max = 100) { * @returns {string} The formatted date. */ export function printDate(client, date, format = null, locale = client.defaultLanguage.name) { - const languageData = client.languages.find(language => language.name === locale); - if (format === "" || format === null) format = languageData.defaultMomentFormat; - return moment(new Date(date)).locale(languageData.moment).format(format); -} -/** - * Formats a time value relative to the current time. - * - * @param {Object} client - The client object containing language data. - * @param {string|number|Date} time - The time value to format. - * @param {boolean} [type=false] - If true, formats the time as "X time ago", otherwise formats it as "in X time". - * @param {boolean} [prefix=true] - If true, includes a prefix like "in" or "ago" in the formatted time. - * @param {string} [locale=client.defaultLanguage.name] - The locale to use for formatting the time. - * @returns {string} The formatted time value. - */ -export function convertTime(client, time, type = false, prefix = true, locale = client.defaultLanguage.name) { - const languageData = client.languages.find(language => language.name === locale); - const m = moment(time).locale(languageData.moment); - return type ? m.toNow(!prefix) : m.fromNow(!prefix); + 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); } /** From 9a00f82d03c5a7f951c540cfdfdc606b63304a69 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 11 Dec 2024 15:07:11 +0300 Subject: [PATCH 17/37] build: delete unused depend --- package.json | 1 - pnpm-lock.yaml | 3 --- 2 files changed, 4 deletions(-) diff --git a/package.json b/package.json index f00df321..ef00a397 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4740b050..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) From b634d9347de24869b62ef1e0878ff7ae8192f55b Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 11 Dec 2024 15:11:28 +0300 Subject: [PATCH 18/37] feat(config): config service --- .gitignore | 2 +- config.sample.js | 50 ---------------------------- config.sample.json | 26 +++++++++++++++ src/base/Client.js | 1 - src/constants/index.js | 1 + src/services/config/index.js | 63 ++++++++++++++++++++++++++++++++++++ src/structures/client.js | 8 +++-- 7 files changed, 96 insertions(+), 55 deletions(-) delete mode 100644 config.sample.js create mode 100644 config.sample.json create mode 100644 src/services/config/index.js 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/config.sample.js b/config.sample.js deleted file mode 100644 index c2508e29..00000000 --- a/config.sample.js +++ /dev/null @@ -1,50 +0,0 @@ -export default { - /* 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 - }, - /* Dashboard configuration */ - /* dashboard: { - enabled: false, // Whether the dashboard is enabled or not - maintanceKey: "letmein", // Maintance key - port: 80, // Dashboard port - domain: "http://localhost", // The base URL of the dashboard without / at the end - secret: "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Your Bot's Client Secret - logs: "123456789098765432", // The channel ID for logs - }, */ - /* Embeds defaults */ - embed: { - color: "#00FF00", // Color - footer: { - text: - "My Discord Bot | v" + - import("./package.json", { - with: { type: "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: {}, -}; diff --git a/config.sample.json b/config.sample.json new file mode 100644 index 00000000..66d68d51 --- /dev/null +++ b/config.sample.json @@ -0,0 +1,26 @@ +{ + "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": {} +} \ No newline at end of file diff --git a/src/base/Client.js b/src/base/Client.js index 45f45876..db50e763 100644 --- a/src/base/Client.js +++ b/src/base/Client.js @@ -10,7 +10,6 @@ import { promises as fs } from "fs"; import { setTimeout } from "timers/promises"; import mongoose from "mongoose"; -import config from "../../config.js"; import * as emojis from "../../emojis.json"; import langs from "../languages/language-meta.js"; import logger from "../helpers/logger.js"; diff --git a/src/constants/index.js b/src/constants/index.js index 5ee045d6..fdcb5a1b 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -1,3 +1,4 @@ import path from "node:path"; export const PROJECT_ROOT = path.join(import.meta.dirname, ".."); +export const CONFIG_PATH = path.join(PROJECT_ROOT, "..", "config.json"); 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/structures/client.js b/src/structures/client.js index d614123d..50db67d6 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -1,9 +1,9 @@ import { Client } from "discord.js"; -import { config } from "../../config.js"; 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"; export class ExtendedClient extends Client { /** @@ -11,14 +11,16 @@ export class ExtendedClient extends Client { */ constructor(options) { super(options); - this.adapter = new MongooseAdapter(config.mongoDB); + + this.configService = new configService(); + this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); } async init() { try { await this.adapter.connect(); - return this.login(config.token) + return this.login(this.configService.get("token")) .then(async () => await Promise.all([initCommands(), initEvents()])) .catch(console.error); } catch (error) { From 55e0118e243bb2dc37c363f1f2b8e9040602fde2 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 11 Dec 2024 15:12:32 +0300 Subject: [PATCH 19/37] feat: embed builder util --- src/utils/create-embed.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/utils/create-embed.js diff --git a/src/utils/create-embed.js b/src/utils/create-embed.js new file mode 100644 index 00000000..dbf1c281 --- /dev/null +++ b/src/utils/create-embed.js @@ -0,0 +1,14 @@ +import { EmbedBuilder } from "discord.js"; +import { client } from "../index.js"; + +/** + * + * @param {import("discord.js").EmbedData} data - embed data + * @returns The generated EmbedBuilder instance. + */ +export const createEmbed = data => + 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, + }); From 7109a2a0eff6c8a9048e43497c4afd74f4ddb416 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 11 Dec 2024 15:13:07 +0300 Subject: [PATCH 20/37] refactor: added barrel file to utils --- src/handlers/command-handler/index.js | 2 +- src/handlers/event-handler/index.js | 2 +- src/utils/index.js | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/utils/index.js diff --git a/src/handlers/command-handler/index.js b/src/handlers/command-handler/index.js index 96ffe039..a62b4bb4 100644 --- a/src/handlers/command-handler/index.js +++ b/src/handlers/command-handler/index.js @@ -1,6 +1,6 @@ import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; -import { getFilePaths } from "../../utils/get-path.js"; +import { getFilePaths } from "../../utils/index.js"; import { toFileURL } from "../../utils/resolve-file.js"; import registerCommands from "./functions/registerCommands.js"; diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index 6200e0a6..bda401f0 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -1,6 +1,6 @@ import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; -import { getFilePaths } from "../../utils/get-path.js"; +import { getFilePaths } from "../../utils/index.js"; import { toFileURL } from "../../utils/resolve-file.js"; export const events = []; 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"; From bce6242e1eb39d87b26bb729500602df907a2f73 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Thu, 12 Dec 2024 12:58:37 +0300 Subject: [PATCH 21/37] feat: added paths in config --- config.sample.json | 8 +++++++- src/handlers/command-handler/index.js | 4 +++- src/handlers/event-handler/index.js | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/config.sample.json b/config.sample.json index 66d68d51..46c97555 100644 --- a/config.sample.json +++ b/config.sample.json @@ -22,5 +22,11 @@ "owner": { "id": "123456789098765432" }, - "apiKeys": {} + "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/src/handlers/command-handler/index.js b/src/handlers/command-handler/index.js index a62b4bb4..6afbb311 100644 --- a/src/handlers/command-handler/index.js +++ b/src/handlers/command-handler/index.js @@ -1,3 +1,4 @@ +import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/index.js"; @@ -16,7 +17,8 @@ export const init = async () => { }; const buildCommands = async () => { - const commandFilePaths = (await getFilePaths("./newCommands", true)).filter(path => path.endsWith(".js")); + 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)); diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index bda401f0..a057b156 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -1,3 +1,4 @@ +import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; import { client } from "../../index.js"; import { getFilePaths } from "../../utils/index.js"; @@ -12,7 +13,8 @@ export const init = async () => { const buildEvents = async () => { try { - const eventFilePaths = (await getFilePaths("./newEvents", true)).filter(path => path.endsWith(".js")); + 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)); From 62ab9250fccf8ea067d5926da67687e99cd1576a Mon Sep 17 00:00:00 2001 From: Slincnik Date: Thu, 12 Dec 2024 13:01:59 +0300 Subject: [PATCH 22/37] feat: internationalization service --- src/models/GuildModel.js | 4 +- src/services/languages/index.js | 71 +++++++++++++++++++ src/services/languages/language-meta.js | 3 - .../en-US/administration/addemoji.json | 0 .../en-US/administration/automod.json | 0 .../en-US/administration/autorole.json | 0 .../en-US/administration/config.json | 0 .../en-US/administration/deletemod.json | 0 .../en-US/administration/goodbye.json | 0 .../en-US/administration/selectroles.json | 0 .../en-US/administration/set.json | 0 .../en-US/administration/setlang.json | 0 .../en-US/administration/stealemoji.json | 0 .../en-US/administration/welcome.json | 0 .../{ => locales}/en-US/beatrun/courses.json | 0 .../languages/{ => locales}/en-US/common.json | 0 .../en-US/economy/achievements.json | 0 .../{ => locales}/en-US/economy/bank.json | 0 .../en-US/economy/birthdate.json | 0 .../{ => locales}/en-US/economy/divorce.json | 0 .../en-US/economy/importmee6.json | 0 .../en-US/economy/leaderboard.json | 0 .../{ => locales}/en-US/economy/marry.json | 0 .../{ => locales}/en-US/economy/money.json | 0 .../{ => locales}/en-US/economy/pay.json | 0 .../{ => locales}/en-US/economy/profile.json | 0 .../{ => locales}/en-US/economy/rep.json | 0 .../{ => locales}/en-US/economy/rob.json | 0 .../{ => locales}/en-US/economy/setbio.json | 0 .../{ => locales}/en-US/economy/slots.json | 0 .../en-US/economy/transactions.json | 0 .../{ => locales}/en-US/economy/work.json | 0 .../{ => locales}/en-US/fun/8ball.json | 0 .../{ => locales}/en-US/fun/cat.json | 0 .../{ => locales}/en-US/fun/dog.json | 0 .../{ => locales}/en-US/fun/lmgtfy.json | 0 .../{ => locales}/en-US/fun/lovecalc.json | 0 .../{ => locales}/en-US/fun/memes.json | 0 .../{ => locales}/en-US/fun/number.json | 0 .../{ => locales}/en-US/fun/tictactoe.json | 0 .../{ => locales}/en-US/general/afk.json | 0 .../{ => locales}/en-US/general/avatar.json | 0 .../{ => locales}/en-US/general/boosters.json | 0 .../{ => locales}/en-US/general/emoji.json | 0 .../{ => locales}/en-US/general/help.json | 0 .../{ => locales}/en-US/general/info.json | 0 .../en-US/general/minecraft.json | 0 .../{ => locales}/en-US/general/ping.json | 0 .../{ => locales}/en-US/general/remindme.json | 0 .../{ => locales}/en-US/general/reminds.json | 0 .../{ => locales}/en-US/general/report.json | 0 .../{ => locales}/en-US/general/shorturl.json | 0 .../{ => locales}/en-US/general/staff.json | 0 .../{ => locales}/en-US/general/stats.json | 0 .../{ => locales}/en-US/general/suggest.json | 0 .../{ => locales}/en-US/general/whois.json | 0 .../{ => locales}/en-US/iat/checkjar.json | 0 .../languages/{ => locales}/en-US/misc.json | 0 .../{ => locales}/en-US/moderation/ban.json | 0 .../{ => locales}/en-US/moderation/clear.json | 0 .../en-US/moderation/clearwarns.json | 0 .../en-US/moderation/giveaway.json | 0 .../{ => locales}/en-US/moderation/kick.json | 0 .../{ => locales}/en-US/moderation/unban.json | 0 .../en-US/moderation/untimeout.json | 0 .../{ => locales}/en-US/moderation/warn.json | 0 .../{ => locales}/en-US/moderation/warns.json | 0 .../{ => locales}/en-US/music/back.json | 0 .../{ => locales}/en-US/music/clips.json | 0 .../{ => locales}/en-US/music/loop.json | 0 .../{ => locales}/en-US/music/nowplaying.json | 0 .../{ => locales}/en-US/music/play.json | 0 .../{ => locales}/en-US/music/queue.json | 0 .../{ => locales}/en-US/music/seek.json | 0 .../{ => locales}/en-US/music/shuffle.json | 0 .../{ => locales}/en-US/music/skip.json | 0 .../{ => locales}/en-US/music/stop.json | 0 .../{ => locales}/en-US/music/volume.json | 0 .../en-US/owner/announcement.json | 0 .../{ => locales}/en-US/owner/debug.json | 0 .../{ => locales}/en-US/owner/eval.json | 0 .../{ => locales}/en-US/owner/reload.json | 0 .../{ => locales}/en-US/owner/say.json | 0 .../{ => locales}/en-US/owner/servers.json | 0 .../{ => locales}/en-US/tickets/adduser.json | 0 .../en-US/tickets/closeticket.json | 0 .../en-US/tickets/createticketembed.json | 0 .../en-US/tickets/removeuser.json | 0 .../ru-RU/administration/addemoji.json | 0 .../ru-RU/administration/automod.json | 0 .../ru-RU/administration/autorole.json | 0 .../ru-RU/administration/config.json | 0 .../ru-RU/administration/deletemod.json | 0 .../ru-RU/administration/goodbye.json | 0 .../ru-RU/administration/selectroles.json | 0 .../ru-RU/administration/set.json | 0 .../ru-RU/administration/setlang.json | 0 .../ru-RU/administration/stealemoji.json | 0 .../ru-RU/administration/welcome.json | 0 .../{ => locales}/ru-RU/beatrun/courses.json | 0 .../languages/{ => locales}/ru-RU/common.json | 0 .../ru-RU/economy/achievements.json | 0 .../{ => locales}/ru-RU/economy/bank.json | 0 .../ru-RU/economy/birthdate.json | 0 .../{ => locales}/ru-RU/economy/divorce.json | 0 .../ru-RU/economy/importmee6.json | 0 .../ru-RU/economy/leaderboard.json | 0 .../{ => locales}/ru-RU/economy/marry.json | 0 .../{ => locales}/ru-RU/economy/money.json | 0 .../{ => locales}/ru-RU/economy/pay.json | 0 .../{ => locales}/ru-RU/economy/profile.json | 0 .../{ => locales}/ru-RU/economy/rep.json | 0 .../{ => locales}/ru-RU/economy/rob.json | 0 .../{ => locales}/ru-RU/economy/setbio.json | 0 .../{ => locales}/ru-RU/economy/slots.json | 0 .../ru-RU/economy/transactions.json | 0 .../{ => locales}/ru-RU/economy/work.json | 0 .../{ => locales}/ru-RU/fun/8ball.json | 0 .../{ => locales}/ru-RU/fun/cat.json | 0 .../{ => locales}/ru-RU/fun/dog.json | 0 .../{ => locales}/ru-RU/fun/lmgtfy.json | 0 .../{ => locales}/ru-RU/fun/lovecalc.json | 0 .../{ => locales}/ru-RU/fun/memes.json | 0 .../{ => locales}/ru-RU/fun/number.json | 0 .../{ => locales}/ru-RU/fun/tictactoe.json | 0 .../{ => locales}/ru-RU/general/afk.json | 0 .../{ => locales}/ru-RU/general/avatar.json | 0 .../{ => locales}/ru-RU/general/boosters.json | 0 .../{ => locales}/ru-RU/general/emoji.json | 0 .../{ => locales}/ru-RU/general/help.json | 0 .../{ => locales}/ru-RU/general/info.json | 0 .../ru-RU/general/minecraft.json | 0 .../{ => locales}/ru-RU/general/ping.json | 0 .../{ => locales}/ru-RU/general/remindme.json | 0 .../{ => locales}/ru-RU/general/reminds.json | 0 .../{ => locales}/ru-RU/general/report.json | 0 .../{ => locales}/ru-RU/general/shorturl.json | 0 .../{ => locales}/ru-RU/general/staff.json | 0 .../{ => locales}/ru-RU/general/stats.json | 0 .../{ => locales}/ru-RU/general/suggest.json | 0 .../{ => locales}/ru-RU/general/whois.json | 0 .../{ => locales}/ru-RU/iat/checkjar.json | 0 .../languages/{ => locales}/ru-RU/misc.json | 0 .../{ => locales}/ru-RU/moderation/ban.json | 0 .../{ => locales}/ru-RU/moderation/clear.json | 0 .../ru-RU/moderation/clearwarns.json | 0 .../ru-RU/moderation/giveaway.json | 0 .../{ => locales}/ru-RU/moderation/kick.json | 0 .../{ => locales}/ru-RU/moderation/unban.json | 0 .../ru-RU/moderation/untimeout.json | 0 .../{ => locales}/ru-RU/moderation/warn.json | 0 .../{ => locales}/ru-RU/moderation/warns.json | 0 .../{ => locales}/ru-RU/music/back.json | 0 .../{ => locales}/ru-RU/music/clips.json | 0 .../{ => locales}/ru-RU/music/loop.json | 0 .../{ => locales}/ru-RU/music/nowplaying.json | 0 .../{ => locales}/ru-RU/music/play.json | 0 .../{ => locales}/ru-RU/music/queue.json | 0 .../{ => locales}/ru-RU/music/seek.json | 0 .../{ => locales}/ru-RU/music/shuffle.json | 0 .../{ => locales}/ru-RU/music/skip.json | 0 .../{ => locales}/ru-RU/music/stop.json | 0 .../{ => locales}/ru-RU/music/volume.json | 0 .../ru-RU/owner/announcement.json | 0 .../{ => locales}/ru-RU/owner/debug.json | 0 .../{ => locales}/ru-RU/owner/eval.json | 0 .../{ => locales}/ru-RU/owner/reload.json | 0 .../{ => locales}/ru-RU/owner/say.json | 0 .../{ => locales}/ru-RU/owner/servers.json | 0 .../{ => locales}/ru-RU/tickets/adduser.json | 0 .../ru-RU/tickets/closeticket.json | 0 .../ru-RU/tickets/createticketembed.json | 0 .../ru-RU/tickets/removeuser.json | 0 .../uk-UA/administration/addemoji.json | 0 .../uk-UA/administration/automod.json | 0 .../uk-UA/administration/autorole.json | 0 .../uk-UA/administration/config.json | 0 .../uk-UA/administration/deletemod.json | 0 .../uk-UA/administration/goodbye.json | 0 .../uk-UA/administration/selectroles.json | 0 .../uk-UA/administration/set.json | 0 .../uk-UA/administration/setlang.json | 0 .../uk-UA/administration/stealemoji.json | 0 .../uk-UA/administration/welcome.json | 0 .../{ => locales}/uk-UA/beatrun/courses.json | 0 .../languages/{ => locales}/uk-UA/common.json | 0 .../uk-UA/economy/achievements.json | 0 .../{ => locales}/uk-UA/economy/bank.json | 0 .../uk-UA/economy/birthdate.json | 0 .../{ => locales}/uk-UA/economy/divorce.json | 0 .../uk-UA/economy/importmee6.json | 0 .../uk-UA/economy/leaderboard.json | 0 .../{ => locales}/uk-UA/economy/marry.json | 0 .../{ => locales}/uk-UA/economy/money.json | 0 .../{ => locales}/uk-UA/economy/pay.json | 0 .../{ => locales}/uk-UA/economy/profile.json | 0 .../{ => locales}/uk-UA/economy/rep.json | 0 .../{ => locales}/uk-UA/economy/rob.json | 0 .../{ => locales}/uk-UA/economy/setbio.json | 0 .../{ => locales}/uk-UA/economy/slots.json | 0 .../uk-UA/economy/transactions.json | 0 .../{ => locales}/uk-UA/economy/work.json | 0 .../{ => locales}/uk-UA/fun/8ball.json | 0 .../{ => locales}/uk-UA/fun/cat.json | 0 .../{ => locales}/uk-UA/fun/dog.json | 0 .../{ => locales}/uk-UA/fun/lmgtfy.json | 0 .../{ => locales}/uk-UA/fun/lovecalc.json | 0 .../{ => locales}/uk-UA/fun/memes.json | 0 .../{ => locales}/uk-UA/fun/number.json | 0 .../{ => locales}/uk-UA/fun/tictactoe.json | 0 .../{ => locales}/uk-UA/general/afk.json | 0 .../{ => locales}/uk-UA/general/avatar.json | 0 .../{ => locales}/uk-UA/general/boosters.json | 0 .../{ => locales}/uk-UA/general/emoji.json | 0 .../{ => locales}/uk-UA/general/help.json | 0 .../{ => locales}/uk-UA/general/info.json | 0 .../uk-UA/general/minecraft.json | 0 .../{ => locales}/uk-UA/general/ping.json | 0 .../{ => locales}/uk-UA/general/remindme.json | 0 .../{ => locales}/uk-UA/general/reminds.json | 0 .../{ => locales}/uk-UA/general/report.json | 0 .../{ => locales}/uk-UA/general/shorturl.json | 0 .../{ => locales}/uk-UA/general/staff.json | 0 .../{ => locales}/uk-UA/general/stats.json | 0 .../{ => locales}/uk-UA/general/suggest.json | 0 .../{ => locales}/uk-UA/general/whois.json | 0 .../{ => locales}/uk-UA/iat/checkjar.json | 0 .../languages/{ => locales}/uk-UA/misc.json | 0 .../{ => locales}/uk-UA/moderation/ban.json | 0 .../{ => locales}/uk-UA/moderation/clear.json | 0 .../uk-UA/moderation/clearwarns.json | 0 .../uk-UA/moderation/giveaway.json | 0 .../{ => locales}/uk-UA/moderation/kick.json | 0 .../{ => locales}/uk-UA/moderation/unban.json | 0 .../uk-UA/moderation/untimeout.json | 0 .../{ => locales}/uk-UA/moderation/warn.json | 0 .../{ => locales}/uk-UA/moderation/warns.json | 0 .../{ => locales}/uk-UA/music/back.json | 0 .../{ => locales}/uk-UA/music/clips.json | 0 .../{ => locales}/uk-UA/music/loop.json | 0 .../{ => locales}/uk-UA/music/nowplaying.json | 0 .../{ => locales}/uk-UA/music/play.json | 0 .../{ => locales}/uk-UA/music/queue.json | 0 .../{ => locales}/uk-UA/music/seek.json | 0 .../{ => locales}/uk-UA/music/shuffle.json | 0 .../{ => locales}/uk-UA/music/skip.json | 0 .../{ => locales}/uk-UA/music/stop.json | 0 .../{ => locales}/uk-UA/music/volume.json | 0 .../uk-UA/owner/announcement.json | 0 .../{ => locales}/uk-UA/owner/debug.json | 0 .../{ => locales}/uk-UA/owner/eval.json | 0 .../{ => locales}/uk-UA/owner/reload.json | 0 .../{ => locales}/uk-UA/owner/say.json | 0 .../{ => locales}/uk-UA/owner/servers.json | 0 .../{ => locales}/uk-UA/tickets/adduser.json | 0 .../uk-UA/tickets/closeticket.json | 0 .../uk-UA/tickets/createticketembed.json | 0 .../uk-UA/tickets/removeuser.json | 0 src/structures/client.js | 6 +- 259 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 src/services/languages/index.js rename src/services/languages/{ => locales}/en-US/administration/addemoji.json (100%) rename src/services/languages/{ => locales}/en-US/administration/automod.json (100%) rename src/services/languages/{ => locales}/en-US/administration/autorole.json (100%) rename src/services/languages/{ => locales}/en-US/administration/config.json (100%) rename src/services/languages/{ => locales}/en-US/administration/deletemod.json (100%) rename src/services/languages/{ => locales}/en-US/administration/goodbye.json (100%) rename src/services/languages/{ => locales}/en-US/administration/selectroles.json (100%) rename src/services/languages/{ => locales}/en-US/administration/set.json (100%) rename src/services/languages/{ => locales}/en-US/administration/setlang.json (100%) rename src/services/languages/{ => locales}/en-US/administration/stealemoji.json (100%) rename src/services/languages/{ => locales}/en-US/administration/welcome.json (100%) rename src/services/languages/{ => locales}/en-US/beatrun/courses.json (100%) rename src/services/languages/{ => locales}/en-US/common.json (100%) rename src/services/languages/{ => locales}/en-US/economy/achievements.json (100%) rename src/services/languages/{ => locales}/en-US/economy/bank.json (100%) rename src/services/languages/{ => locales}/en-US/economy/birthdate.json (100%) rename src/services/languages/{ => locales}/en-US/economy/divorce.json (100%) rename src/services/languages/{ => locales}/en-US/economy/importmee6.json (100%) rename src/services/languages/{ => locales}/en-US/economy/leaderboard.json (100%) rename src/services/languages/{ => locales}/en-US/economy/marry.json (100%) rename src/services/languages/{ => locales}/en-US/economy/money.json (100%) rename src/services/languages/{ => locales}/en-US/economy/pay.json (100%) rename src/services/languages/{ => locales}/en-US/economy/profile.json (100%) rename src/services/languages/{ => locales}/en-US/economy/rep.json (100%) rename src/services/languages/{ => locales}/en-US/economy/rob.json (100%) rename src/services/languages/{ => locales}/en-US/economy/setbio.json (100%) rename src/services/languages/{ => locales}/en-US/economy/slots.json (100%) rename src/services/languages/{ => locales}/en-US/economy/transactions.json (100%) rename src/services/languages/{ => locales}/en-US/economy/work.json (100%) rename src/services/languages/{ => locales}/en-US/fun/8ball.json (100%) rename src/services/languages/{ => locales}/en-US/fun/cat.json (100%) rename src/services/languages/{ => locales}/en-US/fun/dog.json (100%) rename src/services/languages/{ => locales}/en-US/fun/lmgtfy.json (100%) rename src/services/languages/{ => locales}/en-US/fun/lovecalc.json (100%) rename src/services/languages/{ => locales}/en-US/fun/memes.json (100%) rename src/services/languages/{ => locales}/en-US/fun/number.json (100%) rename src/services/languages/{ => locales}/en-US/fun/tictactoe.json (100%) rename src/services/languages/{ => locales}/en-US/general/afk.json (100%) rename src/services/languages/{ => locales}/en-US/general/avatar.json (100%) rename src/services/languages/{ => locales}/en-US/general/boosters.json (100%) rename src/services/languages/{ => locales}/en-US/general/emoji.json (100%) rename src/services/languages/{ => locales}/en-US/general/help.json (100%) rename src/services/languages/{ => locales}/en-US/general/info.json (100%) rename src/services/languages/{ => locales}/en-US/general/minecraft.json (100%) rename src/services/languages/{ => locales}/en-US/general/ping.json (100%) rename src/services/languages/{ => locales}/en-US/general/remindme.json (100%) rename src/services/languages/{ => locales}/en-US/general/reminds.json (100%) rename src/services/languages/{ => locales}/en-US/general/report.json (100%) rename src/services/languages/{ => locales}/en-US/general/shorturl.json (100%) rename src/services/languages/{ => locales}/en-US/general/staff.json (100%) rename src/services/languages/{ => locales}/en-US/general/stats.json (100%) rename src/services/languages/{ => locales}/en-US/general/suggest.json (100%) rename src/services/languages/{ => locales}/en-US/general/whois.json (100%) rename src/services/languages/{ => locales}/en-US/iat/checkjar.json (100%) rename src/services/languages/{ => locales}/en-US/misc.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/ban.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/clear.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/clearwarns.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/giveaway.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/kick.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/unban.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/untimeout.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/warn.json (100%) rename src/services/languages/{ => locales}/en-US/moderation/warns.json (100%) rename src/services/languages/{ => locales}/en-US/music/back.json (100%) rename src/services/languages/{ => locales}/en-US/music/clips.json (100%) rename src/services/languages/{ => locales}/en-US/music/loop.json (100%) rename src/services/languages/{ => locales}/en-US/music/nowplaying.json (100%) rename src/services/languages/{ => locales}/en-US/music/play.json (100%) rename src/services/languages/{ => locales}/en-US/music/queue.json (100%) rename src/services/languages/{ => locales}/en-US/music/seek.json (100%) rename src/services/languages/{ => locales}/en-US/music/shuffle.json (100%) rename src/services/languages/{ => locales}/en-US/music/skip.json (100%) rename src/services/languages/{ => locales}/en-US/music/stop.json (100%) rename src/services/languages/{ => locales}/en-US/music/volume.json (100%) rename src/services/languages/{ => locales}/en-US/owner/announcement.json (100%) rename src/services/languages/{ => locales}/en-US/owner/debug.json (100%) rename src/services/languages/{ => locales}/en-US/owner/eval.json (100%) rename src/services/languages/{ => locales}/en-US/owner/reload.json (100%) rename src/services/languages/{ => locales}/en-US/owner/say.json (100%) rename src/services/languages/{ => locales}/en-US/owner/servers.json (100%) rename src/services/languages/{ => locales}/en-US/tickets/adduser.json (100%) rename src/services/languages/{ => locales}/en-US/tickets/closeticket.json (100%) rename src/services/languages/{ => locales}/en-US/tickets/createticketembed.json (100%) rename src/services/languages/{ => locales}/en-US/tickets/removeuser.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/addemoji.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/automod.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/autorole.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/config.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/deletemod.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/goodbye.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/selectroles.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/set.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/setlang.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/stealemoji.json (100%) rename src/services/languages/{ => locales}/ru-RU/administration/welcome.json (100%) rename src/services/languages/{ => locales}/ru-RU/beatrun/courses.json (100%) rename src/services/languages/{ => locales}/ru-RU/common.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/achievements.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/bank.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/birthdate.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/divorce.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/importmee6.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/leaderboard.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/marry.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/money.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/pay.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/profile.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/rep.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/rob.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/setbio.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/slots.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/transactions.json (100%) rename src/services/languages/{ => locales}/ru-RU/economy/work.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/8ball.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/cat.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/dog.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/lmgtfy.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/lovecalc.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/memes.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/number.json (100%) rename src/services/languages/{ => locales}/ru-RU/fun/tictactoe.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/afk.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/avatar.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/boosters.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/emoji.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/help.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/info.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/minecraft.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/ping.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/remindme.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/reminds.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/report.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/shorturl.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/staff.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/stats.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/suggest.json (100%) rename src/services/languages/{ => locales}/ru-RU/general/whois.json (100%) rename src/services/languages/{ => locales}/ru-RU/iat/checkjar.json (100%) rename src/services/languages/{ => locales}/ru-RU/misc.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/ban.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/clear.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/clearwarns.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/giveaway.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/kick.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/unban.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/untimeout.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/warn.json (100%) rename src/services/languages/{ => locales}/ru-RU/moderation/warns.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/back.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/clips.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/loop.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/nowplaying.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/play.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/queue.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/seek.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/shuffle.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/skip.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/stop.json (100%) rename src/services/languages/{ => locales}/ru-RU/music/volume.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/announcement.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/debug.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/eval.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/reload.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/say.json (100%) rename src/services/languages/{ => locales}/ru-RU/owner/servers.json (100%) rename src/services/languages/{ => locales}/ru-RU/tickets/adduser.json (100%) rename src/services/languages/{ => locales}/ru-RU/tickets/closeticket.json (100%) rename src/services/languages/{ => locales}/ru-RU/tickets/createticketembed.json (100%) rename src/services/languages/{ => locales}/ru-RU/tickets/removeuser.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/addemoji.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/automod.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/autorole.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/config.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/deletemod.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/goodbye.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/selectroles.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/set.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/setlang.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/stealemoji.json (100%) rename src/services/languages/{ => locales}/uk-UA/administration/welcome.json (100%) rename src/services/languages/{ => locales}/uk-UA/beatrun/courses.json (100%) rename src/services/languages/{ => locales}/uk-UA/common.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/achievements.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/bank.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/birthdate.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/divorce.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/importmee6.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/leaderboard.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/marry.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/money.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/pay.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/profile.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/rep.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/rob.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/setbio.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/slots.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/transactions.json (100%) rename src/services/languages/{ => locales}/uk-UA/economy/work.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/8ball.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/cat.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/dog.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/lmgtfy.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/lovecalc.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/memes.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/number.json (100%) rename src/services/languages/{ => locales}/uk-UA/fun/tictactoe.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/afk.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/avatar.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/boosters.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/emoji.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/help.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/info.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/minecraft.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/ping.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/remindme.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/reminds.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/report.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/shorturl.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/staff.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/stats.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/suggest.json (100%) rename src/services/languages/{ => locales}/uk-UA/general/whois.json (100%) rename src/services/languages/{ => locales}/uk-UA/iat/checkjar.json (100%) rename src/services/languages/{ => locales}/uk-UA/misc.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/ban.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/clear.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/clearwarns.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/giveaway.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/kick.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/unban.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/untimeout.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/warn.json (100%) rename src/services/languages/{ => locales}/uk-UA/moderation/warns.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/back.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/clips.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/loop.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/nowplaying.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/play.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/queue.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/seek.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/shuffle.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/skip.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/stop.json (100%) rename src/services/languages/{ => locales}/uk-UA/music/volume.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/announcement.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/debug.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/eval.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/reload.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/say.json (100%) rename src/services/languages/{ => locales}/uk-UA/owner/servers.json (100%) rename src/services/languages/{ => locales}/uk-UA/tickets/adduser.json (100%) rename src/services/languages/{ => locales}/uk-UA/tickets/closeticket.json (100%) rename src/services/languages/{ => locales}/uk-UA/tickets/createticketembed.json (100%) rename src/services/languages/{ => locales}/uk-UA/tickets/removeuser.json (100%) diff --git a/src/models/GuildModel.js b/src/models/GuildModel.js index a2b3507b..da3b57f2 100644 --- a/src/models/GuildModel.js +++ b/src/models/GuildModel.js @@ -1,5 +1,5 @@ import { model, Schema } from "mongoose"; -import { langs } from "../languages/language-meta.js"; +import { client } from "../index.js"; export default model( "Guild", @@ -9,7 +9,7 @@ export default model( membersData: { type: Object, default: {} }, members: [{ type: Schema.Types.ObjectId, ref: "Member" }], - language: { type: String, default: langs.find(l => l.default).name }, + language: { type: String, default: client.configService.get("defaultLang") }, plugins: { type: Object, default: { diff --git a/src/services/languages/index.js b/src/services/languages/index.js new file mode 100644 index 00000000..e09397ee --- /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") ? true : false, + 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 index 78ebc405..b0d9bab9 100644 --- a/src/services/languages/language-meta.js +++ b/src/services/languages/language-meta.js @@ -4,20 +4,17 @@ export default [ nativeName: "English", locale: "en-US", format: "HH:mm:ss, MMMM Do YYYY", - default: true, }, { name: "ru-RU", nativeName: "Русский", locale: "ru-RU", format: "HH:mm:ss, Do MMMM YYYY", - default: false, }, { name: "uk-UA", nativeName: "Українська", locale: "uk-UA", format: "HH:mm:ss, Do MMMM YYYY", - default: false, }, ]; diff --git a/src/services/languages/en-US/administration/addemoji.json b/src/services/languages/locales/en-US/administration/addemoji.json similarity index 100% rename from src/services/languages/en-US/administration/addemoji.json rename to src/services/languages/locales/en-US/administration/addemoji.json diff --git a/src/services/languages/en-US/administration/automod.json b/src/services/languages/locales/en-US/administration/automod.json similarity index 100% rename from src/services/languages/en-US/administration/automod.json rename to src/services/languages/locales/en-US/administration/automod.json diff --git a/src/services/languages/en-US/administration/autorole.json b/src/services/languages/locales/en-US/administration/autorole.json similarity index 100% rename from src/services/languages/en-US/administration/autorole.json rename to src/services/languages/locales/en-US/administration/autorole.json diff --git a/src/services/languages/en-US/administration/config.json b/src/services/languages/locales/en-US/administration/config.json similarity index 100% rename from src/services/languages/en-US/administration/config.json rename to src/services/languages/locales/en-US/administration/config.json diff --git a/src/services/languages/en-US/administration/deletemod.json b/src/services/languages/locales/en-US/administration/deletemod.json similarity index 100% rename from src/services/languages/en-US/administration/deletemod.json rename to src/services/languages/locales/en-US/administration/deletemod.json diff --git a/src/services/languages/en-US/administration/goodbye.json b/src/services/languages/locales/en-US/administration/goodbye.json similarity index 100% rename from src/services/languages/en-US/administration/goodbye.json rename to src/services/languages/locales/en-US/administration/goodbye.json diff --git a/src/services/languages/en-US/administration/selectroles.json b/src/services/languages/locales/en-US/administration/selectroles.json similarity index 100% rename from src/services/languages/en-US/administration/selectroles.json rename to src/services/languages/locales/en-US/administration/selectroles.json diff --git a/src/services/languages/en-US/administration/set.json b/src/services/languages/locales/en-US/administration/set.json similarity index 100% rename from src/services/languages/en-US/administration/set.json rename to src/services/languages/locales/en-US/administration/set.json diff --git a/src/services/languages/en-US/administration/setlang.json b/src/services/languages/locales/en-US/administration/setlang.json similarity index 100% rename from src/services/languages/en-US/administration/setlang.json rename to src/services/languages/locales/en-US/administration/setlang.json diff --git a/src/services/languages/en-US/administration/stealemoji.json b/src/services/languages/locales/en-US/administration/stealemoji.json similarity index 100% rename from src/services/languages/en-US/administration/stealemoji.json rename to src/services/languages/locales/en-US/administration/stealemoji.json diff --git a/src/services/languages/en-US/administration/welcome.json b/src/services/languages/locales/en-US/administration/welcome.json similarity index 100% rename from src/services/languages/en-US/administration/welcome.json rename to src/services/languages/locales/en-US/administration/welcome.json diff --git a/src/services/languages/en-US/beatrun/courses.json b/src/services/languages/locales/en-US/beatrun/courses.json similarity index 100% rename from src/services/languages/en-US/beatrun/courses.json rename to src/services/languages/locales/en-US/beatrun/courses.json diff --git a/src/services/languages/en-US/common.json b/src/services/languages/locales/en-US/common.json similarity index 100% rename from src/services/languages/en-US/common.json rename to src/services/languages/locales/en-US/common.json diff --git a/src/services/languages/en-US/economy/achievements.json b/src/services/languages/locales/en-US/economy/achievements.json similarity index 100% rename from src/services/languages/en-US/economy/achievements.json rename to src/services/languages/locales/en-US/economy/achievements.json diff --git a/src/services/languages/en-US/economy/bank.json b/src/services/languages/locales/en-US/economy/bank.json similarity index 100% rename from src/services/languages/en-US/economy/bank.json rename to src/services/languages/locales/en-US/economy/bank.json diff --git a/src/services/languages/en-US/economy/birthdate.json b/src/services/languages/locales/en-US/economy/birthdate.json similarity index 100% rename from src/services/languages/en-US/economy/birthdate.json rename to src/services/languages/locales/en-US/economy/birthdate.json diff --git a/src/services/languages/en-US/economy/divorce.json b/src/services/languages/locales/en-US/economy/divorce.json similarity index 100% rename from src/services/languages/en-US/economy/divorce.json rename to src/services/languages/locales/en-US/economy/divorce.json diff --git a/src/services/languages/en-US/economy/importmee6.json b/src/services/languages/locales/en-US/economy/importmee6.json similarity index 100% rename from src/services/languages/en-US/economy/importmee6.json rename to src/services/languages/locales/en-US/economy/importmee6.json diff --git a/src/services/languages/en-US/economy/leaderboard.json b/src/services/languages/locales/en-US/economy/leaderboard.json similarity index 100% rename from src/services/languages/en-US/economy/leaderboard.json rename to src/services/languages/locales/en-US/economy/leaderboard.json diff --git a/src/services/languages/en-US/economy/marry.json b/src/services/languages/locales/en-US/economy/marry.json similarity index 100% rename from src/services/languages/en-US/economy/marry.json rename to src/services/languages/locales/en-US/economy/marry.json diff --git a/src/services/languages/en-US/economy/money.json b/src/services/languages/locales/en-US/economy/money.json similarity index 100% rename from src/services/languages/en-US/economy/money.json rename to src/services/languages/locales/en-US/economy/money.json diff --git a/src/services/languages/en-US/economy/pay.json b/src/services/languages/locales/en-US/economy/pay.json similarity index 100% rename from src/services/languages/en-US/economy/pay.json rename to src/services/languages/locales/en-US/economy/pay.json diff --git a/src/services/languages/en-US/economy/profile.json b/src/services/languages/locales/en-US/economy/profile.json similarity index 100% rename from src/services/languages/en-US/economy/profile.json rename to src/services/languages/locales/en-US/economy/profile.json diff --git a/src/services/languages/en-US/economy/rep.json b/src/services/languages/locales/en-US/economy/rep.json similarity index 100% rename from src/services/languages/en-US/economy/rep.json rename to src/services/languages/locales/en-US/economy/rep.json diff --git a/src/services/languages/en-US/economy/rob.json b/src/services/languages/locales/en-US/economy/rob.json similarity index 100% rename from src/services/languages/en-US/economy/rob.json rename to src/services/languages/locales/en-US/economy/rob.json diff --git a/src/services/languages/en-US/economy/setbio.json b/src/services/languages/locales/en-US/economy/setbio.json similarity index 100% rename from src/services/languages/en-US/economy/setbio.json rename to src/services/languages/locales/en-US/economy/setbio.json diff --git a/src/services/languages/en-US/economy/slots.json b/src/services/languages/locales/en-US/economy/slots.json similarity index 100% rename from src/services/languages/en-US/economy/slots.json rename to src/services/languages/locales/en-US/economy/slots.json diff --git a/src/services/languages/en-US/economy/transactions.json b/src/services/languages/locales/en-US/economy/transactions.json similarity index 100% rename from src/services/languages/en-US/economy/transactions.json rename to src/services/languages/locales/en-US/economy/transactions.json diff --git a/src/services/languages/en-US/economy/work.json b/src/services/languages/locales/en-US/economy/work.json similarity index 100% rename from src/services/languages/en-US/economy/work.json rename to src/services/languages/locales/en-US/economy/work.json diff --git a/src/services/languages/en-US/fun/8ball.json b/src/services/languages/locales/en-US/fun/8ball.json similarity index 100% rename from src/services/languages/en-US/fun/8ball.json rename to src/services/languages/locales/en-US/fun/8ball.json diff --git a/src/services/languages/en-US/fun/cat.json b/src/services/languages/locales/en-US/fun/cat.json similarity index 100% rename from src/services/languages/en-US/fun/cat.json rename to src/services/languages/locales/en-US/fun/cat.json diff --git a/src/services/languages/en-US/fun/dog.json b/src/services/languages/locales/en-US/fun/dog.json similarity index 100% rename from src/services/languages/en-US/fun/dog.json rename to src/services/languages/locales/en-US/fun/dog.json diff --git a/src/services/languages/en-US/fun/lmgtfy.json b/src/services/languages/locales/en-US/fun/lmgtfy.json similarity index 100% rename from src/services/languages/en-US/fun/lmgtfy.json rename to src/services/languages/locales/en-US/fun/lmgtfy.json diff --git a/src/services/languages/en-US/fun/lovecalc.json b/src/services/languages/locales/en-US/fun/lovecalc.json similarity index 100% rename from src/services/languages/en-US/fun/lovecalc.json rename to src/services/languages/locales/en-US/fun/lovecalc.json diff --git a/src/services/languages/en-US/fun/memes.json b/src/services/languages/locales/en-US/fun/memes.json similarity index 100% rename from src/services/languages/en-US/fun/memes.json rename to src/services/languages/locales/en-US/fun/memes.json diff --git a/src/services/languages/en-US/fun/number.json b/src/services/languages/locales/en-US/fun/number.json similarity index 100% rename from src/services/languages/en-US/fun/number.json rename to src/services/languages/locales/en-US/fun/number.json diff --git a/src/services/languages/en-US/fun/tictactoe.json b/src/services/languages/locales/en-US/fun/tictactoe.json similarity index 100% rename from src/services/languages/en-US/fun/tictactoe.json rename to src/services/languages/locales/en-US/fun/tictactoe.json diff --git a/src/services/languages/en-US/general/afk.json b/src/services/languages/locales/en-US/general/afk.json similarity index 100% rename from src/services/languages/en-US/general/afk.json rename to src/services/languages/locales/en-US/general/afk.json diff --git a/src/services/languages/en-US/general/avatar.json b/src/services/languages/locales/en-US/general/avatar.json similarity index 100% rename from src/services/languages/en-US/general/avatar.json rename to src/services/languages/locales/en-US/general/avatar.json diff --git a/src/services/languages/en-US/general/boosters.json b/src/services/languages/locales/en-US/general/boosters.json similarity index 100% rename from src/services/languages/en-US/general/boosters.json rename to src/services/languages/locales/en-US/general/boosters.json diff --git a/src/services/languages/en-US/general/emoji.json b/src/services/languages/locales/en-US/general/emoji.json similarity index 100% rename from src/services/languages/en-US/general/emoji.json rename to src/services/languages/locales/en-US/general/emoji.json diff --git a/src/services/languages/en-US/general/help.json b/src/services/languages/locales/en-US/general/help.json similarity index 100% rename from src/services/languages/en-US/general/help.json rename to src/services/languages/locales/en-US/general/help.json diff --git a/src/services/languages/en-US/general/info.json b/src/services/languages/locales/en-US/general/info.json similarity index 100% rename from src/services/languages/en-US/general/info.json rename to src/services/languages/locales/en-US/general/info.json diff --git a/src/services/languages/en-US/general/minecraft.json b/src/services/languages/locales/en-US/general/minecraft.json similarity index 100% rename from src/services/languages/en-US/general/minecraft.json rename to src/services/languages/locales/en-US/general/minecraft.json diff --git a/src/services/languages/en-US/general/ping.json b/src/services/languages/locales/en-US/general/ping.json similarity index 100% rename from src/services/languages/en-US/general/ping.json rename to src/services/languages/locales/en-US/general/ping.json diff --git a/src/services/languages/en-US/general/remindme.json b/src/services/languages/locales/en-US/general/remindme.json similarity index 100% rename from src/services/languages/en-US/general/remindme.json rename to src/services/languages/locales/en-US/general/remindme.json diff --git a/src/services/languages/en-US/general/reminds.json b/src/services/languages/locales/en-US/general/reminds.json similarity index 100% rename from src/services/languages/en-US/general/reminds.json rename to src/services/languages/locales/en-US/general/reminds.json diff --git a/src/services/languages/en-US/general/report.json b/src/services/languages/locales/en-US/general/report.json similarity index 100% rename from src/services/languages/en-US/general/report.json rename to src/services/languages/locales/en-US/general/report.json diff --git a/src/services/languages/en-US/general/shorturl.json b/src/services/languages/locales/en-US/general/shorturl.json similarity index 100% rename from src/services/languages/en-US/general/shorturl.json rename to src/services/languages/locales/en-US/general/shorturl.json diff --git a/src/services/languages/en-US/general/staff.json b/src/services/languages/locales/en-US/general/staff.json similarity index 100% rename from src/services/languages/en-US/general/staff.json rename to src/services/languages/locales/en-US/general/staff.json diff --git a/src/services/languages/en-US/general/stats.json b/src/services/languages/locales/en-US/general/stats.json similarity index 100% rename from src/services/languages/en-US/general/stats.json rename to src/services/languages/locales/en-US/general/stats.json diff --git a/src/services/languages/en-US/general/suggest.json b/src/services/languages/locales/en-US/general/suggest.json similarity index 100% rename from src/services/languages/en-US/general/suggest.json rename to src/services/languages/locales/en-US/general/suggest.json diff --git a/src/services/languages/en-US/general/whois.json b/src/services/languages/locales/en-US/general/whois.json similarity index 100% rename from src/services/languages/en-US/general/whois.json rename to src/services/languages/locales/en-US/general/whois.json diff --git a/src/services/languages/en-US/iat/checkjar.json b/src/services/languages/locales/en-US/iat/checkjar.json similarity index 100% rename from src/services/languages/en-US/iat/checkjar.json rename to src/services/languages/locales/en-US/iat/checkjar.json diff --git a/src/services/languages/en-US/misc.json b/src/services/languages/locales/en-US/misc.json similarity index 100% rename from src/services/languages/en-US/misc.json rename to src/services/languages/locales/en-US/misc.json diff --git a/src/services/languages/en-US/moderation/ban.json b/src/services/languages/locales/en-US/moderation/ban.json similarity index 100% rename from src/services/languages/en-US/moderation/ban.json rename to src/services/languages/locales/en-US/moderation/ban.json diff --git a/src/services/languages/en-US/moderation/clear.json b/src/services/languages/locales/en-US/moderation/clear.json similarity index 100% rename from src/services/languages/en-US/moderation/clear.json rename to src/services/languages/locales/en-US/moderation/clear.json diff --git a/src/services/languages/en-US/moderation/clearwarns.json b/src/services/languages/locales/en-US/moderation/clearwarns.json similarity index 100% rename from src/services/languages/en-US/moderation/clearwarns.json rename to src/services/languages/locales/en-US/moderation/clearwarns.json diff --git a/src/services/languages/en-US/moderation/giveaway.json b/src/services/languages/locales/en-US/moderation/giveaway.json similarity index 100% rename from src/services/languages/en-US/moderation/giveaway.json rename to src/services/languages/locales/en-US/moderation/giveaway.json diff --git a/src/services/languages/en-US/moderation/kick.json b/src/services/languages/locales/en-US/moderation/kick.json similarity index 100% rename from src/services/languages/en-US/moderation/kick.json rename to src/services/languages/locales/en-US/moderation/kick.json diff --git a/src/services/languages/en-US/moderation/unban.json b/src/services/languages/locales/en-US/moderation/unban.json similarity index 100% rename from src/services/languages/en-US/moderation/unban.json rename to src/services/languages/locales/en-US/moderation/unban.json diff --git a/src/services/languages/en-US/moderation/untimeout.json b/src/services/languages/locales/en-US/moderation/untimeout.json similarity index 100% rename from src/services/languages/en-US/moderation/untimeout.json rename to src/services/languages/locales/en-US/moderation/untimeout.json diff --git a/src/services/languages/en-US/moderation/warn.json b/src/services/languages/locales/en-US/moderation/warn.json similarity index 100% rename from src/services/languages/en-US/moderation/warn.json rename to src/services/languages/locales/en-US/moderation/warn.json diff --git a/src/services/languages/en-US/moderation/warns.json b/src/services/languages/locales/en-US/moderation/warns.json similarity index 100% rename from src/services/languages/en-US/moderation/warns.json rename to src/services/languages/locales/en-US/moderation/warns.json diff --git a/src/services/languages/en-US/music/back.json b/src/services/languages/locales/en-US/music/back.json similarity index 100% rename from src/services/languages/en-US/music/back.json rename to src/services/languages/locales/en-US/music/back.json diff --git a/src/services/languages/en-US/music/clips.json b/src/services/languages/locales/en-US/music/clips.json similarity index 100% rename from src/services/languages/en-US/music/clips.json rename to src/services/languages/locales/en-US/music/clips.json diff --git a/src/services/languages/en-US/music/loop.json b/src/services/languages/locales/en-US/music/loop.json similarity index 100% rename from src/services/languages/en-US/music/loop.json rename to src/services/languages/locales/en-US/music/loop.json diff --git a/src/services/languages/en-US/music/nowplaying.json b/src/services/languages/locales/en-US/music/nowplaying.json similarity index 100% rename from src/services/languages/en-US/music/nowplaying.json rename to src/services/languages/locales/en-US/music/nowplaying.json diff --git a/src/services/languages/en-US/music/play.json b/src/services/languages/locales/en-US/music/play.json similarity index 100% rename from src/services/languages/en-US/music/play.json rename to src/services/languages/locales/en-US/music/play.json diff --git a/src/services/languages/en-US/music/queue.json b/src/services/languages/locales/en-US/music/queue.json similarity index 100% rename from src/services/languages/en-US/music/queue.json rename to src/services/languages/locales/en-US/music/queue.json diff --git a/src/services/languages/en-US/music/seek.json b/src/services/languages/locales/en-US/music/seek.json similarity index 100% rename from src/services/languages/en-US/music/seek.json rename to src/services/languages/locales/en-US/music/seek.json diff --git a/src/services/languages/en-US/music/shuffle.json b/src/services/languages/locales/en-US/music/shuffle.json similarity index 100% rename from src/services/languages/en-US/music/shuffle.json rename to src/services/languages/locales/en-US/music/shuffle.json diff --git a/src/services/languages/en-US/music/skip.json b/src/services/languages/locales/en-US/music/skip.json similarity index 100% rename from src/services/languages/en-US/music/skip.json rename to src/services/languages/locales/en-US/music/skip.json diff --git a/src/services/languages/en-US/music/stop.json b/src/services/languages/locales/en-US/music/stop.json similarity index 100% rename from src/services/languages/en-US/music/stop.json rename to src/services/languages/locales/en-US/music/stop.json diff --git a/src/services/languages/en-US/music/volume.json b/src/services/languages/locales/en-US/music/volume.json similarity index 100% rename from src/services/languages/en-US/music/volume.json rename to src/services/languages/locales/en-US/music/volume.json diff --git a/src/services/languages/en-US/owner/announcement.json b/src/services/languages/locales/en-US/owner/announcement.json similarity index 100% rename from src/services/languages/en-US/owner/announcement.json rename to src/services/languages/locales/en-US/owner/announcement.json diff --git a/src/services/languages/en-US/owner/debug.json b/src/services/languages/locales/en-US/owner/debug.json similarity index 100% rename from src/services/languages/en-US/owner/debug.json rename to src/services/languages/locales/en-US/owner/debug.json diff --git a/src/services/languages/en-US/owner/eval.json b/src/services/languages/locales/en-US/owner/eval.json similarity index 100% rename from src/services/languages/en-US/owner/eval.json rename to src/services/languages/locales/en-US/owner/eval.json diff --git a/src/services/languages/en-US/owner/reload.json b/src/services/languages/locales/en-US/owner/reload.json similarity index 100% rename from src/services/languages/en-US/owner/reload.json rename to src/services/languages/locales/en-US/owner/reload.json diff --git a/src/services/languages/en-US/owner/say.json b/src/services/languages/locales/en-US/owner/say.json similarity index 100% rename from src/services/languages/en-US/owner/say.json rename to src/services/languages/locales/en-US/owner/say.json diff --git a/src/services/languages/en-US/owner/servers.json b/src/services/languages/locales/en-US/owner/servers.json similarity index 100% rename from src/services/languages/en-US/owner/servers.json rename to src/services/languages/locales/en-US/owner/servers.json diff --git a/src/services/languages/en-US/tickets/adduser.json b/src/services/languages/locales/en-US/tickets/adduser.json similarity index 100% rename from src/services/languages/en-US/tickets/adduser.json rename to src/services/languages/locales/en-US/tickets/adduser.json diff --git a/src/services/languages/en-US/tickets/closeticket.json b/src/services/languages/locales/en-US/tickets/closeticket.json similarity index 100% rename from src/services/languages/en-US/tickets/closeticket.json rename to src/services/languages/locales/en-US/tickets/closeticket.json diff --git a/src/services/languages/en-US/tickets/createticketembed.json b/src/services/languages/locales/en-US/tickets/createticketembed.json similarity index 100% rename from src/services/languages/en-US/tickets/createticketembed.json rename to src/services/languages/locales/en-US/tickets/createticketembed.json diff --git a/src/services/languages/en-US/tickets/removeuser.json b/src/services/languages/locales/en-US/tickets/removeuser.json similarity index 100% rename from src/services/languages/en-US/tickets/removeuser.json rename to src/services/languages/locales/en-US/tickets/removeuser.json diff --git a/src/services/languages/ru-RU/administration/addemoji.json b/src/services/languages/locales/ru-RU/administration/addemoji.json similarity index 100% rename from src/services/languages/ru-RU/administration/addemoji.json rename to src/services/languages/locales/ru-RU/administration/addemoji.json diff --git a/src/services/languages/ru-RU/administration/automod.json b/src/services/languages/locales/ru-RU/administration/automod.json similarity index 100% rename from src/services/languages/ru-RU/administration/automod.json rename to src/services/languages/locales/ru-RU/administration/automod.json diff --git a/src/services/languages/ru-RU/administration/autorole.json b/src/services/languages/locales/ru-RU/administration/autorole.json similarity index 100% rename from src/services/languages/ru-RU/administration/autorole.json rename to src/services/languages/locales/ru-RU/administration/autorole.json diff --git a/src/services/languages/ru-RU/administration/config.json b/src/services/languages/locales/ru-RU/administration/config.json similarity index 100% rename from src/services/languages/ru-RU/administration/config.json rename to src/services/languages/locales/ru-RU/administration/config.json diff --git a/src/services/languages/ru-RU/administration/deletemod.json b/src/services/languages/locales/ru-RU/administration/deletemod.json similarity index 100% rename from src/services/languages/ru-RU/administration/deletemod.json rename to src/services/languages/locales/ru-RU/administration/deletemod.json diff --git a/src/services/languages/ru-RU/administration/goodbye.json b/src/services/languages/locales/ru-RU/administration/goodbye.json similarity index 100% rename from src/services/languages/ru-RU/administration/goodbye.json rename to src/services/languages/locales/ru-RU/administration/goodbye.json diff --git a/src/services/languages/ru-RU/administration/selectroles.json b/src/services/languages/locales/ru-RU/administration/selectroles.json similarity index 100% rename from src/services/languages/ru-RU/administration/selectroles.json rename to src/services/languages/locales/ru-RU/administration/selectroles.json diff --git a/src/services/languages/ru-RU/administration/set.json b/src/services/languages/locales/ru-RU/administration/set.json similarity index 100% rename from src/services/languages/ru-RU/administration/set.json rename to src/services/languages/locales/ru-RU/administration/set.json diff --git a/src/services/languages/ru-RU/administration/setlang.json b/src/services/languages/locales/ru-RU/administration/setlang.json similarity index 100% rename from src/services/languages/ru-RU/administration/setlang.json rename to src/services/languages/locales/ru-RU/administration/setlang.json diff --git a/src/services/languages/ru-RU/administration/stealemoji.json b/src/services/languages/locales/ru-RU/administration/stealemoji.json similarity index 100% rename from src/services/languages/ru-RU/administration/stealemoji.json rename to src/services/languages/locales/ru-RU/administration/stealemoji.json diff --git a/src/services/languages/ru-RU/administration/welcome.json b/src/services/languages/locales/ru-RU/administration/welcome.json similarity index 100% rename from src/services/languages/ru-RU/administration/welcome.json rename to src/services/languages/locales/ru-RU/administration/welcome.json diff --git a/src/services/languages/ru-RU/beatrun/courses.json b/src/services/languages/locales/ru-RU/beatrun/courses.json similarity index 100% rename from src/services/languages/ru-RU/beatrun/courses.json rename to src/services/languages/locales/ru-RU/beatrun/courses.json diff --git a/src/services/languages/ru-RU/common.json b/src/services/languages/locales/ru-RU/common.json similarity index 100% rename from src/services/languages/ru-RU/common.json rename to src/services/languages/locales/ru-RU/common.json diff --git a/src/services/languages/ru-RU/economy/achievements.json b/src/services/languages/locales/ru-RU/economy/achievements.json similarity index 100% rename from src/services/languages/ru-RU/economy/achievements.json rename to src/services/languages/locales/ru-RU/economy/achievements.json diff --git a/src/services/languages/ru-RU/economy/bank.json b/src/services/languages/locales/ru-RU/economy/bank.json similarity index 100% rename from src/services/languages/ru-RU/economy/bank.json rename to src/services/languages/locales/ru-RU/economy/bank.json diff --git a/src/services/languages/ru-RU/economy/birthdate.json b/src/services/languages/locales/ru-RU/economy/birthdate.json similarity index 100% rename from src/services/languages/ru-RU/economy/birthdate.json rename to src/services/languages/locales/ru-RU/economy/birthdate.json diff --git a/src/services/languages/ru-RU/economy/divorce.json b/src/services/languages/locales/ru-RU/economy/divorce.json similarity index 100% rename from src/services/languages/ru-RU/economy/divorce.json rename to src/services/languages/locales/ru-RU/economy/divorce.json diff --git a/src/services/languages/ru-RU/economy/importmee6.json b/src/services/languages/locales/ru-RU/economy/importmee6.json similarity index 100% rename from src/services/languages/ru-RU/economy/importmee6.json rename to src/services/languages/locales/ru-RU/economy/importmee6.json diff --git a/src/services/languages/ru-RU/economy/leaderboard.json b/src/services/languages/locales/ru-RU/economy/leaderboard.json similarity index 100% rename from src/services/languages/ru-RU/economy/leaderboard.json rename to src/services/languages/locales/ru-RU/economy/leaderboard.json diff --git a/src/services/languages/ru-RU/economy/marry.json b/src/services/languages/locales/ru-RU/economy/marry.json similarity index 100% rename from src/services/languages/ru-RU/economy/marry.json rename to src/services/languages/locales/ru-RU/economy/marry.json diff --git a/src/services/languages/ru-RU/economy/money.json b/src/services/languages/locales/ru-RU/economy/money.json similarity index 100% rename from src/services/languages/ru-RU/economy/money.json rename to src/services/languages/locales/ru-RU/economy/money.json diff --git a/src/services/languages/ru-RU/economy/pay.json b/src/services/languages/locales/ru-RU/economy/pay.json similarity index 100% rename from src/services/languages/ru-RU/economy/pay.json rename to src/services/languages/locales/ru-RU/economy/pay.json diff --git a/src/services/languages/ru-RU/economy/profile.json b/src/services/languages/locales/ru-RU/economy/profile.json similarity index 100% rename from src/services/languages/ru-RU/economy/profile.json rename to src/services/languages/locales/ru-RU/economy/profile.json diff --git a/src/services/languages/ru-RU/economy/rep.json b/src/services/languages/locales/ru-RU/economy/rep.json similarity index 100% rename from src/services/languages/ru-RU/economy/rep.json rename to src/services/languages/locales/ru-RU/economy/rep.json diff --git a/src/services/languages/ru-RU/economy/rob.json b/src/services/languages/locales/ru-RU/economy/rob.json similarity index 100% rename from src/services/languages/ru-RU/economy/rob.json rename to src/services/languages/locales/ru-RU/economy/rob.json diff --git a/src/services/languages/ru-RU/economy/setbio.json b/src/services/languages/locales/ru-RU/economy/setbio.json similarity index 100% rename from src/services/languages/ru-RU/economy/setbio.json rename to src/services/languages/locales/ru-RU/economy/setbio.json diff --git a/src/services/languages/ru-RU/economy/slots.json b/src/services/languages/locales/ru-RU/economy/slots.json similarity index 100% rename from src/services/languages/ru-RU/economy/slots.json rename to src/services/languages/locales/ru-RU/economy/slots.json diff --git a/src/services/languages/ru-RU/economy/transactions.json b/src/services/languages/locales/ru-RU/economy/transactions.json similarity index 100% rename from src/services/languages/ru-RU/economy/transactions.json rename to src/services/languages/locales/ru-RU/economy/transactions.json diff --git a/src/services/languages/ru-RU/economy/work.json b/src/services/languages/locales/ru-RU/economy/work.json similarity index 100% rename from src/services/languages/ru-RU/economy/work.json rename to src/services/languages/locales/ru-RU/economy/work.json diff --git a/src/services/languages/ru-RU/fun/8ball.json b/src/services/languages/locales/ru-RU/fun/8ball.json similarity index 100% rename from src/services/languages/ru-RU/fun/8ball.json rename to src/services/languages/locales/ru-RU/fun/8ball.json diff --git a/src/services/languages/ru-RU/fun/cat.json b/src/services/languages/locales/ru-RU/fun/cat.json similarity index 100% rename from src/services/languages/ru-RU/fun/cat.json rename to src/services/languages/locales/ru-RU/fun/cat.json diff --git a/src/services/languages/ru-RU/fun/dog.json b/src/services/languages/locales/ru-RU/fun/dog.json similarity index 100% rename from src/services/languages/ru-RU/fun/dog.json rename to src/services/languages/locales/ru-RU/fun/dog.json diff --git a/src/services/languages/ru-RU/fun/lmgtfy.json b/src/services/languages/locales/ru-RU/fun/lmgtfy.json similarity index 100% rename from src/services/languages/ru-RU/fun/lmgtfy.json rename to src/services/languages/locales/ru-RU/fun/lmgtfy.json diff --git a/src/services/languages/ru-RU/fun/lovecalc.json b/src/services/languages/locales/ru-RU/fun/lovecalc.json similarity index 100% rename from src/services/languages/ru-RU/fun/lovecalc.json rename to src/services/languages/locales/ru-RU/fun/lovecalc.json diff --git a/src/services/languages/ru-RU/fun/memes.json b/src/services/languages/locales/ru-RU/fun/memes.json similarity index 100% rename from src/services/languages/ru-RU/fun/memes.json rename to src/services/languages/locales/ru-RU/fun/memes.json diff --git a/src/services/languages/ru-RU/fun/number.json b/src/services/languages/locales/ru-RU/fun/number.json similarity index 100% rename from src/services/languages/ru-RU/fun/number.json rename to src/services/languages/locales/ru-RU/fun/number.json diff --git a/src/services/languages/ru-RU/fun/tictactoe.json b/src/services/languages/locales/ru-RU/fun/tictactoe.json similarity index 100% rename from src/services/languages/ru-RU/fun/tictactoe.json rename to src/services/languages/locales/ru-RU/fun/tictactoe.json diff --git a/src/services/languages/ru-RU/general/afk.json b/src/services/languages/locales/ru-RU/general/afk.json similarity index 100% rename from src/services/languages/ru-RU/general/afk.json rename to src/services/languages/locales/ru-RU/general/afk.json diff --git a/src/services/languages/ru-RU/general/avatar.json b/src/services/languages/locales/ru-RU/general/avatar.json similarity index 100% rename from src/services/languages/ru-RU/general/avatar.json rename to src/services/languages/locales/ru-RU/general/avatar.json diff --git a/src/services/languages/ru-RU/general/boosters.json b/src/services/languages/locales/ru-RU/general/boosters.json similarity index 100% rename from src/services/languages/ru-RU/general/boosters.json rename to src/services/languages/locales/ru-RU/general/boosters.json diff --git a/src/services/languages/ru-RU/general/emoji.json b/src/services/languages/locales/ru-RU/general/emoji.json similarity index 100% rename from src/services/languages/ru-RU/general/emoji.json rename to src/services/languages/locales/ru-RU/general/emoji.json diff --git a/src/services/languages/ru-RU/general/help.json b/src/services/languages/locales/ru-RU/general/help.json similarity index 100% rename from src/services/languages/ru-RU/general/help.json rename to src/services/languages/locales/ru-RU/general/help.json diff --git a/src/services/languages/ru-RU/general/info.json b/src/services/languages/locales/ru-RU/general/info.json similarity index 100% rename from src/services/languages/ru-RU/general/info.json rename to src/services/languages/locales/ru-RU/general/info.json diff --git a/src/services/languages/ru-RU/general/minecraft.json b/src/services/languages/locales/ru-RU/general/minecraft.json similarity index 100% rename from src/services/languages/ru-RU/general/minecraft.json rename to src/services/languages/locales/ru-RU/general/minecraft.json diff --git a/src/services/languages/ru-RU/general/ping.json b/src/services/languages/locales/ru-RU/general/ping.json similarity index 100% rename from src/services/languages/ru-RU/general/ping.json rename to src/services/languages/locales/ru-RU/general/ping.json diff --git a/src/services/languages/ru-RU/general/remindme.json b/src/services/languages/locales/ru-RU/general/remindme.json similarity index 100% rename from src/services/languages/ru-RU/general/remindme.json rename to src/services/languages/locales/ru-RU/general/remindme.json diff --git a/src/services/languages/ru-RU/general/reminds.json b/src/services/languages/locales/ru-RU/general/reminds.json similarity index 100% rename from src/services/languages/ru-RU/general/reminds.json rename to src/services/languages/locales/ru-RU/general/reminds.json diff --git a/src/services/languages/ru-RU/general/report.json b/src/services/languages/locales/ru-RU/general/report.json similarity index 100% rename from src/services/languages/ru-RU/general/report.json rename to src/services/languages/locales/ru-RU/general/report.json diff --git a/src/services/languages/ru-RU/general/shorturl.json b/src/services/languages/locales/ru-RU/general/shorturl.json similarity index 100% rename from src/services/languages/ru-RU/general/shorturl.json rename to src/services/languages/locales/ru-RU/general/shorturl.json diff --git a/src/services/languages/ru-RU/general/staff.json b/src/services/languages/locales/ru-RU/general/staff.json similarity index 100% rename from src/services/languages/ru-RU/general/staff.json rename to src/services/languages/locales/ru-RU/general/staff.json diff --git a/src/services/languages/ru-RU/general/stats.json b/src/services/languages/locales/ru-RU/general/stats.json similarity index 100% rename from src/services/languages/ru-RU/general/stats.json rename to src/services/languages/locales/ru-RU/general/stats.json diff --git a/src/services/languages/ru-RU/general/suggest.json b/src/services/languages/locales/ru-RU/general/suggest.json similarity index 100% rename from src/services/languages/ru-RU/general/suggest.json rename to src/services/languages/locales/ru-RU/general/suggest.json diff --git a/src/services/languages/ru-RU/general/whois.json b/src/services/languages/locales/ru-RU/general/whois.json similarity index 100% rename from src/services/languages/ru-RU/general/whois.json rename to src/services/languages/locales/ru-RU/general/whois.json diff --git a/src/services/languages/ru-RU/iat/checkjar.json b/src/services/languages/locales/ru-RU/iat/checkjar.json similarity index 100% rename from src/services/languages/ru-RU/iat/checkjar.json rename to src/services/languages/locales/ru-RU/iat/checkjar.json diff --git a/src/services/languages/ru-RU/misc.json b/src/services/languages/locales/ru-RU/misc.json similarity index 100% rename from src/services/languages/ru-RU/misc.json rename to src/services/languages/locales/ru-RU/misc.json diff --git a/src/services/languages/ru-RU/moderation/ban.json b/src/services/languages/locales/ru-RU/moderation/ban.json similarity index 100% rename from src/services/languages/ru-RU/moderation/ban.json rename to src/services/languages/locales/ru-RU/moderation/ban.json diff --git a/src/services/languages/ru-RU/moderation/clear.json b/src/services/languages/locales/ru-RU/moderation/clear.json similarity index 100% rename from src/services/languages/ru-RU/moderation/clear.json rename to src/services/languages/locales/ru-RU/moderation/clear.json diff --git a/src/services/languages/ru-RU/moderation/clearwarns.json b/src/services/languages/locales/ru-RU/moderation/clearwarns.json similarity index 100% rename from src/services/languages/ru-RU/moderation/clearwarns.json rename to src/services/languages/locales/ru-RU/moderation/clearwarns.json diff --git a/src/services/languages/ru-RU/moderation/giveaway.json b/src/services/languages/locales/ru-RU/moderation/giveaway.json similarity index 100% rename from src/services/languages/ru-RU/moderation/giveaway.json rename to src/services/languages/locales/ru-RU/moderation/giveaway.json diff --git a/src/services/languages/ru-RU/moderation/kick.json b/src/services/languages/locales/ru-RU/moderation/kick.json similarity index 100% rename from src/services/languages/ru-RU/moderation/kick.json rename to src/services/languages/locales/ru-RU/moderation/kick.json diff --git a/src/services/languages/ru-RU/moderation/unban.json b/src/services/languages/locales/ru-RU/moderation/unban.json similarity index 100% rename from src/services/languages/ru-RU/moderation/unban.json rename to src/services/languages/locales/ru-RU/moderation/unban.json diff --git a/src/services/languages/ru-RU/moderation/untimeout.json b/src/services/languages/locales/ru-RU/moderation/untimeout.json similarity index 100% rename from src/services/languages/ru-RU/moderation/untimeout.json rename to src/services/languages/locales/ru-RU/moderation/untimeout.json diff --git a/src/services/languages/ru-RU/moderation/warn.json b/src/services/languages/locales/ru-RU/moderation/warn.json similarity index 100% rename from src/services/languages/ru-RU/moderation/warn.json rename to src/services/languages/locales/ru-RU/moderation/warn.json diff --git a/src/services/languages/ru-RU/moderation/warns.json b/src/services/languages/locales/ru-RU/moderation/warns.json similarity index 100% rename from src/services/languages/ru-RU/moderation/warns.json rename to src/services/languages/locales/ru-RU/moderation/warns.json diff --git a/src/services/languages/ru-RU/music/back.json b/src/services/languages/locales/ru-RU/music/back.json similarity index 100% rename from src/services/languages/ru-RU/music/back.json rename to src/services/languages/locales/ru-RU/music/back.json diff --git a/src/services/languages/ru-RU/music/clips.json b/src/services/languages/locales/ru-RU/music/clips.json similarity index 100% rename from src/services/languages/ru-RU/music/clips.json rename to src/services/languages/locales/ru-RU/music/clips.json diff --git a/src/services/languages/ru-RU/music/loop.json b/src/services/languages/locales/ru-RU/music/loop.json similarity index 100% rename from src/services/languages/ru-RU/music/loop.json rename to src/services/languages/locales/ru-RU/music/loop.json diff --git a/src/services/languages/ru-RU/music/nowplaying.json b/src/services/languages/locales/ru-RU/music/nowplaying.json similarity index 100% rename from src/services/languages/ru-RU/music/nowplaying.json rename to src/services/languages/locales/ru-RU/music/nowplaying.json diff --git a/src/services/languages/ru-RU/music/play.json b/src/services/languages/locales/ru-RU/music/play.json similarity index 100% rename from src/services/languages/ru-RU/music/play.json rename to src/services/languages/locales/ru-RU/music/play.json diff --git a/src/services/languages/ru-RU/music/queue.json b/src/services/languages/locales/ru-RU/music/queue.json similarity index 100% rename from src/services/languages/ru-RU/music/queue.json rename to src/services/languages/locales/ru-RU/music/queue.json diff --git a/src/services/languages/ru-RU/music/seek.json b/src/services/languages/locales/ru-RU/music/seek.json similarity index 100% rename from src/services/languages/ru-RU/music/seek.json rename to src/services/languages/locales/ru-RU/music/seek.json diff --git a/src/services/languages/ru-RU/music/shuffle.json b/src/services/languages/locales/ru-RU/music/shuffle.json similarity index 100% rename from src/services/languages/ru-RU/music/shuffle.json rename to src/services/languages/locales/ru-RU/music/shuffle.json diff --git a/src/services/languages/ru-RU/music/skip.json b/src/services/languages/locales/ru-RU/music/skip.json similarity index 100% rename from src/services/languages/ru-RU/music/skip.json rename to src/services/languages/locales/ru-RU/music/skip.json diff --git a/src/services/languages/ru-RU/music/stop.json b/src/services/languages/locales/ru-RU/music/stop.json similarity index 100% rename from src/services/languages/ru-RU/music/stop.json rename to src/services/languages/locales/ru-RU/music/stop.json diff --git a/src/services/languages/ru-RU/music/volume.json b/src/services/languages/locales/ru-RU/music/volume.json similarity index 100% rename from src/services/languages/ru-RU/music/volume.json rename to src/services/languages/locales/ru-RU/music/volume.json diff --git a/src/services/languages/ru-RU/owner/announcement.json b/src/services/languages/locales/ru-RU/owner/announcement.json similarity index 100% rename from src/services/languages/ru-RU/owner/announcement.json rename to src/services/languages/locales/ru-RU/owner/announcement.json diff --git a/src/services/languages/ru-RU/owner/debug.json b/src/services/languages/locales/ru-RU/owner/debug.json similarity index 100% rename from src/services/languages/ru-RU/owner/debug.json rename to src/services/languages/locales/ru-RU/owner/debug.json diff --git a/src/services/languages/ru-RU/owner/eval.json b/src/services/languages/locales/ru-RU/owner/eval.json similarity index 100% rename from src/services/languages/ru-RU/owner/eval.json rename to src/services/languages/locales/ru-RU/owner/eval.json diff --git a/src/services/languages/ru-RU/owner/reload.json b/src/services/languages/locales/ru-RU/owner/reload.json similarity index 100% rename from src/services/languages/ru-RU/owner/reload.json rename to src/services/languages/locales/ru-RU/owner/reload.json diff --git a/src/services/languages/ru-RU/owner/say.json b/src/services/languages/locales/ru-RU/owner/say.json similarity index 100% rename from src/services/languages/ru-RU/owner/say.json rename to src/services/languages/locales/ru-RU/owner/say.json diff --git a/src/services/languages/ru-RU/owner/servers.json b/src/services/languages/locales/ru-RU/owner/servers.json similarity index 100% rename from src/services/languages/ru-RU/owner/servers.json rename to src/services/languages/locales/ru-RU/owner/servers.json diff --git a/src/services/languages/ru-RU/tickets/adduser.json b/src/services/languages/locales/ru-RU/tickets/adduser.json similarity index 100% rename from src/services/languages/ru-RU/tickets/adduser.json rename to src/services/languages/locales/ru-RU/tickets/adduser.json diff --git a/src/services/languages/ru-RU/tickets/closeticket.json b/src/services/languages/locales/ru-RU/tickets/closeticket.json similarity index 100% rename from src/services/languages/ru-RU/tickets/closeticket.json rename to src/services/languages/locales/ru-RU/tickets/closeticket.json diff --git a/src/services/languages/ru-RU/tickets/createticketembed.json b/src/services/languages/locales/ru-RU/tickets/createticketembed.json similarity index 100% rename from src/services/languages/ru-RU/tickets/createticketembed.json rename to src/services/languages/locales/ru-RU/tickets/createticketembed.json diff --git a/src/services/languages/ru-RU/tickets/removeuser.json b/src/services/languages/locales/ru-RU/tickets/removeuser.json similarity index 100% rename from src/services/languages/ru-RU/tickets/removeuser.json rename to src/services/languages/locales/ru-RU/tickets/removeuser.json diff --git a/src/services/languages/uk-UA/administration/addemoji.json b/src/services/languages/locales/uk-UA/administration/addemoji.json similarity index 100% rename from src/services/languages/uk-UA/administration/addemoji.json rename to src/services/languages/locales/uk-UA/administration/addemoji.json diff --git a/src/services/languages/uk-UA/administration/automod.json b/src/services/languages/locales/uk-UA/administration/automod.json similarity index 100% rename from src/services/languages/uk-UA/administration/automod.json rename to src/services/languages/locales/uk-UA/administration/automod.json diff --git a/src/services/languages/uk-UA/administration/autorole.json b/src/services/languages/locales/uk-UA/administration/autorole.json similarity index 100% rename from src/services/languages/uk-UA/administration/autorole.json rename to src/services/languages/locales/uk-UA/administration/autorole.json diff --git a/src/services/languages/uk-UA/administration/config.json b/src/services/languages/locales/uk-UA/administration/config.json similarity index 100% rename from src/services/languages/uk-UA/administration/config.json rename to src/services/languages/locales/uk-UA/administration/config.json diff --git a/src/services/languages/uk-UA/administration/deletemod.json b/src/services/languages/locales/uk-UA/administration/deletemod.json similarity index 100% rename from src/services/languages/uk-UA/administration/deletemod.json rename to src/services/languages/locales/uk-UA/administration/deletemod.json diff --git a/src/services/languages/uk-UA/administration/goodbye.json b/src/services/languages/locales/uk-UA/administration/goodbye.json similarity index 100% rename from src/services/languages/uk-UA/administration/goodbye.json rename to src/services/languages/locales/uk-UA/administration/goodbye.json diff --git a/src/services/languages/uk-UA/administration/selectroles.json b/src/services/languages/locales/uk-UA/administration/selectroles.json similarity index 100% rename from src/services/languages/uk-UA/administration/selectroles.json rename to src/services/languages/locales/uk-UA/administration/selectroles.json diff --git a/src/services/languages/uk-UA/administration/set.json b/src/services/languages/locales/uk-UA/administration/set.json similarity index 100% rename from src/services/languages/uk-UA/administration/set.json rename to src/services/languages/locales/uk-UA/administration/set.json diff --git a/src/services/languages/uk-UA/administration/setlang.json b/src/services/languages/locales/uk-UA/administration/setlang.json similarity index 100% rename from src/services/languages/uk-UA/administration/setlang.json rename to src/services/languages/locales/uk-UA/administration/setlang.json diff --git a/src/services/languages/uk-UA/administration/stealemoji.json b/src/services/languages/locales/uk-UA/administration/stealemoji.json similarity index 100% rename from src/services/languages/uk-UA/administration/stealemoji.json rename to src/services/languages/locales/uk-UA/administration/stealemoji.json diff --git a/src/services/languages/uk-UA/administration/welcome.json b/src/services/languages/locales/uk-UA/administration/welcome.json similarity index 100% rename from src/services/languages/uk-UA/administration/welcome.json rename to src/services/languages/locales/uk-UA/administration/welcome.json diff --git a/src/services/languages/uk-UA/beatrun/courses.json b/src/services/languages/locales/uk-UA/beatrun/courses.json similarity index 100% rename from src/services/languages/uk-UA/beatrun/courses.json rename to src/services/languages/locales/uk-UA/beatrun/courses.json diff --git a/src/services/languages/uk-UA/common.json b/src/services/languages/locales/uk-UA/common.json similarity index 100% rename from src/services/languages/uk-UA/common.json rename to src/services/languages/locales/uk-UA/common.json diff --git a/src/services/languages/uk-UA/economy/achievements.json b/src/services/languages/locales/uk-UA/economy/achievements.json similarity index 100% rename from src/services/languages/uk-UA/economy/achievements.json rename to src/services/languages/locales/uk-UA/economy/achievements.json diff --git a/src/services/languages/uk-UA/economy/bank.json b/src/services/languages/locales/uk-UA/economy/bank.json similarity index 100% rename from src/services/languages/uk-UA/economy/bank.json rename to src/services/languages/locales/uk-UA/economy/bank.json diff --git a/src/services/languages/uk-UA/economy/birthdate.json b/src/services/languages/locales/uk-UA/economy/birthdate.json similarity index 100% rename from src/services/languages/uk-UA/economy/birthdate.json rename to src/services/languages/locales/uk-UA/economy/birthdate.json diff --git a/src/services/languages/uk-UA/economy/divorce.json b/src/services/languages/locales/uk-UA/economy/divorce.json similarity index 100% rename from src/services/languages/uk-UA/economy/divorce.json rename to src/services/languages/locales/uk-UA/economy/divorce.json diff --git a/src/services/languages/uk-UA/economy/importmee6.json b/src/services/languages/locales/uk-UA/economy/importmee6.json similarity index 100% rename from src/services/languages/uk-UA/economy/importmee6.json rename to src/services/languages/locales/uk-UA/economy/importmee6.json diff --git a/src/services/languages/uk-UA/economy/leaderboard.json b/src/services/languages/locales/uk-UA/economy/leaderboard.json similarity index 100% rename from src/services/languages/uk-UA/economy/leaderboard.json rename to src/services/languages/locales/uk-UA/economy/leaderboard.json diff --git a/src/services/languages/uk-UA/economy/marry.json b/src/services/languages/locales/uk-UA/economy/marry.json similarity index 100% rename from src/services/languages/uk-UA/economy/marry.json rename to src/services/languages/locales/uk-UA/economy/marry.json diff --git a/src/services/languages/uk-UA/economy/money.json b/src/services/languages/locales/uk-UA/economy/money.json similarity index 100% rename from src/services/languages/uk-UA/economy/money.json rename to src/services/languages/locales/uk-UA/economy/money.json diff --git a/src/services/languages/uk-UA/economy/pay.json b/src/services/languages/locales/uk-UA/economy/pay.json similarity index 100% rename from src/services/languages/uk-UA/economy/pay.json rename to src/services/languages/locales/uk-UA/economy/pay.json diff --git a/src/services/languages/uk-UA/economy/profile.json b/src/services/languages/locales/uk-UA/economy/profile.json similarity index 100% rename from src/services/languages/uk-UA/economy/profile.json rename to src/services/languages/locales/uk-UA/economy/profile.json diff --git a/src/services/languages/uk-UA/economy/rep.json b/src/services/languages/locales/uk-UA/economy/rep.json similarity index 100% rename from src/services/languages/uk-UA/economy/rep.json rename to src/services/languages/locales/uk-UA/economy/rep.json diff --git a/src/services/languages/uk-UA/economy/rob.json b/src/services/languages/locales/uk-UA/economy/rob.json similarity index 100% rename from src/services/languages/uk-UA/economy/rob.json rename to src/services/languages/locales/uk-UA/economy/rob.json diff --git a/src/services/languages/uk-UA/economy/setbio.json b/src/services/languages/locales/uk-UA/economy/setbio.json similarity index 100% rename from src/services/languages/uk-UA/economy/setbio.json rename to src/services/languages/locales/uk-UA/economy/setbio.json diff --git a/src/services/languages/uk-UA/economy/slots.json b/src/services/languages/locales/uk-UA/economy/slots.json similarity index 100% rename from src/services/languages/uk-UA/economy/slots.json rename to src/services/languages/locales/uk-UA/economy/slots.json diff --git a/src/services/languages/uk-UA/economy/transactions.json b/src/services/languages/locales/uk-UA/economy/transactions.json similarity index 100% rename from src/services/languages/uk-UA/economy/transactions.json rename to src/services/languages/locales/uk-UA/economy/transactions.json diff --git a/src/services/languages/uk-UA/economy/work.json b/src/services/languages/locales/uk-UA/economy/work.json similarity index 100% rename from src/services/languages/uk-UA/economy/work.json rename to src/services/languages/locales/uk-UA/economy/work.json diff --git a/src/services/languages/uk-UA/fun/8ball.json b/src/services/languages/locales/uk-UA/fun/8ball.json similarity index 100% rename from src/services/languages/uk-UA/fun/8ball.json rename to src/services/languages/locales/uk-UA/fun/8ball.json diff --git a/src/services/languages/uk-UA/fun/cat.json b/src/services/languages/locales/uk-UA/fun/cat.json similarity index 100% rename from src/services/languages/uk-UA/fun/cat.json rename to src/services/languages/locales/uk-UA/fun/cat.json diff --git a/src/services/languages/uk-UA/fun/dog.json b/src/services/languages/locales/uk-UA/fun/dog.json similarity index 100% rename from src/services/languages/uk-UA/fun/dog.json rename to src/services/languages/locales/uk-UA/fun/dog.json diff --git a/src/services/languages/uk-UA/fun/lmgtfy.json b/src/services/languages/locales/uk-UA/fun/lmgtfy.json similarity index 100% rename from src/services/languages/uk-UA/fun/lmgtfy.json rename to src/services/languages/locales/uk-UA/fun/lmgtfy.json diff --git a/src/services/languages/uk-UA/fun/lovecalc.json b/src/services/languages/locales/uk-UA/fun/lovecalc.json similarity index 100% rename from src/services/languages/uk-UA/fun/lovecalc.json rename to src/services/languages/locales/uk-UA/fun/lovecalc.json diff --git a/src/services/languages/uk-UA/fun/memes.json b/src/services/languages/locales/uk-UA/fun/memes.json similarity index 100% rename from src/services/languages/uk-UA/fun/memes.json rename to src/services/languages/locales/uk-UA/fun/memes.json diff --git a/src/services/languages/uk-UA/fun/number.json b/src/services/languages/locales/uk-UA/fun/number.json similarity index 100% rename from src/services/languages/uk-UA/fun/number.json rename to src/services/languages/locales/uk-UA/fun/number.json diff --git a/src/services/languages/uk-UA/fun/tictactoe.json b/src/services/languages/locales/uk-UA/fun/tictactoe.json similarity index 100% rename from src/services/languages/uk-UA/fun/tictactoe.json rename to src/services/languages/locales/uk-UA/fun/tictactoe.json diff --git a/src/services/languages/uk-UA/general/afk.json b/src/services/languages/locales/uk-UA/general/afk.json similarity index 100% rename from src/services/languages/uk-UA/general/afk.json rename to src/services/languages/locales/uk-UA/general/afk.json diff --git a/src/services/languages/uk-UA/general/avatar.json b/src/services/languages/locales/uk-UA/general/avatar.json similarity index 100% rename from src/services/languages/uk-UA/general/avatar.json rename to src/services/languages/locales/uk-UA/general/avatar.json diff --git a/src/services/languages/uk-UA/general/boosters.json b/src/services/languages/locales/uk-UA/general/boosters.json similarity index 100% rename from src/services/languages/uk-UA/general/boosters.json rename to src/services/languages/locales/uk-UA/general/boosters.json diff --git a/src/services/languages/uk-UA/general/emoji.json b/src/services/languages/locales/uk-UA/general/emoji.json similarity index 100% rename from src/services/languages/uk-UA/general/emoji.json rename to src/services/languages/locales/uk-UA/general/emoji.json diff --git a/src/services/languages/uk-UA/general/help.json b/src/services/languages/locales/uk-UA/general/help.json similarity index 100% rename from src/services/languages/uk-UA/general/help.json rename to src/services/languages/locales/uk-UA/general/help.json diff --git a/src/services/languages/uk-UA/general/info.json b/src/services/languages/locales/uk-UA/general/info.json similarity index 100% rename from src/services/languages/uk-UA/general/info.json rename to src/services/languages/locales/uk-UA/general/info.json diff --git a/src/services/languages/uk-UA/general/minecraft.json b/src/services/languages/locales/uk-UA/general/minecraft.json similarity index 100% rename from src/services/languages/uk-UA/general/minecraft.json rename to src/services/languages/locales/uk-UA/general/minecraft.json diff --git a/src/services/languages/uk-UA/general/ping.json b/src/services/languages/locales/uk-UA/general/ping.json similarity index 100% rename from src/services/languages/uk-UA/general/ping.json rename to src/services/languages/locales/uk-UA/general/ping.json diff --git a/src/services/languages/uk-UA/general/remindme.json b/src/services/languages/locales/uk-UA/general/remindme.json similarity index 100% rename from src/services/languages/uk-UA/general/remindme.json rename to src/services/languages/locales/uk-UA/general/remindme.json diff --git a/src/services/languages/uk-UA/general/reminds.json b/src/services/languages/locales/uk-UA/general/reminds.json similarity index 100% rename from src/services/languages/uk-UA/general/reminds.json rename to src/services/languages/locales/uk-UA/general/reminds.json diff --git a/src/services/languages/uk-UA/general/report.json b/src/services/languages/locales/uk-UA/general/report.json similarity index 100% rename from src/services/languages/uk-UA/general/report.json rename to src/services/languages/locales/uk-UA/general/report.json diff --git a/src/services/languages/uk-UA/general/shorturl.json b/src/services/languages/locales/uk-UA/general/shorturl.json similarity index 100% rename from src/services/languages/uk-UA/general/shorturl.json rename to src/services/languages/locales/uk-UA/general/shorturl.json diff --git a/src/services/languages/uk-UA/general/staff.json b/src/services/languages/locales/uk-UA/general/staff.json similarity index 100% rename from src/services/languages/uk-UA/general/staff.json rename to src/services/languages/locales/uk-UA/general/staff.json diff --git a/src/services/languages/uk-UA/general/stats.json b/src/services/languages/locales/uk-UA/general/stats.json similarity index 100% rename from src/services/languages/uk-UA/general/stats.json rename to src/services/languages/locales/uk-UA/general/stats.json diff --git a/src/services/languages/uk-UA/general/suggest.json b/src/services/languages/locales/uk-UA/general/suggest.json similarity index 100% rename from src/services/languages/uk-UA/general/suggest.json rename to src/services/languages/locales/uk-UA/general/suggest.json diff --git a/src/services/languages/uk-UA/general/whois.json b/src/services/languages/locales/uk-UA/general/whois.json similarity index 100% rename from src/services/languages/uk-UA/general/whois.json rename to src/services/languages/locales/uk-UA/general/whois.json diff --git a/src/services/languages/uk-UA/iat/checkjar.json b/src/services/languages/locales/uk-UA/iat/checkjar.json similarity index 100% rename from src/services/languages/uk-UA/iat/checkjar.json rename to src/services/languages/locales/uk-UA/iat/checkjar.json diff --git a/src/services/languages/uk-UA/misc.json b/src/services/languages/locales/uk-UA/misc.json similarity index 100% rename from src/services/languages/uk-UA/misc.json rename to src/services/languages/locales/uk-UA/misc.json diff --git a/src/services/languages/uk-UA/moderation/ban.json b/src/services/languages/locales/uk-UA/moderation/ban.json similarity index 100% rename from src/services/languages/uk-UA/moderation/ban.json rename to src/services/languages/locales/uk-UA/moderation/ban.json diff --git a/src/services/languages/uk-UA/moderation/clear.json b/src/services/languages/locales/uk-UA/moderation/clear.json similarity index 100% rename from src/services/languages/uk-UA/moderation/clear.json rename to src/services/languages/locales/uk-UA/moderation/clear.json diff --git a/src/services/languages/uk-UA/moderation/clearwarns.json b/src/services/languages/locales/uk-UA/moderation/clearwarns.json similarity index 100% rename from src/services/languages/uk-UA/moderation/clearwarns.json rename to src/services/languages/locales/uk-UA/moderation/clearwarns.json diff --git a/src/services/languages/uk-UA/moderation/giveaway.json b/src/services/languages/locales/uk-UA/moderation/giveaway.json similarity index 100% rename from src/services/languages/uk-UA/moderation/giveaway.json rename to src/services/languages/locales/uk-UA/moderation/giveaway.json diff --git a/src/services/languages/uk-UA/moderation/kick.json b/src/services/languages/locales/uk-UA/moderation/kick.json similarity index 100% rename from src/services/languages/uk-UA/moderation/kick.json rename to src/services/languages/locales/uk-UA/moderation/kick.json diff --git a/src/services/languages/uk-UA/moderation/unban.json b/src/services/languages/locales/uk-UA/moderation/unban.json similarity index 100% rename from src/services/languages/uk-UA/moderation/unban.json rename to src/services/languages/locales/uk-UA/moderation/unban.json diff --git a/src/services/languages/uk-UA/moderation/untimeout.json b/src/services/languages/locales/uk-UA/moderation/untimeout.json similarity index 100% rename from src/services/languages/uk-UA/moderation/untimeout.json rename to src/services/languages/locales/uk-UA/moderation/untimeout.json diff --git a/src/services/languages/uk-UA/moderation/warn.json b/src/services/languages/locales/uk-UA/moderation/warn.json similarity index 100% rename from src/services/languages/uk-UA/moderation/warn.json rename to src/services/languages/locales/uk-UA/moderation/warn.json diff --git a/src/services/languages/uk-UA/moderation/warns.json b/src/services/languages/locales/uk-UA/moderation/warns.json similarity index 100% rename from src/services/languages/uk-UA/moderation/warns.json rename to src/services/languages/locales/uk-UA/moderation/warns.json diff --git a/src/services/languages/uk-UA/music/back.json b/src/services/languages/locales/uk-UA/music/back.json similarity index 100% rename from src/services/languages/uk-UA/music/back.json rename to src/services/languages/locales/uk-UA/music/back.json diff --git a/src/services/languages/uk-UA/music/clips.json b/src/services/languages/locales/uk-UA/music/clips.json similarity index 100% rename from src/services/languages/uk-UA/music/clips.json rename to src/services/languages/locales/uk-UA/music/clips.json diff --git a/src/services/languages/uk-UA/music/loop.json b/src/services/languages/locales/uk-UA/music/loop.json similarity index 100% rename from src/services/languages/uk-UA/music/loop.json rename to src/services/languages/locales/uk-UA/music/loop.json diff --git a/src/services/languages/uk-UA/music/nowplaying.json b/src/services/languages/locales/uk-UA/music/nowplaying.json similarity index 100% rename from src/services/languages/uk-UA/music/nowplaying.json rename to src/services/languages/locales/uk-UA/music/nowplaying.json diff --git a/src/services/languages/uk-UA/music/play.json b/src/services/languages/locales/uk-UA/music/play.json similarity index 100% rename from src/services/languages/uk-UA/music/play.json rename to src/services/languages/locales/uk-UA/music/play.json diff --git a/src/services/languages/uk-UA/music/queue.json b/src/services/languages/locales/uk-UA/music/queue.json similarity index 100% rename from src/services/languages/uk-UA/music/queue.json rename to src/services/languages/locales/uk-UA/music/queue.json diff --git a/src/services/languages/uk-UA/music/seek.json b/src/services/languages/locales/uk-UA/music/seek.json similarity index 100% rename from src/services/languages/uk-UA/music/seek.json rename to src/services/languages/locales/uk-UA/music/seek.json diff --git a/src/services/languages/uk-UA/music/shuffle.json b/src/services/languages/locales/uk-UA/music/shuffle.json similarity index 100% rename from src/services/languages/uk-UA/music/shuffle.json rename to src/services/languages/locales/uk-UA/music/shuffle.json diff --git a/src/services/languages/uk-UA/music/skip.json b/src/services/languages/locales/uk-UA/music/skip.json similarity index 100% rename from src/services/languages/uk-UA/music/skip.json rename to src/services/languages/locales/uk-UA/music/skip.json diff --git a/src/services/languages/uk-UA/music/stop.json b/src/services/languages/locales/uk-UA/music/stop.json similarity index 100% rename from src/services/languages/uk-UA/music/stop.json rename to src/services/languages/locales/uk-UA/music/stop.json diff --git a/src/services/languages/uk-UA/music/volume.json b/src/services/languages/locales/uk-UA/music/volume.json similarity index 100% rename from src/services/languages/uk-UA/music/volume.json rename to src/services/languages/locales/uk-UA/music/volume.json diff --git a/src/services/languages/uk-UA/owner/announcement.json b/src/services/languages/locales/uk-UA/owner/announcement.json similarity index 100% rename from src/services/languages/uk-UA/owner/announcement.json rename to src/services/languages/locales/uk-UA/owner/announcement.json diff --git a/src/services/languages/uk-UA/owner/debug.json b/src/services/languages/locales/uk-UA/owner/debug.json similarity index 100% rename from src/services/languages/uk-UA/owner/debug.json rename to src/services/languages/locales/uk-UA/owner/debug.json diff --git a/src/services/languages/uk-UA/owner/eval.json b/src/services/languages/locales/uk-UA/owner/eval.json similarity index 100% rename from src/services/languages/uk-UA/owner/eval.json rename to src/services/languages/locales/uk-UA/owner/eval.json diff --git a/src/services/languages/uk-UA/owner/reload.json b/src/services/languages/locales/uk-UA/owner/reload.json similarity index 100% rename from src/services/languages/uk-UA/owner/reload.json rename to src/services/languages/locales/uk-UA/owner/reload.json diff --git a/src/services/languages/uk-UA/owner/say.json b/src/services/languages/locales/uk-UA/owner/say.json similarity index 100% rename from src/services/languages/uk-UA/owner/say.json rename to src/services/languages/locales/uk-UA/owner/say.json diff --git a/src/services/languages/uk-UA/owner/servers.json b/src/services/languages/locales/uk-UA/owner/servers.json similarity index 100% rename from src/services/languages/uk-UA/owner/servers.json rename to src/services/languages/locales/uk-UA/owner/servers.json diff --git a/src/services/languages/uk-UA/tickets/adduser.json b/src/services/languages/locales/uk-UA/tickets/adduser.json similarity index 100% rename from src/services/languages/uk-UA/tickets/adduser.json rename to src/services/languages/locales/uk-UA/tickets/adduser.json diff --git a/src/services/languages/uk-UA/tickets/closeticket.json b/src/services/languages/locales/uk-UA/tickets/closeticket.json similarity index 100% rename from src/services/languages/uk-UA/tickets/closeticket.json rename to src/services/languages/locales/uk-UA/tickets/closeticket.json diff --git a/src/services/languages/uk-UA/tickets/createticketembed.json b/src/services/languages/locales/uk-UA/tickets/createticketembed.json similarity index 100% rename from src/services/languages/uk-UA/tickets/createticketembed.json rename to src/services/languages/locales/uk-UA/tickets/createticketembed.json diff --git a/src/services/languages/uk-UA/tickets/removeuser.json b/src/services/languages/locales/uk-UA/tickets/removeuser.json similarity index 100% rename from src/services/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 index 50db67d6..c55a5ac3 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -3,7 +3,8 @@ 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 ConfigService from "../services/config/index.js"; +import InternationalizationService from "../services/languages/index.js"; export class ExtendedClient extends Client { /** @@ -12,8 +13,9 @@ export class ExtendedClient extends Client { constructor(options) { super(options); - this.configService = new configService(); + this.configService = new ConfigService(); this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); + this.i18n = new InternationalizationService(this); } async init() { From 30a83aa273f24d1f6acce0d6693227237c6923ab Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 12 Dec 2024 20:55:11 +0500 Subject: [PATCH 23/37] refactor: fix i18n debug being true on production --- src/index.js | 50 +++++---------------------------- src/services/languages/index.js | 2 +- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/index.js b/src/index.js index 3429d899..48d43465 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,6 @@ -// import "./helpers/extenders.js"; - -// import { GatewayIntentBits } from "discord.js"; -// import JaBaClient from "./base/Client.js"; -// import languages from "./helpers/languages.js"; - import { GatewayIntentBits } from "discord.js"; import { ExtendedClient } from "./structures/client.js"; +import logger from "./helpers/logger.js"; export const client = new ExtendedClient({ intents: [ @@ -30,41 +25,10 @@ export const client = new ExtendedClient({ client.init(); -// const client = new JaBaClient({ -// intents: [ -// GatewayIntentBits.Guilds, -// GatewayIntentBits.GuildMembers, -// GatewayIntentBits.GuildModeration, -// GatewayIntentBits.GuildEmojisAndStickers, -// GatewayIntentBits.GuildIntegrations, -// GatewayIntentBits.GuildInvites, -// GatewayIntentBits.GuildVoiceStates, -// GatewayIntentBits.GuildPresences, -// GatewayIntentBits.GuildMessages, -// GatewayIntentBits.GuildMessageReactions, -// GatewayIntentBits.GuildMessageTyping, -// GatewayIntentBits.MessageContent, -// GatewayIntentBits.DirectMessageTyping, -// GatewayIntentBits.DirectMessages, -// GatewayIntentBits.DirectMessageReactions, -// ], -// allowedMentions: { parse: ["everyone", "roles", "users"] }, -// }); +client + .on("disconnect", () => logger.warn("Bot disconnected.")) + .on("reconnecting", () => logger.warn("Bot reconnecting...")) + .on("warn", console.log) + .on("error", console.log); -// (async () => { -// console.time("botReady"); - -// client.translations = await 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)); +process.on("unhandledRejection", console.log).on("uncaughtException", console.log); diff --git a/src/services/languages/index.js b/src/services/languages/index.js index e09397ee..a2cd78b9 100644 --- a/src/services/languages/index.js +++ b/src/services/languages/index.js @@ -51,7 +51,7 @@ export default class InternationalizationService { backend: { loadPath: resolve(this.options.localesPath, "./{{lng}}/{{ns}}.json"), }, - debug: this.client.configService.get("production") ? true : false, + debug: this.client.configService.get("production") ? false : true, fallbackLng: this.options.defaultLanguage, preload: languages, ns: namespaces, From d0b4a13a2e91267b62c91f7502e1afb0b9b5ad23 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 12 Dec 2024 21:05:23 +0500 Subject: [PATCH 24/37] refactor: move commands and events so we can start properly --- src/adapters/database/MongooseAdapter.js | 5 +- src/{base => base_OLD}/BaseCommand.js | 0 src/{base => base_OLD}/BaseEvent.js | 0 src/{base => base_OLD}/Client.js | 0 src/commands/Fun/8ball.js | 78 ++----------------- .../Administration/addemoji.js | 0 .../Administration/automod.js | 0 .../Administration/autorole.js | 0 .../Administration/config.js | 0 .../Administration/goodbye.js | 0 .../Administration/selectroles.js | 0 .../Administration/set.js | 0 .../Administration/setlang.js | 0 .../Administration/stealemoji.js | 0 .../Administration/welcome.js | 0 .../Beatrun/courses.js | 0 .../Economy/achievements.js | 0 .../Economy/bank.js | 0 .../Economy/birthdate.js | 0 .../Economy/divorce.js | 0 .../Economy/leaderboard.js | 0 .../Economy/marry.js | 0 .../Economy/money.js | 0 src/{commands => commands_OLD}/Economy/pay.js | 0 .../Economy/profile.js | 0 src/{commands => commands_OLD}/Economy/rep.js | 0 src/{commands => commands_OLD}/Economy/rob.js | 0 .../Economy/setbio.js | 0 .../Economy/slots.js | 0 .../Economy/transactions.js | 0 .../Economy/work.js | 0 src/commands_OLD/Fun/8ball.js | 72 +++++++++++++++++ src/{commands => commands_OLD}/Fun/cat.js | 0 src/{commands => commands_OLD}/Fun/dog.js | 0 src/{commands => commands_OLD}/Fun/lmgtfy.js | 0 .../Fun/lovecalc.js | 0 src/{commands => commands_OLD}/Fun/number.js | 0 .../Fun/tictactoe.js | 0 src/{commands => commands_OLD}/General/afk.js | 0 .../General/avatar.c.js | 0 .../General/avatar.js | 0 .../General/boosters.js | 0 .../General/emoji.js | 0 .../General/help.js | 0 .../General/info.js | 0 .../General/minecraft.js | 0 .../General/ping.js | 0 .../General/remindme.js | 0 .../General/reminds.js | 0 .../General/report.js | 0 .../General/shorturl.js | 0 .../General/stats.js | 0 .../General/suggest.js | 0 .../General/whois.js | 0 .../IAT/checkjar.js | 0 .../Moderation/clear.js | 0 .../Moderation/clearwarns.js | 0 .../Moderation/giveaway.js | 0 .../Moderation/unban.js | 0 .../Moderation/untimeout.js | 0 .../Moderation/warn.c.js | 0 .../Moderation/warns.js | 0 src/{commands => commands_OLD}/Music/back.js | 0 src/{commands => commands_OLD}/Music/clips.js | 0 src/{commands => commands_OLD}/Music/loop.js | 0 .../Music/nowplaying.js | 0 .../Music/play.c.js | 0 src/{commands => commands_OLD}/Music/play.js | 0 src/{commands => commands_OLD}/Music/queue.js | 0 src/{commands => commands_OLD}/Music/seek.js | 0 .../Music/shuffle.js | 0 src/{commands => commands_OLD}/Music/skip.js | 0 src/{commands => commands_OLD}/Music/stop.js | 0 .../Music/volume.js | 0 src/{commands => commands_OLD}/Owner/debug.js | 0 src/{commands => commands_OLD}/Owner/eval.js | 0 .../Owner/reload.js | 0 src/{commands => commands_OLD}/Owner/say.js | 0 .../Owner/servers.js | 0 .../Tickets/adduser.js | 0 .../Tickets/closeticket.js | 0 .../Tickets/createticketembed.js | 0 .../Tickets/removeuser.js | 0 src/events/Ready.js | 72 +++-------------- src/{events => events_OLD}/CommandHandler.js | 0 .../Guild/guildBanAdd.js | 0 .../Guild/guildCreate.js | 0 .../Guild/guildDelete.js | 0 .../Guild/guildMemberAdd.js | 0 .../Guild/guildMemberRemove.js | 0 .../Guild/guildMemberUpdate.js | 0 src/{events => events_OLD}/MessageHandler.js | 0 .../Monitoring/messageDelete.js | 0 .../Monitoring/messageUpdate.js | 0 src/events_OLD/Ready.js | 64 +++++++++++++++ src/{events => events_OLD}/TicketsButton.js | 0 src/newCommands/Fun/8ball.js | 8 -- src/newEvents/ready.js | 14 ---- 98 files changed, 157 insertions(+), 156 deletions(-) rename src/{base => base_OLD}/BaseCommand.js (100%) rename src/{base => base_OLD}/BaseEvent.js (100%) rename src/{base => base_OLD}/Client.js (100%) rename src/{commands => commands_OLD}/Administration/addemoji.js (100%) rename src/{commands => commands_OLD}/Administration/automod.js (100%) rename src/{commands => commands_OLD}/Administration/autorole.js (100%) rename src/{commands => commands_OLD}/Administration/config.js (100%) rename src/{commands => commands_OLD}/Administration/goodbye.js (100%) rename src/{commands => commands_OLD}/Administration/selectroles.js (100%) rename src/{commands => commands_OLD}/Administration/set.js (100%) rename src/{commands => commands_OLD}/Administration/setlang.js (100%) rename src/{commands => commands_OLD}/Administration/stealemoji.js (100%) rename src/{commands => commands_OLD}/Administration/welcome.js (100%) rename src/{commands => commands_OLD}/Beatrun/courses.js (100%) rename src/{commands => commands_OLD}/Economy/achievements.js (100%) rename src/{commands => commands_OLD}/Economy/bank.js (100%) rename src/{commands => commands_OLD}/Economy/birthdate.js (100%) rename src/{commands => commands_OLD}/Economy/divorce.js (100%) rename src/{commands => commands_OLD}/Economy/leaderboard.js (100%) rename src/{commands => commands_OLD}/Economy/marry.js (100%) rename src/{commands => commands_OLD}/Economy/money.js (100%) rename src/{commands => commands_OLD}/Economy/pay.js (100%) rename src/{commands => commands_OLD}/Economy/profile.js (100%) rename src/{commands => commands_OLD}/Economy/rep.js (100%) rename src/{commands => commands_OLD}/Economy/rob.js (100%) rename src/{commands => commands_OLD}/Economy/setbio.js (100%) rename src/{commands => commands_OLD}/Economy/slots.js (100%) rename src/{commands => commands_OLD}/Economy/transactions.js (100%) rename src/{commands => commands_OLD}/Economy/work.js (100%) create mode 100644 src/commands_OLD/Fun/8ball.js rename src/{commands => commands_OLD}/Fun/cat.js (100%) rename src/{commands => commands_OLD}/Fun/dog.js (100%) rename src/{commands => commands_OLD}/Fun/lmgtfy.js (100%) rename src/{commands => commands_OLD}/Fun/lovecalc.js (100%) rename src/{commands => commands_OLD}/Fun/number.js (100%) rename src/{commands => commands_OLD}/Fun/tictactoe.js (100%) rename src/{commands => commands_OLD}/General/afk.js (100%) rename src/{commands => commands_OLD}/General/avatar.c.js (100%) rename src/{commands => commands_OLD}/General/avatar.js (100%) rename src/{commands => commands_OLD}/General/boosters.js (100%) rename src/{commands => commands_OLD}/General/emoji.js (100%) rename src/{commands => commands_OLD}/General/help.js (100%) rename src/{commands => commands_OLD}/General/info.js (100%) rename src/{commands => commands_OLD}/General/minecraft.js (100%) rename src/{commands => commands_OLD}/General/ping.js (100%) rename src/{commands => commands_OLD}/General/remindme.js (100%) rename src/{commands => commands_OLD}/General/reminds.js (100%) rename src/{commands => commands_OLD}/General/report.js (100%) rename src/{commands => commands_OLD}/General/shorturl.js (100%) rename src/{commands => commands_OLD}/General/stats.js (100%) rename src/{commands => commands_OLD}/General/suggest.js (100%) rename src/{commands => commands_OLD}/General/whois.js (100%) rename src/{commands => commands_OLD}/IAT/checkjar.js (100%) rename src/{commands => commands_OLD}/Moderation/clear.js (100%) rename src/{commands => commands_OLD}/Moderation/clearwarns.js (100%) rename src/{commands => commands_OLD}/Moderation/giveaway.js (100%) rename src/{commands => commands_OLD}/Moderation/unban.js (100%) rename src/{commands => commands_OLD}/Moderation/untimeout.js (100%) rename src/{commands => commands_OLD}/Moderation/warn.c.js (100%) rename src/{commands => commands_OLD}/Moderation/warns.js (100%) rename src/{commands => commands_OLD}/Music/back.js (100%) rename src/{commands => commands_OLD}/Music/clips.js (100%) rename src/{commands => commands_OLD}/Music/loop.js (100%) rename src/{commands => commands_OLD}/Music/nowplaying.js (100%) rename src/{commands => commands_OLD}/Music/play.c.js (100%) rename src/{commands => commands_OLD}/Music/play.js (100%) rename src/{commands => commands_OLD}/Music/queue.js (100%) rename src/{commands => commands_OLD}/Music/seek.js (100%) rename src/{commands => commands_OLD}/Music/shuffle.js (100%) rename src/{commands => commands_OLD}/Music/skip.js (100%) rename src/{commands => commands_OLD}/Music/stop.js (100%) rename src/{commands => commands_OLD}/Music/volume.js (100%) rename src/{commands => commands_OLD}/Owner/debug.js (100%) rename src/{commands => commands_OLD}/Owner/eval.js (100%) rename src/{commands => commands_OLD}/Owner/reload.js (100%) rename src/{commands => commands_OLD}/Owner/say.js (100%) rename src/{commands => commands_OLD}/Owner/servers.js (100%) rename src/{commands => commands_OLD}/Tickets/adduser.js (100%) rename src/{commands => commands_OLD}/Tickets/closeticket.js (100%) rename src/{commands => commands_OLD}/Tickets/createticketembed.js (100%) rename src/{commands => commands_OLD}/Tickets/removeuser.js (100%) rename src/{events => events_OLD}/CommandHandler.js (100%) rename src/{events => events_OLD}/Guild/guildBanAdd.js (100%) rename src/{events => events_OLD}/Guild/guildCreate.js (100%) rename src/{events => events_OLD}/Guild/guildDelete.js (100%) rename src/{events => events_OLD}/Guild/guildMemberAdd.js (100%) rename src/{events => events_OLD}/Guild/guildMemberRemove.js (100%) rename src/{events => events_OLD}/Guild/guildMemberUpdate.js (100%) rename src/{events => events_OLD}/MessageHandler.js (100%) rename src/{events => events_OLD}/Monitoring/messageDelete.js (100%) rename src/{events => events_OLD}/Monitoring/messageUpdate.js (100%) create mode 100644 src/events_OLD/Ready.js rename src/{events => events_OLD}/TicketsButton.js (100%) delete mode 100644 src/newCommands/Fun/8ball.js delete mode 100644 src/newEvents/ready.js diff --git a/src/adapters/database/MongooseAdapter.js b/src/adapters/database/MongooseAdapter.js index f6d244c3..7bae112e 100644 --- a/src/adapters/database/MongooseAdapter.js +++ b/src/adapters/database/MongooseAdapter.js @@ -1,5 +1,6 @@ import mongoose from "mongoose"; import IDatabaseAdapter from "./IDatabaseAdapter.js"; +import logger from "../../helpers/logger.js"; export default class MongooseAdapter extends IDatabaseAdapter { /** @@ -21,11 +22,11 @@ export default class MongooseAdapter extends IDatabaseAdapter { async connect() { await mongoose.connect(this.uri, this.options); - console.log("Database connected."); + logger.log("Database connected."); } async disconnect() { await mongoose.disconnect(); - console.log("Database disconnected."); + console.warn("Database disconnected."); } } diff --git a/src/base/BaseCommand.js b/src/base_OLD/BaseCommand.js similarity index 100% rename from src/base/BaseCommand.js rename to src/base_OLD/BaseCommand.js diff --git a/src/base/BaseEvent.js b/src/base_OLD/BaseEvent.js similarity index 100% rename from src/base/BaseEvent.js rename to src/base_OLD/BaseEvent.js diff --git a/src/base/Client.js b/src/base_OLD/Client.js similarity index 100% rename from src/base/Client.js rename to src/base_OLD/Client.js diff --git a/src/commands/Fun/8ball.js b/src/commands/Fun/8ball.js index 006d3b10..7600c06c 100644 --- a/src/commands/Fun/8ball.js +++ b/src/commands/Fun/8ball.js @@ -1,72 +1,8 @@ -const { SlashCommandBuilder, InteractionContextType, ApplicationIntegrationType } = require("discord.js"); -const BaseCommand = require("../../base/BaseCommand"); +export const data = { + name: "8ball", + description: "8ball", +}; -class Eightball extends BaseCommand { - /** - * - * @param {import("../base/Client")} client - */ - constructor(client) { - super({ - command: new SlashCommandBuilder() - .setName("8ball") - .setDescription(client.translate("fun/8ball:DESCRIPTION")) - .setDescriptionLocalizations({ - uk: client.translate("fun/8ball:DESCRIPTION", null, "uk-UA"), - ru: client.translate("fun/8ball:DESCRIPTION", null, "ru-RU"), - }) - .setIntegrationTypes([ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall]) - .setContexts([InteractionContextType.BotDM, InteractionContextType.PrivateChannel, InteractionContextType.Guild]) - .addStringOption(option => - option - .setName("question") - .setDescription(client.translate("fun/8ball:QUESTION")) - .setDescriptionLocalizations({ - uk: client.translate("fun/8ball:QUESTION", null, "uk-UA"), - ru: client.translate("fun/8ball:QUESTION", null, "ru-RU"), - }) - .setRequired(true), - ) - .addBooleanOption(option => - option - .setName("ephemeral") - .setDescription(client.translate("misc:EPHEMERAL_RESPONSE")) - .setDescriptionLocalizations({ - uk: client.translate("misc:EPHEMERAL_RESPONSE", null, "uk-UA"), - ru: client.translate("misc:EPHEMERAL_RESPONSE", null, "ru-RU"), - }), - ), - dirname: __dirname, - ownerOnly: false, - }); - } - - /** - * - * @param {import("../../base/Client")} client - * @param {import("discord.js").ChatInputCommandInteraction} interaction - */ - async execute(client, interaction) { - await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false }); - - const question = interaction.options.getString("question"); - const embed = client.embed({ - fields: [ - { - name: interaction.translate("fun/8ball:QUESTION"), - value: question, - }, - { - name: interaction.translate("fun/8ball:ANSWER"), - value: interaction.translate(`fun/8ball:RESPONSE_${client.functions.randomNum(1, 20)}`), - }, - ], - }); - - await client.wait(5000); - - interaction.editReply({ embeds: [embed] }); - } -} - -module.exports = Eightball; +export const run = () => { + console.log("8ball"); +}; diff --git a/src/commands/Administration/addemoji.js b/src/commands_OLD/Administration/addemoji.js similarity index 100% rename from src/commands/Administration/addemoji.js rename to src/commands_OLD/Administration/addemoji.js diff --git a/src/commands/Administration/automod.js b/src/commands_OLD/Administration/automod.js similarity index 100% rename from src/commands/Administration/automod.js rename to src/commands_OLD/Administration/automod.js diff --git a/src/commands/Administration/autorole.js b/src/commands_OLD/Administration/autorole.js similarity index 100% rename from src/commands/Administration/autorole.js rename to src/commands_OLD/Administration/autorole.js diff --git a/src/commands/Administration/config.js b/src/commands_OLD/Administration/config.js similarity index 100% rename from src/commands/Administration/config.js rename to src/commands_OLD/Administration/config.js diff --git a/src/commands/Administration/goodbye.js b/src/commands_OLD/Administration/goodbye.js similarity index 100% rename from src/commands/Administration/goodbye.js rename to src/commands_OLD/Administration/goodbye.js diff --git a/src/commands/Administration/selectroles.js b/src/commands_OLD/Administration/selectroles.js similarity index 100% rename from src/commands/Administration/selectroles.js rename to src/commands_OLD/Administration/selectroles.js diff --git a/src/commands/Administration/set.js b/src/commands_OLD/Administration/set.js similarity index 100% rename from src/commands/Administration/set.js rename to src/commands_OLD/Administration/set.js diff --git a/src/commands/Administration/setlang.js b/src/commands_OLD/Administration/setlang.js similarity index 100% rename from src/commands/Administration/setlang.js rename to src/commands_OLD/Administration/setlang.js diff --git a/src/commands/Administration/stealemoji.js b/src/commands_OLD/Administration/stealemoji.js similarity index 100% rename from src/commands/Administration/stealemoji.js rename to src/commands_OLD/Administration/stealemoji.js diff --git a/src/commands/Administration/welcome.js b/src/commands_OLD/Administration/welcome.js similarity index 100% rename from src/commands/Administration/welcome.js rename to src/commands_OLD/Administration/welcome.js diff --git a/src/commands/Beatrun/courses.js b/src/commands_OLD/Beatrun/courses.js similarity index 100% rename from src/commands/Beatrun/courses.js rename to src/commands_OLD/Beatrun/courses.js diff --git a/src/commands/Economy/achievements.js b/src/commands_OLD/Economy/achievements.js similarity index 100% rename from src/commands/Economy/achievements.js rename to src/commands_OLD/Economy/achievements.js diff --git a/src/commands/Economy/bank.js b/src/commands_OLD/Economy/bank.js similarity index 100% rename from src/commands/Economy/bank.js rename to src/commands_OLD/Economy/bank.js diff --git a/src/commands/Economy/birthdate.js b/src/commands_OLD/Economy/birthdate.js similarity index 100% rename from src/commands/Economy/birthdate.js rename to src/commands_OLD/Economy/birthdate.js diff --git a/src/commands/Economy/divorce.js b/src/commands_OLD/Economy/divorce.js similarity index 100% rename from src/commands/Economy/divorce.js rename to src/commands_OLD/Economy/divorce.js diff --git a/src/commands/Economy/leaderboard.js b/src/commands_OLD/Economy/leaderboard.js similarity index 100% rename from src/commands/Economy/leaderboard.js rename to src/commands_OLD/Economy/leaderboard.js diff --git a/src/commands/Economy/marry.js b/src/commands_OLD/Economy/marry.js similarity index 100% rename from src/commands/Economy/marry.js rename to src/commands_OLD/Economy/marry.js diff --git a/src/commands/Economy/money.js b/src/commands_OLD/Economy/money.js similarity index 100% rename from src/commands/Economy/money.js rename to src/commands_OLD/Economy/money.js diff --git a/src/commands/Economy/pay.js b/src/commands_OLD/Economy/pay.js similarity index 100% rename from src/commands/Economy/pay.js rename to src/commands_OLD/Economy/pay.js diff --git a/src/commands/Economy/profile.js b/src/commands_OLD/Economy/profile.js similarity index 100% rename from src/commands/Economy/profile.js rename to src/commands_OLD/Economy/profile.js diff --git a/src/commands/Economy/rep.js b/src/commands_OLD/Economy/rep.js similarity index 100% rename from src/commands/Economy/rep.js rename to src/commands_OLD/Economy/rep.js diff --git a/src/commands/Economy/rob.js b/src/commands_OLD/Economy/rob.js similarity index 100% rename from src/commands/Economy/rob.js rename to src/commands_OLD/Economy/rob.js diff --git a/src/commands/Economy/setbio.js b/src/commands_OLD/Economy/setbio.js similarity index 100% rename from src/commands/Economy/setbio.js rename to src/commands_OLD/Economy/setbio.js diff --git a/src/commands/Economy/slots.js b/src/commands_OLD/Economy/slots.js similarity index 100% rename from src/commands/Economy/slots.js rename to src/commands_OLD/Economy/slots.js diff --git a/src/commands/Economy/transactions.js b/src/commands_OLD/Economy/transactions.js similarity index 100% rename from src/commands/Economy/transactions.js rename to src/commands_OLD/Economy/transactions.js diff --git a/src/commands/Economy/work.js b/src/commands_OLD/Economy/work.js similarity index 100% rename from src/commands/Economy/work.js rename to src/commands_OLD/Economy/work.js diff --git a/src/commands_OLD/Fun/8ball.js b/src/commands_OLD/Fun/8ball.js new file mode 100644 index 00000000..006d3b10 --- /dev/null +++ b/src/commands_OLD/Fun/8ball.js @@ -0,0 +1,72 @@ +const { SlashCommandBuilder, InteractionContextType, ApplicationIntegrationType } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Eightball extends BaseCommand { + /** + * + * @param {import("../base/Client")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("8ball") + .setDescription(client.translate("fun/8ball:DESCRIPTION")) + .setDescriptionLocalizations({ + uk: client.translate("fun/8ball:DESCRIPTION", null, "uk-UA"), + ru: client.translate("fun/8ball:DESCRIPTION", null, "ru-RU"), + }) + .setIntegrationTypes([ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall]) + .setContexts([InteractionContextType.BotDM, InteractionContextType.PrivateChannel, InteractionContextType.Guild]) + .addStringOption(option => + option + .setName("question") + .setDescription(client.translate("fun/8ball:QUESTION")) + .setDescriptionLocalizations({ + uk: client.translate("fun/8ball:QUESTION", null, "uk-UA"), + ru: client.translate("fun/8ball:QUESTION", null, "ru-RU"), + }) + .setRequired(true), + ) + .addBooleanOption(option => + option + .setName("ephemeral") + .setDescription(client.translate("misc:EPHEMERAL_RESPONSE")) + .setDescriptionLocalizations({ + uk: client.translate("misc:EPHEMERAL_RESPONSE", null, "uk-UA"), + ru: client.translate("misc:EPHEMERAL_RESPONSE", null, "ru-RU"), + }), + ), + dirname: __dirname, + ownerOnly: false, + }); + } + + /** + * + * @param {import("../../base/Client")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + */ + async execute(client, interaction) { + await interaction.deferReply({ ephemeral: interaction.options.getBoolean("ephemeral") || false }); + + const question = interaction.options.getString("question"); + const embed = client.embed({ + fields: [ + { + name: interaction.translate("fun/8ball:QUESTION"), + value: question, + }, + { + name: interaction.translate("fun/8ball:ANSWER"), + value: interaction.translate(`fun/8ball:RESPONSE_${client.functions.randomNum(1, 20)}`), + }, + ], + }); + + await client.wait(5000); + + interaction.editReply({ embeds: [embed] }); + } +} + +module.exports = Eightball; diff --git a/src/commands/Fun/cat.js b/src/commands_OLD/Fun/cat.js similarity index 100% rename from src/commands/Fun/cat.js rename to src/commands_OLD/Fun/cat.js diff --git a/src/commands/Fun/dog.js b/src/commands_OLD/Fun/dog.js similarity index 100% rename from src/commands/Fun/dog.js rename to src/commands_OLD/Fun/dog.js diff --git a/src/commands/Fun/lmgtfy.js b/src/commands_OLD/Fun/lmgtfy.js similarity index 100% rename from src/commands/Fun/lmgtfy.js rename to src/commands_OLD/Fun/lmgtfy.js diff --git a/src/commands/Fun/lovecalc.js b/src/commands_OLD/Fun/lovecalc.js similarity index 100% rename from src/commands/Fun/lovecalc.js rename to src/commands_OLD/Fun/lovecalc.js diff --git a/src/commands/Fun/number.js b/src/commands_OLD/Fun/number.js similarity index 100% rename from src/commands/Fun/number.js rename to src/commands_OLD/Fun/number.js diff --git a/src/commands/Fun/tictactoe.js b/src/commands_OLD/Fun/tictactoe.js similarity index 100% rename from src/commands/Fun/tictactoe.js rename to src/commands_OLD/Fun/tictactoe.js diff --git a/src/commands/General/afk.js b/src/commands_OLD/General/afk.js similarity index 100% rename from src/commands/General/afk.js rename to src/commands_OLD/General/afk.js diff --git a/src/commands/General/avatar.c.js b/src/commands_OLD/General/avatar.c.js similarity index 100% rename from src/commands/General/avatar.c.js rename to src/commands_OLD/General/avatar.c.js diff --git a/src/commands/General/avatar.js b/src/commands_OLD/General/avatar.js similarity index 100% rename from src/commands/General/avatar.js rename to src/commands_OLD/General/avatar.js diff --git a/src/commands/General/boosters.js b/src/commands_OLD/General/boosters.js similarity index 100% rename from src/commands/General/boosters.js rename to src/commands_OLD/General/boosters.js diff --git a/src/commands/General/emoji.js b/src/commands_OLD/General/emoji.js similarity index 100% rename from src/commands/General/emoji.js rename to src/commands_OLD/General/emoji.js diff --git a/src/commands/General/help.js b/src/commands_OLD/General/help.js similarity index 100% rename from src/commands/General/help.js rename to src/commands_OLD/General/help.js diff --git a/src/commands/General/info.js b/src/commands_OLD/General/info.js similarity index 100% rename from src/commands/General/info.js rename to src/commands_OLD/General/info.js diff --git a/src/commands/General/minecraft.js b/src/commands_OLD/General/minecraft.js similarity index 100% rename from src/commands/General/minecraft.js rename to src/commands_OLD/General/minecraft.js diff --git a/src/commands/General/ping.js b/src/commands_OLD/General/ping.js similarity index 100% rename from src/commands/General/ping.js rename to src/commands_OLD/General/ping.js diff --git a/src/commands/General/remindme.js b/src/commands_OLD/General/remindme.js similarity index 100% rename from src/commands/General/remindme.js rename to src/commands_OLD/General/remindme.js diff --git a/src/commands/General/reminds.js b/src/commands_OLD/General/reminds.js similarity index 100% rename from src/commands/General/reminds.js rename to src/commands_OLD/General/reminds.js diff --git a/src/commands/General/report.js b/src/commands_OLD/General/report.js similarity index 100% rename from src/commands/General/report.js rename to src/commands_OLD/General/report.js diff --git a/src/commands/General/shorturl.js b/src/commands_OLD/General/shorturl.js similarity index 100% rename from src/commands/General/shorturl.js rename to src/commands_OLD/General/shorturl.js diff --git a/src/commands/General/stats.js b/src/commands_OLD/General/stats.js similarity index 100% rename from src/commands/General/stats.js rename to src/commands_OLD/General/stats.js diff --git a/src/commands/General/suggest.js b/src/commands_OLD/General/suggest.js similarity index 100% rename from src/commands/General/suggest.js rename to src/commands_OLD/General/suggest.js diff --git a/src/commands/General/whois.js b/src/commands_OLD/General/whois.js similarity index 100% rename from src/commands/General/whois.js rename to src/commands_OLD/General/whois.js diff --git a/src/commands/IAT/checkjar.js b/src/commands_OLD/IAT/checkjar.js similarity index 100% rename from src/commands/IAT/checkjar.js rename to src/commands_OLD/IAT/checkjar.js diff --git a/src/commands/Moderation/clear.js b/src/commands_OLD/Moderation/clear.js similarity index 100% rename from src/commands/Moderation/clear.js rename to src/commands_OLD/Moderation/clear.js diff --git a/src/commands/Moderation/clearwarns.js b/src/commands_OLD/Moderation/clearwarns.js similarity index 100% rename from src/commands/Moderation/clearwarns.js rename to src/commands_OLD/Moderation/clearwarns.js diff --git a/src/commands/Moderation/giveaway.js b/src/commands_OLD/Moderation/giveaway.js similarity index 100% rename from src/commands/Moderation/giveaway.js rename to src/commands_OLD/Moderation/giveaway.js diff --git a/src/commands/Moderation/unban.js b/src/commands_OLD/Moderation/unban.js similarity index 100% rename from src/commands/Moderation/unban.js rename to src/commands_OLD/Moderation/unban.js diff --git a/src/commands/Moderation/untimeout.js b/src/commands_OLD/Moderation/untimeout.js similarity index 100% rename from src/commands/Moderation/untimeout.js rename to src/commands_OLD/Moderation/untimeout.js diff --git a/src/commands/Moderation/warn.c.js b/src/commands_OLD/Moderation/warn.c.js similarity index 100% rename from src/commands/Moderation/warn.c.js rename to src/commands_OLD/Moderation/warn.c.js diff --git a/src/commands/Moderation/warns.js b/src/commands_OLD/Moderation/warns.js similarity index 100% rename from src/commands/Moderation/warns.js rename to src/commands_OLD/Moderation/warns.js diff --git a/src/commands/Music/back.js b/src/commands_OLD/Music/back.js similarity index 100% rename from src/commands/Music/back.js rename to src/commands_OLD/Music/back.js diff --git a/src/commands/Music/clips.js b/src/commands_OLD/Music/clips.js similarity index 100% rename from src/commands/Music/clips.js rename to src/commands_OLD/Music/clips.js diff --git a/src/commands/Music/loop.js b/src/commands_OLD/Music/loop.js similarity index 100% rename from src/commands/Music/loop.js rename to src/commands_OLD/Music/loop.js diff --git a/src/commands/Music/nowplaying.js b/src/commands_OLD/Music/nowplaying.js similarity index 100% rename from src/commands/Music/nowplaying.js rename to src/commands_OLD/Music/nowplaying.js diff --git a/src/commands/Music/play.c.js b/src/commands_OLD/Music/play.c.js similarity index 100% rename from src/commands/Music/play.c.js rename to src/commands_OLD/Music/play.c.js diff --git a/src/commands/Music/play.js b/src/commands_OLD/Music/play.js similarity index 100% rename from src/commands/Music/play.js rename to src/commands_OLD/Music/play.js diff --git a/src/commands/Music/queue.js b/src/commands_OLD/Music/queue.js similarity index 100% rename from src/commands/Music/queue.js rename to src/commands_OLD/Music/queue.js diff --git a/src/commands/Music/seek.js b/src/commands_OLD/Music/seek.js similarity index 100% rename from src/commands/Music/seek.js rename to src/commands_OLD/Music/seek.js diff --git a/src/commands/Music/shuffle.js b/src/commands_OLD/Music/shuffle.js similarity index 100% rename from src/commands/Music/shuffle.js rename to src/commands_OLD/Music/shuffle.js diff --git a/src/commands/Music/skip.js b/src/commands_OLD/Music/skip.js similarity index 100% rename from src/commands/Music/skip.js rename to src/commands_OLD/Music/skip.js diff --git a/src/commands/Music/stop.js b/src/commands_OLD/Music/stop.js similarity index 100% rename from src/commands/Music/stop.js rename to src/commands_OLD/Music/stop.js diff --git a/src/commands/Music/volume.js b/src/commands_OLD/Music/volume.js similarity index 100% rename from src/commands/Music/volume.js rename to src/commands_OLD/Music/volume.js diff --git a/src/commands/Owner/debug.js b/src/commands_OLD/Owner/debug.js similarity index 100% rename from src/commands/Owner/debug.js rename to src/commands_OLD/Owner/debug.js diff --git a/src/commands/Owner/eval.js b/src/commands_OLD/Owner/eval.js similarity index 100% rename from src/commands/Owner/eval.js rename to src/commands_OLD/Owner/eval.js diff --git a/src/commands/Owner/reload.js b/src/commands_OLD/Owner/reload.js similarity index 100% rename from src/commands/Owner/reload.js rename to src/commands_OLD/Owner/reload.js diff --git a/src/commands/Owner/say.js b/src/commands_OLD/Owner/say.js similarity index 100% rename from src/commands/Owner/say.js rename to src/commands_OLD/Owner/say.js diff --git a/src/commands/Owner/servers.js b/src/commands_OLD/Owner/servers.js similarity index 100% rename from src/commands/Owner/servers.js rename to src/commands_OLD/Owner/servers.js diff --git a/src/commands/Tickets/adduser.js b/src/commands_OLD/Tickets/adduser.js similarity index 100% rename from src/commands/Tickets/adduser.js rename to src/commands_OLD/Tickets/adduser.js diff --git a/src/commands/Tickets/closeticket.js b/src/commands_OLD/Tickets/closeticket.js similarity index 100% rename from src/commands/Tickets/closeticket.js rename to src/commands_OLD/Tickets/closeticket.js diff --git a/src/commands/Tickets/createticketembed.js b/src/commands_OLD/Tickets/createticketembed.js similarity index 100% rename from src/commands/Tickets/createticketembed.js rename to src/commands_OLD/Tickets/createticketembed.js diff --git a/src/commands/Tickets/removeuser.js b/src/commands_OLD/Tickets/removeuser.js similarity index 100% rename from src/commands/Tickets/removeuser.js rename to src/commands_OLD/Tickets/removeuser.js diff --git a/src/events/Ready.js b/src/events/Ready.js index af7fe3cb..474bc760 100644 --- a/src/events/Ready.js +++ b/src/events/Ready.js @@ -1,64 +1,14 @@ -import { ActivityType } from "discord.js"; -import BaseEvent from "../base/BaseEvent"; +import logger from "../helpers/logger.js"; -class Ready extends BaseEvent { - constructor() { - super({ - name: "ready", - once: false, - }); - } +export const data = { + name: "ready", + once: true, +}; - /** - * - * @param {import("../base/Client")} client - */ - async execute(client) { - const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]; - let servers = client.guilds.cache.size; - let users = 0; - - client.guilds.cache.forEach(g => { - users += g.memberCount; - }); - - const birthdays = require("../helpers/birthdays"); - birthdays.init(client); - - const checkReminds = require("../helpers/checkReminds"); - checkReminds.init(client); - - client.logger.ready(`Loaded a total of ${commands.length} command(s).`); - client.logger.ready(`${client.user.getUsername()}, ready to serve ${users} members in ${servers} servers.`); - console.timeEnd("botReady"); - - const version = require("../package.json").version; - const status = [ - `${commands.length} ${client.functions.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))} available!`, - `I'm in ${servers} ${client.functions.getNoun(servers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}!`, - `Cached ${users} ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}.`, - "Use /help for commands list!", - "Did you know that I have a brother called JaBa IT? Yeah! Ask Jonny about him.", - ]; - - let i = 0; - setInterval(async () => { - servers = (await client.guilds.fetch()).size; - users = 0; - - client.guilds.cache.forEach(g => { - users += g.memberCount; - }); - - client.user.setActivity({ - type: ActivityType.Custom, - name: "custom", - state: `${status[i]} | v${version}`, - }); - - i = (i + 1) % status.length; // Wrap around to the start when reaching the end - }, 30 * 1000); // Every 30 seconds - } +/** + * + * @param {import("../structures/client.js").ExtendedClient} client + */ +export async function run(client) { + logger.ready(client.user.tag + " is online!"); } - -export default Ready; diff --git a/src/events/CommandHandler.js b/src/events_OLD/CommandHandler.js similarity index 100% rename from src/events/CommandHandler.js rename to src/events_OLD/CommandHandler.js diff --git a/src/events/Guild/guildBanAdd.js b/src/events_OLD/Guild/guildBanAdd.js similarity index 100% rename from src/events/Guild/guildBanAdd.js rename to src/events_OLD/Guild/guildBanAdd.js diff --git a/src/events/Guild/guildCreate.js b/src/events_OLD/Guild/guildCreate.js similarity index 100% rename from src/events/Guild/guildCreate.js rename to src/events_OLD/Guild/guildCreate.js diff --git a/src/events/Guild/guildDelete.js b/src/events_OLD/Guild/guildDelete.js similarity index 100% rename from src/events/Guild/guildDelete.js rename to src/events_OLD/Guild/guildDelete.js diff --git a/src/events/Guild/guildMemberAdd.js b/src/events_OLD/Guild/guildMemberAdd.js similarity index 100% rename from src/events/Guild/guildMemberAdd.js rename to src/events_OLD/Guild/guildMemberAdd.js diff --git a/src/events/Guild/guildMemberRemove.js b/src/events_OLD/Guild/guildMemberRemove.js similarity index 100% rename from src/events/Guild/guildMemberRemove.js rename to src/events_OLD/Guild/guildMemberRemove.js diff --git a/src/events/Guild/guildMemberUpdate.js b/src/events_OLD/Guild/guildMemberUpdate.js similarity index 100% rename from src/events/Guild/guildMemberUpdate.js rename to src/events_OLD/Guild/guildMemberUpdate.js diff --git a/src/events/MessageHandler.js b/src/events_OLD/MessageHandler.js similarity index 100% rename from src/events/MessageHandler.js rename to src/events_OLD/MessageHandler.js diff --git a/src/events/Monitoring/messageDelete.js b/src/events_OLD/Monitoring/messageDelete.js similarity index 100% rename from src/events/Monitoring/messageDelete.js rename to src/events_OLD/Monitoring/messageDelete.js diff --git a/src/events/Monitoring/messageUpdate.js b/src/events_OLD/Monitoring/messageUpdate.js similarity index 100% rename from src/events/Monitoring/messageUpdate.js rename to src/events_OLD/Monitoring/messageUpdate.js diff --git a/src/events_OLD/Ready.js b/src/events_OLD/Ready.js new file mode 100644 index 00000000..af7fe3cb --- /dev/null +++ b/src/events_OLD/Ready.js @@ -0,0 +1,64 @@ +import { ActivityType } from "discord.js"; +import BaseEvent from "../base/BaseEvent"; + +class Ready extends BaseEvent { + constructor() { + super({ + name: "ready", + once: false, + }); + } + + /** + * + * @param {import("../base/Client")} client + */ + async execute(client) { + const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]; + let servers = client.guilds.cache.size; + let users = 0; + + client.guilds.cache.forEach(g => { + users += g.memberCount; + }); + + const birthdays = require("../helpers/birthdays"); + birthdays.init(client); + + const checkReminds = require("../helpers/checkReminds"); + checkReminds.init(client); + + client.logger.ready(`Loaded a total of ${commands.length} command(s).`); + client.logger.ready(`${client.user.getUsername()}, ready to serve ${users} members in ${servers} servers.`); + console.timeEnd("botReady"); + + const version = require("../package.json").version; + const status = [ + `${commands.length} ${client.functions.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))} available!`, + `I'm in ${servers} ${client.functions.getNoun(servers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}!`, + `Cached ${users} ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}.`, + "Use /help for commands list!", + "Did you know that I have a brother called JaBa IT? Yeah! Ask Jonny about him.", + ]; + + let i = 0; + setInterval(async () => { + servers = (await client.guilds.fetch()).size; + users = 0; + + client.guilds.cache.forEach(g => { + users += g.memberCount; + }); + + client.user.setActivity({ + type: ActivityType.Custom, + name: "custom", + state: `${status[i]} | v${version}`, + }); + + i = (i + 1) % status.length; // Wrap around to the start when reaching the end + }, 30 * 1000); // Every 30 seconds + } +} + +export default Ready; diff --git a/src/events/TicketsButton.js b/src/events_OLD/TicketsButton.js similarity index 100% rename from src/events/TicketsButton.js rename to src/events_OLD/TicketsButton.js diff --git a/src/newCommands/Fun/8ball.js b/src/newCommands/Fun/8ball.js deleted file mode 100644 index 7600c06c..00000000 --- a/src/newCommands/Fun/8ball.js +++ /dev/null @@ -1,8 +0,0 @@ -export const data = { - name: "8ball", - description: "8ball", -}; - -export const run = () => { - console.log("8ball"); -}; diff --git a/src/newEvents/ready.js b/src/newEvents/ready.js deleted file mode 100644 index 0f698b5d..00000000 --- a/src/newEvents/ready.js +++ /dev/null @@ -1,14 +0,0 @@ -import logger from "../helpers/logger.js"; - -export const data = { - name: "ready", - once: true, -}; - -/** - * - * @param {import("../base/Client.JaBaClient")} client - */ -export async function run(client) { - logger.log(client.user.tag + " is online!"); -} From 5deee996dce9762367b04551dfb7d5864a86aecc Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 12 Dec 2024 21:32:44 +0500 Subject: [PATCH 25/37] refactor: skipped logger in mongooseadapter --- src/adapters/database/MongooseAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/database/MongooseAdapter.js b/src/adapters/database/MongooseAdapter.js index 7bae112e..6f5b6ec8 100644 --- a/src/adapters/database/MongooseAdapter.js +++ b/src/adapters/database/MongooseAdapter.js @@ -27,6 +27,6 @@ export default class MongooseAdapter extends IDatabaseAdapter { async disconnect() { await mongoose.disconnect(); - console.warn("Database disconnected."); + logger.warn("Database disconnected."); } } From 11c1c5640e75d5edd8bd6264940158e93f2b4448 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Fri, 13 Dec 2024 20:09:51 +0300 Subject: [PATCH 26/37] fix(logger): added support many args in every func --- src/helpers/logger.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/helpers/logger.js b/src/helpers/logger.js index b987c48a..5352756e 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -21,27 +21,27 @@ const logLevels = { }; export default { - log(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.LOG} ${content}`); + log(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.LOG} ${content.join(" ")}`); }, - warn(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content}`); + warn(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.WARN} ${content.join(" ")}`); }, - error(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content}`); + error(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.ERROR} ${content.join(" ")}`); }, - debug(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content}`); + debug(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content.join(" ")}`); }, - cmd(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content}`); + cmd(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.CMD} ${content.join(" ")}`); }, - ready(content) { - return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content}`); + ready(...content) { + return console.log(`[${format(Date.now())}]: ${logLevels.READY} ${content.join(" ")}`); }, }; From 136d52a2688a947de2b48d4da4917a6fdf163977 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 14 Dec 2024 14:45:47 +0300 Subject: [PATCH 27/37] style: changed console to logger --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 48d43465..79600f71 100644 --- a/src/index.js +++ b/src/index.js @@ -28,7 +28,7 @@ client.init(); client .on("disconnect", () => logger.warn("Bot disconnected.")) .on("reconnecting", () => logger.warn("Bot reconnecting...")) - .on("warn", console.log) - .on("error", console.log); + .on("warn", logger.log) + .on("error", logger.log); -process.on("unhandledRejection", console.log).on("uncaughtException", console.log); +process.on("unhandledRejection", logger.log).on("uncaughtException", logger.log); From f20c7a555082c21db1b5ab5033deca59992f036b Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 14 Dec 2024 16:38:28 +0300 Subject: [PATCH 28/37] feat: added new func in database adapter --- src/adapters/database/IDatabaseAdapter.js | 16 ++++++++++++++++ src/adapters/database/MongooseAdapter.js | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/adapters/database/IDatabaseAdapter.js b/src/adapters/database/IDatabaseAdapter.js index feee308f..f844d775 100644 --- a/src/adapters/database/IDatabaseAdapter.js +++ b/src/adapters/database/IDatabaseAdapter.js @@ -6,4 +6,20 @@ export default class IDatabaseAdapter { 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 index 6f5b6ec8..56215eba 100644 --- a/src/adapters/database/MongooseAdapter.js +++ b/src/adapters/database/MongooseAdapter.js @@ -29,4 +29,20 @@ export default class MongooseAdapter extends IDatabaseAdapter { 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(); + } } From f3d85c3ec26bf3234bed3c3427800c399bee2a2a Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 14 Dec 2024 18:43:42 +0300 Subject: [PATCH 29/37] feat: added instance support to client class --- src/constants/index.js | 22 ++++++++++++++++++++++ src/handlers/command-handler/index.js | 4 +++- src/handlers/event-handler/index.js | 4 +++- src/index.js | 24 ++++-------------------- src/models/GuildModel.js | 4 +++- src/structures/client.js | 6 ++++++ src/utils/create-embed.js | 7 ++++--- src/utils/use-client.js | 16 ++++++++++++++++ 8 files changed, 61 insertions(+), 26 deletions(-) create mode 100644 src/utils/use-client.js diff --git a/src/constants/index.js b/src/constants/index.js index fdcb5a1b..9aaae42a 100644 --- a/src/constants/index.js +++ b/src/constants/index.js @@ -1,4 +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/handlers/command-handler/index.js b/src/handlers/command-handler/index.js index 6afbb311..53b6271f 100644 --- a/src/handlers/command-handler/index.js +++ b/src/handlers/command-handler/index.js @@ -1,6 +1,6 @@ import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; -import { client } from "../../index.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"; @@ -8,6 +8,7 @@ import registerCommands from "./functions/registerCommands.js"; export const commands = []; export const init = async () => { + const client = useClient(); await buildCommands(); await registerCommands({ @@ -17,6 +18,7 @@ export const init = async () => { }; 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")); diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index a057b156..c63d2dc7 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -1,6 +1,6 @@ import { resolve } from "node:path"; import logger from "../../helpers/logger.js"; -import { client } from "../../index.js"; +import useClient from "../../utils/use-client.js"; import { getFilePaths } from "../../utils/index.js"; import { toFileURL } from "../../utils/resolve-file.js"; @@ -12,6 +12,7 @@ export const init = async () => { }; 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")); @@ -37,6 +38,7 @@ const buildEvents = async () => { }; const registerEvents = async () => { + const client = useClient(); for (const { data, run } of events) { if (data.once) client.once(data.name, run); else client.on(data.name, run); diff --git a/src/index.js b/src/index.js index 79600f71..70f4de55 100644 --- a/src/index.js +++ b/src/index.js @@ -1,26 +1,10 @@ -import { GatewayIntentBits } from "discord.js"; import { ExtendedClient } from "./structures/client.js"; import logger from "./helpers/logger.js"; +import { CLIENT_INTENTS, CLIENT_ALLOWED_MENTIONS } from "./constants/index.js"; -export const client = new ExtendedClient({ - intents: [ - GatewayIntentBits.Guilds, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.GuildModeration, - GatewayIntentBits.GuildEmojisAndStickers, - GatewayIntentBits.GuildIntegrations, - GatewayIntentBits.GuildInvites, - GatewayIntentBits.GuildVoiceStates, - GatewayIntentBits.GuildPresences, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.GuildMessageReactions, - GatewayIntentBits.GuildMessageTyping, - GatewayIntentBits.MessageContent, - GatewayIntentBits.DirectMessageTyping, - GatewayIntentBits.DirectMessages, - GatewayIntentBits.DirectMessageReactions, - ], - allowedMentions: { parse: ["everyone", "roles", "users"] }, +const client = new ExtendedClient({ + intents: CLIENT_INTENTS, + allowedMentions: CLIENT_ALLOWED_MENTIONS, }); client.init(); diff --git a/src/models/GuildModel.js b/src/models/GuildModel.js index da3b57f2..d52c2a54 100644 --- a/src/models/GuildModel.js +++ b/src/models/GuildModel.js @@ -1,5 +1,7 @@ import { model, Schema } from "mongoose"; -import { client } from "../index.js"; +import useClient from "../utils/use-client.js"; + +const client = useClient(); export default model( "Guild", diff --git a/src/structures/client.js b/src/structures/client.js index c55a5ac3..a25c9f47 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -5,17 +5,23 @@ 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); + + SUPER_CONTEXT.enterWith(this); } async init() { diff --git a/src/utils/create-embed.js b/src/utils/create-embed.js index dbf1c281..27199569 100644 --- a/src/utils/create-embed.js +++ b/src/utils/create-embed.js @@ -1,14 +1,15 @@ import { EmbedBuilder } from "discord.js"; -import { client } from "../index.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 => +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/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; +} From a3c7d1fef64a3abbdf8316ea57af7ce4a30af735 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 14 Dec 2024 18:44:26 +0300 Subject: [PATCH 30/37] feat: added support discord player with events --- src/handlers/event-handler/index.js | 3 +++ src/structures/client.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index c63d2dc7..0144bbba 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -3,6 +3,7 @@ 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 = []; @@ -39,7 +40,9 @@ const buildEvents = async () => { 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/src/structures/client.js b/src/structures/client.js index a25c9f47..b875e1d7 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -1,4 +1,5 @@ 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"; @@ -20,6 +21,7 @@ export class ExtendedClient extends Client { this.configService = new ConfigService(); this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); this.i18n = new InternationalizationService(this); + new Player(this); SUPER_CONTEXT.enterWith(this); } From b26222a94758dda345476725db4958419206d4b5 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 16 Dec 2024 16:31:22 +0300 Subject: [PATCH 31/37] refactor: delete unusable helper --- src/helpers/languages.js | 51 ---------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/helpers/languages.js diff --git a/src/helpers/languages.js b/src/helpers/languages.js deleted file mode 100644 index 742c648e..00000000 --- a/src/helpers/languages.js +++ /dev/null @@ -1,51 +0,0 @@ -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(join(dir, file)); - if (stat.isDirectory()) { - const isLanguage = file.includes("-"); - if (isLanguage) languages.push(file); - - const folder = await walkDirectory(join(dir, file), namespaces, isLanguage ? "" : `${file}/`); - - namespaces = folder.namespaces; - } else { - namespaces.push(`${folderName}${file.substr(0, file.length - 5)}`); - } - } - - return { - namespaces: [...new Set(namespaces)], - languages, - }; -} - -export default async () => { - const options = { - loadPath: resolve(__dirname, "../languages/{{lng}}/{{ns}}.json"), - }; - - const { namespaces, languages } = await walkDirectory(resolve(__dirname, "../languages/")); - - use(Backend); - - await init({ - backend: options, - debug: false, - fallbackLng: "en-US", - initImmediate: false, - interpolation: { escapeValue: false }, - load: "all", - ns: namespaces, - preload: languages, - }); - - return new Map(languages.map(item => [item, getFixedT(item)])); -}; From ac461a104d68aa8d9cca996cb8d625cf8bf507a6 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 16 Dec 2024 17:41:11 +0300 Subject: [PATCH 32/37] feat: added cache adapter --- src/adapters/cache/ICacheAdapter.js | 9 +++++++++ src/adapters/cache/MapCache.js | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/adapters/cache/ICacheAdapter.js create mode 100644 src/adapters/cache/MapCache.js diff --git a/src/adapters/cache/ICacheAdapter.js b/src/adapters/cache/ICacheAdapter.js new file mode 100644 index 00000000..e4c49adc --- /dev/null +++ b/src/adapters/cache/ICacheAdapter.js @@ -0,0 +1,9 @@ +export default class ICacheAdapter { + get() {} + + set() {} + + clear() {} + + delete() {} +} diff --git a/src/adapters/cache/MapCache.js b/src/adapters/cache/MapCache.js new file mode 100644 index 00000000..63e57426 --- /dev/null +++ b/src/adapters/cache/MapCache.js @@ -0,0 +1,24 @@ +import ICacheAdapter from "./ICacheAdapter"; + +export default class MapCache extends ICacheAdapter { + constructor() { + super(); + this.store = new Map(); + } + + get(key) { + return this.store.get(key); + } + + set(key, value) { + this.store.set(key, value); + } + + clear() { + this.store.clear(); + } + + delete(key) { + this.store.delete(key); + } +} From c7ebdb78d444fe3752cbc93f9d20759525d235de Mon Sep 17 00:00:00 2001 From: Slincnik Date: Mon, 16 Dec 2024 17:41:39 +0300 Subject: [PATCH 33/37] feat(database): add cache to mongoose adapter --- src/adapters/database/MongooseAdapter.js | 34 ++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/adapters/database/MongooseAdapter.js b/src/adapters/database/MongooseAdapter.js index 56215eba..aa71f59c 100644 --- a/src/adapters/database/MongooseAdapter.js +++ b/src/adapters/database/MongooseAdapter.js @@ -1,6 +1,7 @@ import mongoose from "mongoose"; import IDatabaseAdapter from "./IDatabaseAdapter.js"; import logger from "../../helpers/logger.js"; +import Cache from "../cache/MapCache.js"; export default class MongooseAdapter extends IDatabaseAdapter { /** @@ -16,8 +17,8 @@ export default class MongooseAdapter extends IDatabaseAdapter { } this.uri = uri; - this.options = options; + this.cache = new Cache(); } async connect() { @@ -28,21 +29,44 @@ export default class MongooseAdapter extends IDatabaseAdapter { async disconnect() { await mongoose.disconnect(); logger.warn("Database disconnected."); + this.cache.clear(); + } + + #generateCacheKey(modelName, query, options) { + return `${modelName}:${JSON.stringify(query)}:${JSON.stringify(options)}`; } async find(model, query = {}, options = {}) { - return model.find(query, null, options).exec(); + const cacheKey = this.#generateCacheKey(model.modelName, query, options); + if (this.cache.get(cacheKey)) { + return this.cache.get(cacheKey); + } + + const result = await model.find(query, null, options).exec(); + this.cache.set(cacheKey, result); + return result; } async findOne(model, query = {}, options = {}) { - return model.findOne(query, null, options).exec(); + const cacheKey = this.#generateCacheKey(model.modelName, query, options); + if (this.cache.get(cacheKey)) { + return this.cache.get(cacheKey); + } + + const result = await model.findOne(query, null, options).exec(); + this.cache.set(cacheKey, result); + return result; } async updateOne(model, filter, update, options = {}) { - return model.updateOne(filter, update, options).exec(); + const result = await model.updateOne(filter, update, options).exec(); + this.cache.clear(); + return result; } async deleteOne(model, filter) { - return model.deleteOne(filter).exec(); + const result = await model.deleteOne(filter).exec(); + this.cache.clear(); + return result; } } From c2d1c856966dee5701f811e7d11e0ad905e236d0 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Sat, 21 Dec 2024 10:24:25 +0300 Subject: [PATCH 34/37] fix: fixing error when import module --- src/adapters/cache/MapCache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adapters/cache/MapCache.js b/src/adapters/cache/MapCache.js index 63e57426..073af887 100644 --- a/src/adapters/cache/MapCache.js +++ b/src/adapters/cache/MapCache.js @@ -1,4 +1,4 @@ -import ICacheAdapter from "./ICacheAdapter"; +import ICacheAdapter from "./ICacheAdapter.js"; export default class MapCache extends ICacheAdapter { constructor() { From 823aea886f372206beefdfd50b2dcc6e7cc1c898 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 25 Dec 2024 19:11:49 +0300 Subject: [PATCH 35/37] feat: added data from database --- src/structures/client.js | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/structures/client.js b/src/structures/client.js index b875e1d7..b421ff3c 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -7,6 +7,9 @@ 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"; +import GuildModel from "../models/GuildModel.js"; +import UserModel from "../models/UserModel.js"; +import MemberModel from "../models/MemberModel.js"; export class ExtendedClient extends Client { /** @@ -21,6 +24,7 @@ export class ExtendedClient extends Client { this.configService = new ConfigService(); this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); this.i18n = new InternationalizationService(this); + this.cacheReminds = new Map(); new Player(this); SUPER_CONTEXT.enterWith(this); @@ -37,4 +41,60 @@ export class ExtendedClient extends Client { logger.error(error); } } + + /** + * Retrieves a guild data object 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. + */ + async getGuildData(guildId) { + let guildData = await this.adapter.findOne(GuildModel, { id: guildId }); + + if (!guildData) { + guildData = new GuildModel({ id: guildId }); + await guildData.save(); + } + + return guildData; + } + + /** + * 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. + */ + async getUserData(userID) { + let userData = await this.adapter.findOne(UserModel, { id: userID }); + + if (!userData) { + userData = new UserModel({ id: userID }); + await userData.save(); + } + + return userData; + } + + /** + * 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. + */ + async getMemberData(memberId, guildId) { + let memberData = await this.adapter.findOne(MemberModel, { guildID: guildId, id: memberId }); + + if (!memberData) { + memberData = new MemberModel({ id: memberId, guildID: guildId }); + await memberData.save(); + + const guildData = await this.getGuildData(guildId); + + if (guildData) { + guildData.members.push(memberData._id); + await guildData.save(); + } + } + + return memberData; + } } From b45f3dcc359833ab277faf0d971070c6984045f7 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Wed, 25 Dec 2024 19:13:34 +0300 Subject: [PATCH 36/37] feat: rewritten two helpers, birthdays and checkreminds --- src/helpers/birthdays.js | 102 ++++++++++++++++++------------------ src/helpers/checkReminds.js | 91 +++++++++++++++----------------- 2 files changed, 94 insertions(+), 99 deletions(-) diff --git a/src/helpers/birthdays.js b/src/helpers/birthdays.js index 7334e6fb..749d3c04 100644 --- a/src/helpers/birthdays.js +++ b/src/helpers/birthdays.js @@ -1,69 +1,71 @@ import { CronJob } from "cron"; +import useClient from "../utils/use-client.js"; +import UserModel from "../models/UserModel.js"; +import { createEmbed } from "../utils/create-embed.js"; +import logger from "./logger.js"; +import { getNoun } from "./functions.js"; -/** - * - * @param {import("../base/Client")} client - */ -async function checkBirthdays(client) { - for (const guild of client.guilds.cache.values()) { +const checkBirthdays = async () => { + const client = useClient(); + + const guilds = client.guilds.cache.values(); + const users = await client.adapter.find(UserModel, { birthdate: { $gt: 1 } }); + + const currentData = new Date(); + const currentYear = currentData.getFullYear(); + const currentMonth = currentData.getMonth(); + const currentDate = currentData.getDate(); + + for (const guild of guilds) { try { - const guildData = await client.getGuildData(guild.id); - const channel = guildData.plugins.birthdays ? await client.channels.fetch(guildData.plugins.birthdays) : null; + const data = await client.getGuildData(guild.id); + const channel = data.plugins.birthdays ? await client.channels.fetch(data.plugins.birthdays) : null; - if (channel) { - const date = new Date(); - const currentDay = date.getDate(); - const currentMonth = date.getMonth() + 1; - const currentYear = date.getFullYear(); + if (!channel) return; - const users = await client.usersData.find({ birthdate: { $gt: 1 } }); + const userIDs = users.filter(u => guild.members.cache.has(u.id)).map(u => u.id); - for (const user of users) { - if (!guild.members.cache.has(user.id)) continue; + await Promise.all( + userIDs.map(async userID => { + const user = users.find(u => u.id === userID); + const userData = new Date(user.birthdate).getFullYear() <= 1970 ? new Date(user.birthdate * 1000) : new Date(user.birthdate); + const userYear = userData.getFullYear(); + const userMonth = userData.getMonth(); + const userDate = userData.getDate(); - const userDate = new Date(user.birthdate).getFullYear() <= 1970 ? new Date(user.birthdate * 1000) : new Date(user.birthdate); - const day = userDate.getDate(); - const month = userDate.getMonth() + 1; - const year = userDate.getFullYear(); - const age = currentYear - year; + const age = currentYear - userYear; - if (currentMonth === month && currentDay === day) { - const embed = client.embed({ - author: client.user.getUsername(), + if (userDate === currentDate && userMonth === currentMonth) { + const embed = createEmbed({ + author: client.user.username, fields: [ { - name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language), - value: client.translate( - "economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", - { - user: user.id, - age: `**${age}** ${client.functions.getNoun( - age, - client.translate("misc:NOUNS:AGE:1", null, guildData.language), - client.translate("misc:NOUNS:AGE:2", null, guildData.language), - client.translate("misc:NOUNS:AGE:5", null, guildData.language), - )}`, - }, - guildData.language, - ), + name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", { + lng: data.language, + }), + value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { + lng: data.language, + user: user.id, + age: `**${age}** ${getNoun(age, [ + client.translate("misc:NOUNS:AGE:1", null, data.language), + client.translate("misc:NOUNS:AGE:2", null, data.language), + client.translate("misc:NOUNS:AGE:5", null, data.language), + ])}`, + }), }, ], }); - await channel.send({ embeds: [embed] }).then(m => m.react("🎉")); + await channel.send({ embeds: [embed] }).then(m => m.react(" ")); } - } - } - } catch (e) { - if (e.code === 10003) console.log(`No channel found for ${guild.name}`); - else console.error(`Error processing birthdays for guild "${guild.name}":`, e); + }), + ); + } catch (error) { + logger.error(error); } } -} +}; -export async function init(client) { - new CronJob("0 5 * * *", checkBirthdays(client), null, true, "Europe/Moscow"); -} -export async function run(client) { - await checkBirthdays(client); +export async function init() { + new CronJob("0 5 * * *", checkBirthdays(), null, true, "Europe/Moscow"); } diff --git a/src/helpers/checkReminds.js b/src/helpers/checkReminds.js index 7c271c9c..71503aeb 100644 --- a/src/helpers/checkReminds.js +++ b/src/helpers/checkReminds.js @@ -1,66 +1,59 @@ -/** - * - * @param {import("../base/Client")} client - */ -async function checkReminds(client) { - client.usersData.find({ reminds: { $gt: [] } }).then(users => { +import UserModel from "../models/UserModel"; +import useClient from "../utils/use-client"; + +const checkReminds = async () => { + const client = useClient(); + + client.adapter.find(UserModel, { reminds: { $gt: [] } }).then(users => { for (const user of users) { if (!client.users.cache.has(user.id)) client.users.fetch(user.id); - client.databaseCache.usersReminds.set(user.id, user); + client.cacheReminds.set(user.id, user); } }); - client.databaseCache.usersReminds.forEach(async user => { + client.cacheReminds.forEach(async user => { const cachedUser = client.users.cache.get(user.id); - if (cachedUser) { - const dateNow = Math.floor(Date.now() / 1000), - reminds = user.reminds, - mustSent = reminds.filter(r => r.sendAt < dateNow); + if (!cachedUser) return; - if (mustSent.length > 0) { - mustSent.forEach(r => { - const embed = client.embed({ - author: client.translate("general/remindme:EMBED_TITLE"), - fields: [ - { - name: client.translate("general/remindme:EMBED_CREATED"), - value: ``, - inline: true, - }, - { - name: client.translate("general/remindme:EMBED_TIME"), - value: ``, - inline: true, - }, - { - name: client.translate("common:MESSAGE"), - value: r.message, - }, - ], - }); + const reminds = user.reminds, + mustSent = reminds.filter(r => r.sendAt < Math.floor(Date.now() / 1000)); - cachedUser.send({ - embeds: [embed], - }); - }); + if (!mustSent.length) return; - user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); + mustSent.forEach(r => { + const embed = client.embed({ + author: client.translate("general/remindme:EMBED_TITLE"), + fields: [ + { + name: client.translate("general/remindme:EMBED_CREATED"), + value: ``, + inline: true, + }, + { + name: client.translate("general/remindme:EMBED_TIME"), + value: ``, + inline: true, + }, + { + name: client.translate("common:MESSAGE"), + value: r.message, + }, + ], + }); - await user.save(); + cachedUser.send({ embeds: [embed] }).then(() => { + client.adapter.updateOne(UserModel, { id: user.id }, { $pull: { reminds: { _id: r._id } } }); + }); + }); - if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id); - } - } + if (!user.reminds.length) client.cacheReminds.delete(user.id); }); -} +}; -export async function init(client) { +export const init = async () => { setInterval(async () => { - await checkReminds(client); + await checkReminds(); }, 1000); -} -export async function run(client) { - await checkReminds(client); -} +}; \ No newline at end of file From cf832a0e4a44891248252020cbabbc84699b4ea8 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Thu, 26 Dec 2024 16:35:00 +0300 Subject: [PATCH 37/37] fix: fixing not initialized client in models --- src/structures/client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/client.js b/src/structures/client.js index b421ff3c..c1281c20 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -7,9 +7,6 @@ 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"; -import GuildModel from "../models/GuildModel.js"; -import UserModel from "../models/UserModel.js"; -import MemberModel from "../models/MemberModel.js"; export class ExtendedClient extends Client { /** @@ -48,6 +45,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The guild data object, either retrieved from the database or newly created. */ async getGuildData(guildId) { + const { default: GuildModel } = await import("../models/GuildModel.js"); let guildData = await this.adapter.findOne(GuildModel, { id: guildId }); if (!guildData) { @@ -64,6 +62,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The user data object, either retrieved from the database or newly created. */ async getUserData(userID) { + const { default: UserModel } = await import("../models/GuildModel.js"); let userData = await this.adapter.findOne(UserModel, { id: userID }); if (!userData) { @@ -81,6 +80,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The member data object, either retrieved from the database or newly created. */ async getMemberData(memberId, guildId) { + const { default: MemberModel } = await import("../models/GuildModel.js"); let memberData = await this.adapter.findOne(MemberModel, { guildID: guildId, id: memberId }); if (!memberData) {