diff --git a/.swcrc b/.swcrc index cb381d98..6a5142f8 100644 --- a/.swcrc +++ b/.swcrc @@ -10,32 +10,32 @@ "baseUrl": "./", "paths": { - "@decorators": ["src/core/utils/decorators"], - "@decorators/*": ["src/plugins/*/core/utils/decorators"], + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], - "@errors": ["src/core/utils/errors"], - "@errors/*": ["src/plugins/*/core/utils/errors"], + "@errors": ["src/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], - "@entities": ["src/core/entities"], - "@entities/*": ["src/plugins/*/core/entities"], + "@entities": ["src/entities"], + "@entities/*": ["src/plugins/*/entities"], - "@guards": ["src/core/guards"], - "@guards/*": ["src/plugins/*/core/guards"], + "@guards": ["src/guards"], + "@guards/*": ["src/plugins/*/guards"], - "@services": ["src/core/services"], - "@services/*": ["src/plugins/*/core/services"], + "@services": ["src/services"], + "@services/*": ["src/plugins/*/services"], - "@i18n": ["src/core/i18n"], - "@i18n/*": ["src/plugins/*/core/i18n"], + "@i18n": ["src/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], "@configs": ["src/configs"], "@configs/*": ["src/plugins/*/configs"], - "@utils/classes": ["src/core/utils/classes"], - "@utils/classes/*": ["src/plugins/*/core/utils/classes"], + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], - "@utils/functions": ["src/core/utils/functions"], - "@utils/functions/*": ["src/plugins/*/core/utils/functions"], + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], "@api/controllers": ["src/api/controllers"], "@api/controllers/*": ["src/plugins/*/api/controllers"], diff --git a/src/commands/General/help.ts b/src/commands/General/help.ts index ecad8bf0..cd637a58 100644 --- a/src/commands/General/help.ts +++ b/src/commands/General/help.ts @@ -1,10 +1,10 @@ import { Category } from "@discordx/utilities" -import { ActionRowBuilder, APISelectMenuOption, CommandInteraction, EmbedBuilder, StringSelectMenuBuilder, StringSelectMenuInteraction } from "discord.js" +import { ActionRowBuilder, APISelectMenuOption, CommandInteraction, EmbedBuilder, inlineCode, StringSelectMenuBuilder, StringSelectMenuInteraction } from "discord.js" import { Client, MetadataStorage, SelectMenuComponent } from "discordx" import { Discord, Slash } from "@decorators" import { chunkArray, getColor, resolveGuild, validString } from "@utils/functions" -import { TranslationFunctions } from "src/core/i18n/i18n-types" +import { TranslationFunctions } from "src/i18n/i18n-types" @Discord() @Category('General') diff --git a/src/core/i18n/en/index.ts b/src/core/i18n/en/index.ts deleted file mode 100644 index 4e738bd0..00000000 --- a/src/core/i18n/en/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable */ -import type { BaseTranslation } from '../i18n-types' - -const en = { - GUARDS: { - DISABLED_COMMAND: 'This command is currently disabled.', - MAINTENANCE: 'This bot is currently in maintenance mode.', - GUILD_ONLY: 'This command can only be used in a server.', - NSFW: 'This command can only be used in a NSFW channel.', - }, - ERRORS: { - UNKNOWN: 'An unknown error occurred.', - }, - SHARED: { - NO_COMMAND_DESCRIPTION: 'No description provided.', - }, - COMMANDS: { - INVITE: { - DESCRIPTION: 'Invite the bot to your server!', - EMBED: { - TITLE: 'Invite me on your server!', - DESCRIPTION: '[Click here]({link}) to invite me!', - }, - }, - PREFIX: { - NAME: 'prefix', - DESCRIPTION: 'Change the prefix of the bot.', - OPTIONS: { - PREFIX: { - NAME: 'new_prefix', - DESCRIPTION: 'The new prefix of the bot.', - }, - }, - EMBED: { - DESCRIPTION: 'Prefix changed to `{prefix:string}`.', - }, - }, - MAINTENANCE: { - DESCRIPTION: 'Set the maintenance mode of the bot.', - EMBED: { - DESCRIPTION: 'Maintenance mode set to `{state:string}`.', - }, - }, - STATS: { - DESCRIPTION: 'Get some stats about the bot.', - HEADERS: { - COMMANDS: 'Commands', - GUILDS: 'Guild', - ACTIVE_USERS: 'Active Users', - USERS: 'Users', - }, - }, - HELP: { - DESCRIPTION: 'Get global help about the bot and its commands', - EMBED: { - TITLE: 'Help panel', - CATEGORY_TITLE: '{category:string} Commands', - }, - SELECT_MENU: { - TITLE: 'Select a category', - CATEGORY_DESCRIPTION: '{category:string} commands', - }, - }, - PING: { - DESCRIPTION: 'Pong!', - MESSAGE: '{member:string} Pong! The message round-trip took {time:number}ms.{heartbeat:string}', - }, - }, -} satisfies BaseTranslation - -export default en diff --git a/src/core/i18n/formatters.ts b/src/core/i18n/formatters.ts deleted file mode 100644 index 56801f8c..00000000 --- a/src/core/i18n/formatters.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { FormattersInitializer } from "typesafe-i18n" -import type { Locales, Formatters } from "./i18n-types" - -export const initFormatters: FormattersInitializer = (locale: Locales) => { - - const formatters: Formatters = { - // add your formatter functions here - } - - return formatters -} diff --git a/src/core/i18n/fr/index.ts b/src/core/i18n/fr/index.ts deleted file mode 100644 index 5fc9238a..00000000 --- a/src/core/i18n/fr/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable */ -import type { Translation } from '../i18n-types' - -const fr = { - GUARDS: { - DISABLED_COMMAND: 'Cette commande est désactivée.', - MAINTENANCE: 'Ce bot est en mode maintenance.', - GUILD_ONLY: "Cette commande ne peut être utilisée qu'en serveur.", - NSFW: 'Cette commande ne peut être utilisée que dans un salon NSFW.', - }, - ERRORS: { - UNKNOWN: 'Une erreur est survenue.', - }, - SHARED: { - NO_COMMAND_DESCRIPTION: 'Aucune description fournie.', - }, - COMMANDS: { - INVITE: { - DESCRIPTION: 'Invitez le bot sur votre serveur!', - EMBED: { - TITLE: 'Invite moi sur ton serveur!', - DESCRIPTION: "[Clique ici]({link}) pour m'inviter!", - }, - }, - PREFIX: { - NAME: 'prefixe', - DESCRIPTION: 'Change le préfix du bot.', - OPTIONS: { - PREFIX: { - NAME: 'nouveau_prefix', - DESCRIPTION: 'Le nouveau préfix du bot.', - }, - }, - EMBED: { - DESCRIPTION: 'Prefix changé en `{prefix}`.', - }, - }, - MAINTENANCE: { - DESCRIPTION: 'Met le mode maintenance du bot.', - EMBED: { - DESCRIPTION: 'Le mode maintenance a été définie à `{state}`.', - }, - }, - STATS: { - DESCRIPTION: 'Obtiens des statistiques sur le bot.', - HEADERS: { - COMMANDS: 'Commandes', - GUILDS: 'Serveurs', - ACTIVE_USERS: 'Utilisateurs actifs', - USERS: 'Utilisateurs', - }, - }, - HELP: { - DESCRIPTION: "Obtenez de l'aide globale sur le bot et ses commandes", - EMBED: { - TITLE: "Pannel d'aide", - CATEGORY_TITLE: 'Commandes de {category}', - }, - SELECT_MENU: { - TITLE: 'Sélectionnez une catégorie', - CATEGORY_DESCRIPTION: 'Commandes de {category}', - }, - }, - PING: { - DESCRIPTION: 'Pong!', - MESSAGE: '{member} Pong! Le temps de réponse de la réponse était {time}ms.{heartbeat}', - }, - }, -} satisfies Translation - -export default fr diff --git a/src/core/i18n/i18n-node.ts b/src/core/i18n/i18n-node.ts deleted file mode 100644 index 04479125..00000000 --- a/src/core/i18n/i18n-node.ts +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. -/* eslint-disable */ - -import { i18n } from './i18n-util' -import { loadAllLocales } from './i18n-util.sync' -import type { LocaleTranslationFunctions } from 'typesafe-i18n' -import type { Locales, Translations, TranslationFunctions } from './i18n-types' - -loadAllLocales() - -export const L: LocaleTranslationFunctions = i18n() - -export default L diff --git a/src/core/i18n/i18n-types.ts b/src/core/i18n/i18n-types.ts deleted file mode 100644 index c83de323..00000000 --- a/src/core/i18n/i18n-types.ts +++ /dev/null @@ -1,328 +0,0 @@ -// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. -/* eslint-disable */ -import type { BaseTranslation as BaseTranslationType, LocalizedString, RequiredParams } from 'typesafe-i18n' - -export type BaseTranslation = BaseTranslationType -export type BaseLocale = 'en' - -export type Locales = - | 'en' - | 'fr' - | 'ru' - | 'uk' - -export type Translation = RootTranslation - -export type Translations = RootTranslation - -type RootTranslation = { - GUARDS: { - /** - * T​h​i​s​ ​c​o​m​m​a​n​d​ ​i​s​ ​c​u​r​r​e​n​t​l​y​ ​d​i​s​a​b​l​e​d​. - */ - DISABLED_COMMAND: string - /** - * T​h​i​s​ ​b​o​t​ ​i​s​ ​c​u​r​r​e​n​t​l​y​ ​i​n​ ​m​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​. - */ - MAINTENANCE: string - /** - * T​h​i​s​ ​c​o​m​m​a​n​d​ ​c​a​n​ ​o​n​l​y​ ​b​e​ ​u​s​e​d​ ​i​n​ ​a​ ​s​e​r​v​e​r​. - */ - GUILD_ONLY: string - /** - * T​h​i​s​ ​c​o​m​m​a​n​d​ ​c​a​n​ ​o​n​l​y​ ​b​e​ ​u​s​e​d​ ​i​n​ ​a​ ​N​S​F​W​ ​c​h​a​n​n​e​l​. - */ - NSFW: string - } - ERRORS: { - /** - * A​n​ ​u​n​k​n​o​w​n​ ​e​r​r​o​r​ ​o​c​c​u​r​r​e​d​. - */ - UNKNOWN: string - } - SHARED: { - /** - * N​o​ ​d​e​s​c​r​i​p​t​i​o​n​ ​p​r​o​v​i​d​e​d​. - */ - NO_COMMAND_DESCRIPTION: string - } - COMMANDS: { - INVITE: { - /** - * I​n​v​i​t​e​ ​t​h​e​ ​b​o​t​ ​t​o​ ​y​o​u​r​ ​s​e​r​v​e​r​! - */ - DESCRIPTION: string - EMBED: { - /** - * I​n​v​i​t​e​ ​m​e​ ​o​n​ ​y​o​u​r​ ​s​e​r​v​e​r​! - */ - TITLE: string - /** - * [​C​l​i​c​k​ ​h​e​r​e​]​(​{​l​i​n​k​}​)​ ​t​o​ ​i​n​v​i​t​e​ ​m​e​! - * @param {unknown} link - */ - DESCRIPTION: RequiredParams<'link'> - } - } - PREFIX: { - /** - * p​r​e​f​i​x - */ - NAME: string - /** - * C​h​a​n​g​e​ ​t​h​e​ ​p​r​e​f​i​x​ ​o​f​ ​t​h​e​ ​b​o​t​. - */ - DESCRIPTION: string - OPTIONS: { - PREFIX: { - /** - * n​e​w​_​p​r​e​f​i​x - */ - NAME: string - /** - * T​h​e​ ​n​e​w​ ​p​r​e​f​i​x​ ​o​f​ ​t​h​e​ ​b​o​t​. - */ - DESCRIPTION: string - } - } - EMBED: { - /** - * P​r​e​f​i​x​ ​c​h​a​n​g​e​d​ ​t​o​ ​`​{​p​r​e​f​i​x​}​`​. - * @param {string} prefix - */ - DESCRIPTION: RequiredParams<'prefix'> - } - } - MAINTENANCE: { - /** - * S​e​t​ ​t​h​e​ ​m​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​ ​o​f​ ​t​h​e​ ​b​o​t​. - */ - DESCRIPTION: string - EMBED: { - /** - * M​a​i​n​t​e​n​a​n​c​e​ ​m​o​d​e​ ​s​e​t​ ​t​o​ ​`​{​s​t​a​t​e​}​`​. - * @param {string} state - */ - DESCRIPTION: RequiredParams<'state'> - } - } - STATS: { - /** - * G​e​t​ ​s​o​m​e​ ​s​t​a​t​s​ ​a​b​o​u​t​ ​t​h​e​ ​b​o​t​. - */ - DESCRIPTION: string - HEADERS: { - /** - * C​o​m​m​a​n​d​s - */ - COMMANDS: string - /** - * G​u​i​l​d - */ - GUILDS: string - /** - * A​c​t​i​v​e​ ​U​s​e​r​s - */ - ACTIVE_USERS: string - /** - * U​s​e​r​s - */ - USERS: string - } - } - HELP: { - /** - * G​e​t​ ​g​l​o​b​a​l​ ​h​e​l​p​ ​a​b​o​u​t​ ​t​h​e​ ​b​o​t​ ​a​n​d​ ​i​t​s​ ​c​o​m​m​a​n​d​s - */ - DESCRIPTION: string - EMBED: { - /** - * H​e​l​p​ ​p​a​n​e​l - */ - TITLE: string - /** - * {​c​a​t​e​g​o​r​y​}​ ​C​o​m​m​a​n​d​s - * @param {string} category - */ - CATEGORY_TITLE: RequiredParams<'category'> - } - SELECT_MENU: { - /** - * S​e​l​e​c​t​ ​a​ ​c​a​t​e​g​o​r​y - */ - TITLE: string - /** - * {​c​a​t​e​g​o​r​y​}​ ​c​o​m​m​a​n​d​s - * @param {string} category - */ - CATEGORY_DESCRIPTION: RequiredParams<'category'> - } - } - PING: { - /** - * P​o​n​g​! - */ - DESCRIPTION: string - /** - * {​m​e​m​b​e​r​}​ ​P​o​n​g​!​ ​T​h​e​ ​m​e​s​s​a​g​e​ ​r​o​u​n​d​-​t​r​i​p​ ​t​o​o​k​ ​{​t​i​m​e​}​m​s​.​{​h​e​a​r​t​b​e​a​t​} - * @param {string} heartbeat - * @param {string} member - * @param {number} time - */ - MESSAGE: RequiredParams<'heartbeat' | 'member' | 'time'> - } - } -} - -export type TranslationFunctions = { - GUARDS: { - /** - * This command is currently disabled. - */ - DISABLED_COMMAND: () => LocalizedString - /** - * This bot is currently in maintenance mode. - */ - MAINTENANCE: () => LocalizedString - /** - * This command can only be used in a server. - */ - GUILD_ONLY: () => LocalizedString - /** - * This command can only be used in a NSFW channel. - */ - NSFW: () => LocalizedString - } - ERRORS: { - /** - * An unknown error occurred. - */ - UNKNOWN: () => LocalizedString - } - SHARED: { - /** - * No description provided. - */ - NO_COMMAND_DESCRIPTION: () => LocalizedString - } - COMMANDS: { - INVITE: { - /** - * Invite the bot to your server! - */ - DESCRIPTION: () => LocalizedString - EMBED: { - /** - * Invite me on your server! - */ - TITLE: () => LocalizedString - /** - * [Click here]({link}) to invite me! - */ - DESCRIPTION: (arg: { link: unknown }) => LocalizedString - } - } - PREFIX: { - /** - * prefix - */ - NAME: () => LocalizedString - /** - * Change the prefix of the bot. - */ - DESCRIPTION: () => LocalizedString - OPTIONS: { - PREFIX: { - /** - * new_prefix - */ - NAME: () => LocalizedString - /** - * The new prefix of the bot. - */ - DESCRIPTION: () => LocalizedString - } - } - EMBED: { - /** - * Prefix changed to `{prefix}`. - */ - DESCRIPTION: (arg: { prefix: string }) => LocalizedString - } - } - MAINTENANCE: { - /** - * Set the maintenance mode of the bot. - */ - DESCRIPTION: () => LocalizedString - EMBED: { - /** - * Maintenance mode set to `{state}`. - */ - DESCRIPTION: (arg: { state: string }) => LocalizedString - } - } - STATS: { - /** - * Get some stats about the bot. - */ - DESCRIPTION: () => LocalizedString - HEADERS: { - /** - * Commands - */ - COMMANDS: () => LocalizedString - /** - * Guild - */ - GUILDS: () => LocalizedString - /** - * Active Users - */ - ACTIVE_USERS: () => LocalizedString - /** - * Users - */ - USERS: () => LocalizedString - } - } - HELP: { - /** - * Get global help about the bot and its commands - */ - DESCRIPTION: () => LocalizedString - EMBED: { - /** - * Help panel - */ - TITLE: () => LocalizedString - /** - * {category} Commands - */ - CATEGORY_TITLE: (arg: { category: string }) => LocalizedString - } - SELECT_MENU: { - /** - * Select a category - */ - TITLE: () => LocalizedString - /** - * {category} commands - */ - CATEGORY_DESCRIPTION: (arg: { category: string }) => LocalizedString - } - } - PING: { - /** - * Pong! - */ - DESCRIPTION: () => LocalizedString - /** - * {member} Pong! The message round-trip took {time}ms.{heartbeat} - */ - MESSAGE: (arg: { heartbeat: string, member: string, time: number }) => LocalizedString - } - } -} - -export type Formatters = {} diff --git a/src/core/i18n/i18n-util.async.ts b/src/core/i18n/i18n-util.async.ts deleted file mode 100644 index 21d15995..00000000 --- a/src/core/i18n/i18n-util.async.ts +++ /dev/null @@ -1,29 +0,0 @@ -// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. -/* eslint-disable */ - -import { initFormatters } from './formatters' -import type { Locales, Translations } from './i18n-types' -import { loadedFormatters, loadedLocales, locales } from './i18n-util' - -const localeTranslationLoaders = { - en: () => import('./en'), - fr: () => import('./fr'), - ru: () => import('./ru'), - uk: () => import('./uk'), -} - -const updateDictionary = (locale: Locales, dictionary: Partial): Translations => - loadedLocales[locale] = { ...loadedLocales[locale], ...dictionary } - -export const importLocaleAsync = async (locale: Locales): Promise => - (await localeTranslationLoaders[locale]()).default as unknown as Translations - -export const loadLocaleAsync = async (locale: Locales): Promise => { - updateDictionary(locale, await importLocaleAsync(locale)) - loadFormatters(locale) -} - -export const loadAllLocalesAsync = (): Promise => Promise.all(locales.map(loadLocaleAsync)) - -export const loadFormatters = (locale: Locales): void => - void (loadedFormatters[locale] = initFormatters(locale)) diff --git a/src/core/i18n/i18n-util.sync.ts b/src/core/i18n/i18n-util.sync.ts deleted file mode 100644 index 7976704d..00000000 --- a/src/core/i18n/i18n-util.sync.ts +++ /dev/null @@ -1,30 +0,0 @@ -// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. -/* eslint-disable */ - -import { initFormatters } from './formatters' -import type { Locales, Translations } from './i18n-types' -import { loadedFormatters, loadedLocales, locales } from './i18n-util' - -import en from './en' -import fr from './fr' -import ru from './ru' -import uk from './uk' - -const localeTranslations = { - en, - fr, - ru, - uk, -} - -export const loadLocale = (locale: Locales): void => { - if (loadedLocales[locale]) return - - loadedLocales[locale] = localeTranslations[locale] as unknown as Translations - loadFormatters(locale) -} - -export const loadAllLocales = (): void => locales.forEach(loadLocale) - -export const loadFormatters = (locale: Locales): void => - void (loadedFormatters[locale] = initFormatters(locale)) diff --git a/src/core/i18n/i18n-util.ts b/src/core/i18n/i18n-util.ts deleted file mode 100644 index e9cb6b26..00000000 --- a/src/core/i18n/i18n-util.ts +++ /dev/null @@ -1,40 +0,0 @@ -// This file was auto-generated by 'typesafe-i18n'. Any manual changes will be overwritten. -/* eslint-disable */ - -import { i18n as initI18n, i18nObject as initI18nObject, i18nString as initI18nString } from 'typesafe-i18n' -import type { LocaleDetector } from 'typesafe-i18n/detectors' -import type { LocaleTranslationFunctions, TranslateByString } from 'typesafe-i18n' -import { detectLocale as detectLocaleFn } from 'typesafe-i18n/detectors' -import { initExtendDictionary } from 'typesafe-i18n/utils' -import type { Formatters, Locales, Translations, TranslationFunctions } from './i18n-types' - -export const baseLocale: Locales = 'en' - -export const locales: Locales[] = [ - 'en', - 'fr', - 'ru', - 'uk' -] - -export const isLocale = (locale: string): locale is Locales => locales.includes(locale as Locales) - -export const loadedLocales: Record = {} as Record - -export const loadedFormatters: Record = {} as Record - -export const extendDictionary = initExtendDictionary() - -export const i18nString = (locale: Locales): TranslateByString => initI18nString(locale, loadedFormatters[locale]) - -export const i18nObject = (locale: Locales): TranslationFunctions => - initI18nObject( - locale, - loadedLocales[locale], - loadedFormatters[locale] - ) - -export const i18n = (): LocaleTranslationFunctions => - initI18n(loadedLocales, loadedFormatters) - -export const detectLocale = (...detectors: LocaleDetector[]): Locales => detectLocaleFn(baseLocale, locales, ...detectors) diff --git a/src/core/i18n/ru/index.ts b/src/core/i18n/ru/index.ts deleted file mode 100644 index b068cf0a..00000000 --- a/src/core/i18n/ru/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable */ -import type { Translation } from '../i18n-types' - -const ru = { - GUARDS: { - DISABLED_COMMAND: 'Эта команда на данный момент не доступна.', - MAINTENANCE: 'Бот закрыт на техническое обслуживание.', - GUILD_ONLY: 'Эту команду можно использовать только на сервере.', - NSFW: 'Эта команда доступна только в чатах 18+.', - }, - ERRORS: { - UNKNOWN: 'Произошла непонятная ошибка.', - }, - SHARED: { - NO_COMMAND_DESCRIPTION: 'Описание отсутствует.', - }, - COMMANDS: { - INVITE: { - DESCRIPTION: 'Пригласить бота на свой сервер!', - EMBED: { - TITLE: 'Хочешь видеть меня у себя на сервере?', - DESCRIPTION: '[Жми здесь]({link}) чтобы добавить бота!', - }, - }, - PREFIX: { - NAME: 'prefix', - DESCRIPTION: 'Изменить префикс для бота.', - OPTIONS: { - PREFIX: { - NAME: 'new_prefix', - DESCRIPTION: 'Новый префикс для бота.', - }, - }, - EMBED: { - DESCRIPTION: 'Префикс бота изменен на `{prefix}`.', - }, - }, - MAINTENANCE: { - DESCRIPTION: 'Установить режим технического обслуживания бота.', - EMBED: { - DESCRIPTION: 'Режим Технического Обслуживания установлен на `{state}`.', - }, - }, - STATS: { - DESCRIPTION: 'Получить статистику по боту.', - HEADERS: { - COMMANDS: 'Команды', - GUILDS: 'Сервера', - ACTIVE_USERS: 'Активные пользователи', - USERS: 'Пользователи', - }, - }, - HELP: { - DESCRIPTION: 'Глобальная справка по боту и его командам', - EMBED: { - TITLE: 'Панель помощи', - CATEGORY_TITLE: '{category} команды', - }, - SELECT_MENU: { - TITLE: 'Выбери категорию', - CATEGORY_DESCRIPTION: '{category} команды', - }, - }, - PING: { - DESCRIPTION: 'Тук-тук!', - MESSAGE: '{member} Что нужно? Было потрачено {time} милисекунд на генерацию ответа. {heartbeat}', - }, - }, -} satisfies Translation - -export default ru diff --git a/src/core/i18n/uk/index.ts b/src/core/i18n/uk/index.ts deleted file mode 100644 index 79d689c2..00000000 --- a/src/core/i18n/uk/index.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable */ -import type { Translation } from '../i18n-types' - -const uk = { - GUARDS: { - DISABLED_COMMAND: 'Ця команда на разі відключена', - MAINTENANCE: 'На разі ведуться технічні роботи!', - GUILD_ONLY: 'Цю команду можна використовувати тільки на сервері!', - NSFW: 'Ця команда може бути використана тільки в каналі для дорослих!', - }, - ERRORS: { - UNKNOWN: 'Сталася невідома помилка!', - }, - SHARED: { - NO_COMMAND_DESCRIPTION: 'Опис відсутній.', - }, - COMMANDS: { - INVITE: { - DESCRIPTION: 'Запросити бота до себе додому!', - EMBED: { - TITLE: 'Запроси мене до себе на сервер!', - DESCRIPTION: '[Тисни тут]({link}) щоб я мав доступ!', - }, - }, - PREFIX: { - NAME: 'prefix', - DESCRIPTION: 'Змінити префікс команд.', - OPTIONS: { - PREFIX: { - NAME: 'new_prefix', - DESCRIPTION: 'Новий префікс для команд боту.', - }, - }, - EMBED: { - DESCRIPTION: 'Префікс змінено на `{prefix}`.', - }, - }, - MAINTENANCE: { - DESCRIPTION: 'Встановити режим проведення технічних робіт.', - EMBED: { - DESCRIPTION: 'Режим технічних робіт встановлено на `{state}`.', - }, - }, - STATS: { - DESCRIPTION: 'Подивитись статистику бота.', - HEADERS: { - COMMANDS: 'Команди', - GUILDS: 'Гільдії', - ACTIVE_USERS: 'Активні користувачі', - USERS: 'Користувачі', - }, - }, - HELP: { - DESCRIPTION: 'Загальна допомога по боту та його командам', - EMBED: { - TITLE: 'Панель допомоги', - CATEGORY_TITLE: '{category} команди', - }, - SELECT_MENU: { - TITLE: 'Вибери категорію', - CATEGORY_DESCRIPTION: '{category} команди', - }, - }, - PING: { - DESCRIPTION: "Перевірка зв'язку!", - MESSAGE: '{member} Чути добре! Генерація повідомлення зайняла {time} мілісекунд. {heartbeat}', - }, - }, -} satisfies Translation - -export default uk diff --git a/src/core/entities/BaseEntity.ts b/src/entities/BaseEntity.ts similarity index 100% rename from src/core/entities/BaseEntity.ts rename to src/entities/BaseEntity.ts diff --git a/src/core/entities/Data.ts b/src/entities/Data.ts similarity index 100% rename from src/core/entities/Data.ts rename to src/entities/Data.ts diff --git a/src/core/entities/Guild.ts b/src/entities/Guild.ts similarity index 100% rename from src/core/entities/Guild.ts rename to src/entities/Guild.ts diff --git a/src/core/entities/Image.ts b/src/entities/Image.ts similarity index 100% rename from src/core/entities/Image.ts rename to src/entities/Image.ts diff --git a/src/core/entities/Pastebin.ts b/src/entities/Pastebin.ts similarity index 100% rename from src/core/entities/Pastebin.ts rename to src/entities/Pastebin.ts diff --git a/src/core/entities/Stat.ts b/src/entities/Stat.ts similarity index 100% rename from src/core/entities/Stat.ts rename to src/entities/Stat.ts diff --git a/src/core/entities/User.ts b/src/entities/User.ts similarity index 100% rename from src/core/entities/User.ts rename to src/entities/User.ts diff --git a/src/core/entities/index.ts b/src/entities/index.ts similarity index 100% rename from src/core/entities/index.ts rename to src/entities/index.ts diff --git a/src/core/guards/disabled.ts b/src/guards/disabled.ts similarity index 100% rename from src/core/guards/disabled.ts rename to src/guards/disabled.ts diff --git a/src/core/guards/extractLocale.ts b/src/guards/extractLocale.ts similarity index 100% rename from src/core/guards/extractLocale.ts rename to src/guards/extractLocale.ts diff --git a/src/core/guards/guildOnly.ts b/src/guards/guildOnly.ts similarity index 100% rename from src/core/guards/guildOnly.ts rename to src/guards/guildOnly.ts diff --git a/src/core/guards/index.ts b/src/guards/index.ts similarity index 100% rename from src/core/guards/index.ts rename to src/guards/index.ts diff --git a/src/core/guards/maintenance.ts b/src/guards/maintenance.ts similarity index 100% rename from src/core/guards/maintenance.ts rename to src/guards/maintenance.ts diff --git a/src/core/guards/match.ts b/src/guards/match.ts similarity index 100% rename from src/core/guards/match.ts rename to src/guards/match.ts diff --git a/src/core/guards/notBot.ts b/src/guards/notBot.ts similarity index 100% rename from src/core/guards/notBot.ts rename to src/guards/notBot.ts diff --git a/src/core/guards/nsfw.ts b/src/guards/nsfw.ts similarity index 100% rename from src/core/guards/nsfw.ts rename to src/guards/nsfw.ts diff --git a/src/core/guards/requestContextIsolator.ts b/src/guards/requestContextIsolator.ts similarity index 100% rename from src/core/guards/requestContextIsolator.ts rename to src/guards/requestContextIsolator.ts diff --git a/src/core/i18n/detectors.ts b/src/i18n/detectors.ts similarity index 100% rename from src/core/i18n/detectors.ts rename to src/i18n/detectors.ts diff --git a/src/i18n/formatters.ts b/src/i18n/formatters.ts index 78734f9a..56801f8c 100644 --- a/src/i18n/formatters.ts +++ b/src/i18n/formatters.ts @@ -1,5 +1,5 @@ -import type { FormattersInitializer } from 'typesafe-i18n' -import type { Locales, Formatters } from './i18n-types' +import type { FormattersInitializer } from "typesafe-i18n" +import type { Locales, Formatters } from "./i18n-types" export const initFormatters: FormattersInitializer = (locale: Locales) => { diff --git a/src/core/i18n/index.ts b/src/i18n/index.ts similarity index 100% rename from src/core/i18n/index.ts rename to src/i18n/index.ts diff --git a/src/core/services/Database.ts b/src/services/Database.ts similarity index 100% rename from src/core/services/Database.ts rename to src/services/Database.ts diff --git a/src/core/services/ErrorHandler.ts b/src/services/ErrorHandler.ts similarity index 100% rename from src/core/services/ErrorHandler.ts rename to src/services/ErrorHandler.ts diff --git a/src/core/services/EventManager.ts b/src/services/EventManager.ts similarity index 100% rename from src/core/services/EventManager.ts rename to src/services/EventManager.ts diff --git a/src/core/services/ImagesUpload.ts b/src/services/ImagesUpload.ts similarity index 100% rename from src/core/services/ImagesUpload.ts rename to src/services/ImagesUpload.ts diff --git a/src/core/services/Logger.ts b/src/services/Logger.ts similarity index 100% rename from src/core/services/Logger.ts rename to src/services/Logger.ts diff --git a/src/core/services/Pastebin.ts b/src/services/Pastebin.ts similarity index 100% rename from src/core/services/Pastebin.ts rename to src/services/Pastebin.ts diff --git a/src/core/services/PluginsManager.ts b/src/services/PluginsManager.ts similarity index 97% rename from src/core/services/PluginsManager.ts rename to src/services/PluginsManager.ts index 5615f0cc..41c22f9a 100644 --- a/src/core/services/PluginsManager.ts +++ b/src/services/PluginsManager.ts @@ -78,7 +78,7 @@ export class PluginsManager { let translations: { [key: string]: BaseTranslation } = {} for (const locale of locales) { - const path = getSourceCodeLocation() + '/core/i18n/' + locale + const path = getSourceCodeLocation() + '/i18n/' + locale if (fs.existsSync(path)) translations[locale] = (await import(path))?.default } @@ -107,7 +107,7 @@ export class PluginsManager { const pluginsName = this._plugins.map(plugin => plugin.name) - for (const path of await resolve(getSourceCodeLocation() + '/core/i18n/*/*/index.ts')) { + for (const path of await resolve(getSourceCodeLocation() + '/i18n/*/*/index.ts')) { const name = path.split(sep).at(-2) || "" diff --git a/src/core/services/Scheduler.ts b/src/services/Scheduler.ts similarity index 100% rename from src/core/services/Scheduler.ts rename to src/services/Scheduler.ts diff --git a/src/core/services/Stats.ts b/src/services/Stats.ts similarity index 100% rename from src/core/services/Stats.ts rename to src/services/Stats.ts diff --git a/src/core/services/Store.ts b/src/services/Store.ts similarity index 100% rename from src/core/services/Store.ts rename to src/services/Store.ts diff --git a/src/core/services/WebSocket.ts b/src/services/WebSocket.ts similarity index 100% rename from src/core/services/WebSocket.ts rename to src/services/WebSocket.ts diff --git a/src/core/services/index.ts b/src/services/index.ts similarity index 100% rename from src/core/services/index.ts rename to src/services/index.ts diff --git a/src/core/utils/classes/BaseController.ts b/src/utils/classes/BaseController.ts similarity index 100% rename from src/core/utils/classes/BaseController.ts rename to src/utils/classes/BaseController.ts diff --git a/src/core/utils/classes/BaseError.ts b/src/utils/classes/BaseError.ts similarity index 100% rename from src/core/utils/classes/BaseError.ts rename to src/utils/classes/BaseError.ts diff --git a/src/core/utils/classes/Plugin.ts b/src/utils/classes/Plugin.ts similarity index 97% rename from src/core/utils/classes/Plugin.ts rename to src/utils/classes/Plugin.ts index a7f20790..f13edc99 100644 --- a/src/core/utils/classes/Plugin.ts +++ b/src/utils/classes/Plugin.ts @@ -90,7 +90,7 @@ export class Plugin { } for (const defaultLocale of locales) { - const path = `${getSourceCodeLocation()}/core/i18n/${defaultLocale}/${this._name}/_custom.` + const path = `${getSourceCodeLocation()}/i18n/${defaultLocale}/${this._name}/_custom.` if (fs.existsSync(path + "js")) translations[defaultLocale] = (await import(path + "js")).default else if (fs.existsSync(path + "ts")) translations[defaultLocale] = (await import(path + "ts")).default } diff --git a/src/core/utils/classes/index.ts b/src/utils/classes/index.ts similarity index 100% rename from src/core/utils/classes/index.ts rename to src/utils/classes/index.ts diff --git a/src/core/utils/decorators/ContextMenu.ts b/src/utils/decorators/ContextMenu.ts similarity index 100% rename from src/core/utils/decorators/ContextMenu.ts rename to src/utils/decorators/ContextMenu.ts diff --git a/src/core/utils/decorators/On.ts b/src/utils/decorators/On.ts similarity index 100% rename from src/core/utils/decorators/On.ts rename to src/utils/decorators/On.ts diff --git a/src/core/utils/decorators/OnCustom.ts b/src/utils/decorators/OnCustom.ts similarity index 100% rename from src/core/utils/decorators/OnCustom.ts rename to src/utils/decorators/OnCustom.ts diff --git a/src/core/utils/decorators/Once.ts b/src/utils/decorators/Once.ts similarity index 100% rename from src/core/utils/decorators/Once.ts rename to src/utils/decorators/Once.ts diff --git a/src/core/utils/decorators/Schedule.ts b/src/utils/decorators/Schedule.ts similarity index 100% rename from src/core/utils/decorators/Schedule.ts rename to src/utils/decorators/Schedule.ts diff --git a/src/core/utils/decorators/Slash.ts b/src/utils/decorators/Slash.ts similarity index 100% rename from src/core/utils/decorators/Slash.ts rename to src/utils/decorators/Slash.ts diff --git a/src/core/utils/decorators/SlashChoice.ts b/src/utils/decorators/SlashChoice.ts similarity index 100% rename from src/core/utils/decorators/SlashChoice.ts rename to src/utils/decorators/SlashChoice.ts diff --git a/src/core/utils/decorators/SlashGroup.ts b/src/utils/decorators/SlashGroup.ts similarity index 100% rename from src/core/utils/decorators/SlashGroup.ts rename to src/utils/decorators/SlashGroup.ts diff --git a/src/core/utils/decorators/SlashOption.ts b/src/utils/decorators/SlashOption.ts similarity index 100% rename from src/core/utils/decorators/SlashOption.ts rename to src/utils/decorators/SlashOption.ts diff --git a/src/core/utils/decorators/WSOn.ts b/src/utils/decorators/WSOn.ts similarity index 100% rename from src/core/utils/decorators/WSOn.ts rename to src/utils/decorators/WSOn.ts diff --git a/src/core/utils/decorators/index.ts b/src/utils/decorators/index.ts similarity index 100% rename from src/core/utils/decorators/index.ts rename to src/utils/decorators/index.ts diff --git a/src/core/utils/errors/InvalidOptionName.ts b/src/utils/errors/InvalidOptionName.ts similarity index 100% rename from src/core/utils/errors/InvalidOptionName.ts rename to src/utils/errors/InvalidOptionName.ts diff --git a/src/core/utils/errors/NoBotToken.ts b/src/utils/errors/NoBotToken.ts similarity index 100% rename from src/core/utils/errors/NoBotToken.ts rename to src/utils/errors/NoBotToken.ts diff --git a/src/core/utils/errors/UnknownReply.ts b/src/utils/errors/UnknownReply.ts similarity index 100% rename from src/core/utils/errors/UnknownReply.ts rename to src/utils/errors/UnknownReply.ts diff --git a/src/core/utils/errors/index.ts b/src/utils/errors/index.ts similarity index 100% rename from src/core/utils/errors/index.ts rename to src/utils/errors/index.ts diff --git a/src/core/utils/functions/array.ts b/src/utils/functions/array.ts similarity index 100% rename from src/core/utils/functions/array.ts rename to src/utils/functions/array.ts diff --git a/src/core/utils/functions/colors.ts b/src/utils/functions/colors.ts similarity index 100% rename from src/core/utils/functions/colors.ts rename to src/utils/functions/colors.ts diff --git a/src/core/utils/functions/converter.ts b/src/utils/functions/converter.ts similarity index 100% rename from src/core/utils/functions/converter.ts rename to src/utils/functions/converter.ts diff --git a/src/core/utils/functions/database.ts b/src/utils/functions/database.ts similarity index 100% rename from src/core/utils/functions/database.ts rename to src/utils/functions/database.ts diff --git a/src/core/utils/functions/date.ts b/src/utils/functions/date.ts similarity index 100% rename from src/core/utils/functions/date.ts rename to src/utils/functions/date.ts diff --git a/src/core/utils/functions/dependency.ts b/src/utils/functions/dependency.ts similarity index 100% rename from src/core/utils/functions/dependency.ts rename to src/utils/functions/dependency.ts diff --git a/src/core/utils/functions/devs.ts b/src/utils/functions/devs.ts similarity index 100% rename from src/core/utils/functions/devs.ts rename to src/utils/functions/devs.ts diff --git a/src/core/utils/functions/embeds.ts b/src/utils/functions/embeds.ts similarity index 100% rename from src/core/utils/functions/embeds.ts rename to src/utils/functions/embeds.ts diff --git a/src/core/utils/functions/error.ts b/src/utils/functions/error.ts similarity index 100% rename from src/core/utils/functions/error.ts rename to src/utils/functions/error.ts diff --git a/src/core/utils/functions/eval.ts b/src/utils/functions/eval.ts similarity index 100% rename from src/core/utils/functions/eval.ts rename to src/utils/functions/eval.ts diff --git a/src/core/utils/functions/files.ts b/src/utils/functions/files.ts similarity index 100% rename from src/core/utils/functions/files.ts rename to src/utils/functions/files.ts diff --git a/src/core/utils/functions/image.ts b/src/utils/functions/image.ts similarity index 100% rename from src/core/utils/functions/image.ts rename to src/utils/functions/image.ts diff --git a/src/core/utils/functions/index.ts b/src/utils/functions/index.ts similarity index 100% rename from src/core/utils/functions/index.ts rename to src/utils/functions/index.ts diff --git a/src/core/utils/functions/interactions.ts b/src/utils/functions/interactions.ts similarity index 100% rename from src/core/utils/functions/interactions.ts rename to src/utils/functions/interactions.ts diff --git a/src/core/utils/functions/localization.ts b/src/utils/functions/localization.ts similarity index 100% rename from src/core/utils/functions/localization.ts rename to src/utils/functions/localization.ts diff --git a/src/core/utils/functions/maintenance.ts b/src/utils/functions/maintenance.ts similarity index 100% rename from src/core/utils/functions/maintenance.ts rename to src/utils/functions/maintenance.ts diff --git a/src/core/utils/functions/prefix.ts b/src/utils/functions/prefix.ts similarity index 100% rename from src/core/utils/functions/prefix.ts rename to src/utils/functions/prefix.ts diff --git a/src/core/utils/functions/resolvers.ts b/src/utils/functions/resolvers.ts similarity index 99% rename from src/core/utils/functions/resolvers.ts rename to src/utils/functions/resolvers.ts index 20cc58e9..23d3db70 100644 --- a/src/core/utils/functions/resolvers.ts +++ b/src/utils/functions/resolvers.ts @@ -13,7 +13,7 @@ import { Interaction, } from "discord.js" -import packageJson from "../../../../package.json" +import packageJson from "../../../package.json" const resolvers = { diff --git a/src/core/utils/functions/string.ts b/src/utils/functions/string.ts similarity index 100% rename from src/core/utils/functions/string.ts rename to src/utils/functions/string.ts diff --git a/src/core/utils/functions/synchronizer.ts b/src/utils/functions/synchronizer.ts similarity index 100% rename from src/core/utils/functions/synchronizer.ts rename to src/utils/functions/synchronizer.ts diff --git a/src/core/utils/types/configs.d.ts b/src/utils/types/configs.d.ts similarity index 100% rename from src/core/utils/types/configs.d.ts rename to src/utils/types/configs.d.ts diff --git a/src/core/utils/types/database.d.ts b/src/utils/types/database.d.ts similarity index 100% rename from src/core/utils/types/database.d.ts rename to src/utils/types/database.d.ts diff --git a/src/core/utils/types/environment.d.ts b/src/utils/types/environment.d.ts similarity index 100% rename from src/core/utils/types/environment.d.ts rename to src/utils/types/environment.d.ts diff --git a/src/core/utils/types/interactions.d.ts b/src/utils/types/interactions.d.ts similarity index 100% rename from src/core/utils/types/interactions.d.ts rename to src/utils/types/interactions.d.ts diff --git a/src/core/utils/types/localization.d.ts b/src/utils/types/localization.d.ts similarity index 100% rename from src/core/utils/types/localization.d.ts rename to src/utils/types/localization.d.ts diff --git a/src/core/utils/types/state.d.ts b/src/utils/types/state.d.ts similarity index 100% rename from src/core/utils/types/state.d.ts rename to src/utils/types/state.d.ts diff --git a/src/core/utils/types/stats.d.ts b/src/utils/types/stats.d.ts similarity index 100% rename from src/core/utils/types/stats.d.ts rename to src/utils/types/stats.d.ts diff --git a/src/core/utils/types/utils.d.ts b/src/utils/types/utils.d.ts similarity index 100% rename from src/core/utils/types/utils.d.ts rename to src/utils/types/utils.d.ts diff --git a/src/core/utils/types/websocket.d.ts b/src/utils/types/websocket.d.ts similarity index 100% rename from src/core/utils/types/websocket.d.ts rename to src/utils/types/websocket.d.ts diff --git a/tsconfig.json b/tsconfig.json index 4c88740f..afa836da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,32 +22,32 @@ "baseUrl": ".", "paths": { - "@decorators": ["src/core/utils/decorators"], - "@decorators/*": ["src/plugins/*/core/utils/decorators"], + "@decorators": ["src/utils/decorators"], + "@decorators/*": ["src/plugins/*/utils/decorators"], - "@errors": ["src/core/utils/errors"], - "@errors/*": ["src/plugins/*/core/utils/errors"], + "@errors": ["src/utils/errors"], + "@errors/*": ["src/plugins/*/utils/errors"], - "@entities": ["src/core/entities"], - "@entities/*": ["src/plugins/*/core/entities"], + "@entities": ["src/entities"], + "@entities/*": ["src/plugins/*/entities"], - "@guards": ["src/core/guards"], - "@guards/*": ["src/plugins/*/core/guards"], + "@guards": ["src/guards"], + "@guards/*": ["src/plugins/*/guards"], - "@services": ["src/core/services"], - "@services/*": ["src/plugins/*/core/services"], + "@services": ["src/services"], + "@services/*": ["src/plugins/*/services"], - "@i18n": ["src/core/i18n"], - "@i18n/*": ["src/plugins/*/core/i18n"], + "@i18n": ["src/i18n"], + "@i18n/*": ["src/plugins/*/i18n"], "@configs": ["src/configs"], "@configs/*": ["src/plugins/*/configs"], - "@utils/classes": ["src/core/utils/classes"], - "@utils/classes/*": ["src/plugins/*/core/utils/classes"], + "@utils/classes": ["src/utils/classes"], + "@utils/classes/*": ["src/plugins/*/utils/classes"], - "@utils/functions": ["src/core/utils/functions"], - "@utils/functions/*": ["src/plugins/*/core/utils/functions"], + "@utils/functions": ["src/utils/functions"], + "@utils/functions/*": ["src/plugins/*/utils/functions"], "@api/controllers": ["src/api/controllers"], "@api/controllers/*": ["src/plugins/*/api/controllers"], @@ -61,7 +61,7 @@ "include": ["src", "**/*.ts"], "exclude": ["build", "node_modules", "tests"], - "paths": ["node_modules/*", "src/core/utils/types/*", "src/plugins/*/core/utils/types/*"], + "paths": ["node_modules/*", "src/utils/types/*", "src/plugins/*/utils/types/*"], "ts-node": { "require": ["tsconfig-paths/register"]