fix!: New folder structure and organize files

This commit is contained in:
Marius Begby committed 2024-01-30 16:29:17 +01:00
1 parent d92bd329dc
commit 39ff5ecb5d
83 files changed
+243 -245

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@
}, },
"scripts": { "scripts": {
"start": "node .", "start": "node .",
"deploy": "node ./dist/utils/deploySlashCommands.js", "deploy": "node ./dist/startup/deploySlashCommands.js",
"predev": "npx prisma generate && npx prisma db push", "predev": "npx prisma generate && npx prisma db push",
"dev": "concurrently --names \"TSC,TOC,BOT\" --prefix-colors \"yellow,blue,green\" \"npx tsc -w\" \"nodemon -w locales/en -x npm run toc\" \"nodemon -x npm run start\"", "dev": "concurrently --names \"TSC,TOC,BOT\" --prefix-colors \"yellow,blue,green\" \"npx tsc -w\" \"nodemon -w locales/en -x npm run toc\" \"nodemon -x npm run start\"",
"eslint": "eslint ./src --fix", "eslint": "eslint ./src --fix",
+5 -5
View File
@@ -6,12 +6,12 @@ import { Player } from 'discord-player';
import { Client } from 'discord.js'; import { Client } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from './services/logger'; import loggerModule from './common/services/logger';
import { ExtendedClient } from './types/clientTypes'; import { ExtendedClient } from './types/clientTypes';
import { createClient } from './utils/factory/createClient'; import { createClient } from './common/factory/createClient';
import { createPlayer } from './utils/factory/createPlayer'; import { createPlayer } from './common/factory/createPlayer';
import { registerClientInteractions } from './utils/registerClientInteractions'; import { registerClientInteractions } from './startup/registerClientInteractions';
import { registerEventListeners } from './utils/registerEventListeners'; import { registerEventListeners } from './startup/registerEventListeners';
const executionId: string = uuidv4(); const executionId: string = uuidv4();
const logger: Logger = loggerModule.child({ const logger: Logger = loggerModule.child({
@@ -15,7 +15,7 @@ import {
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../services/logger';
import { BotOptions, EmbedOptions, PlayerOptions } from '../types/configTypes'; import { BotOptions, EmbedOptions, PlayerOptions } from '../../types/configTypes';
import { import {
BaseAutocompleteParams, BaseAutocompleteParams,
BaseAutocompleteReturnType, BaseAutocompleteReturnType,
@@ -24,8 +24,8 @@ import {
BaseInteractionParams, BaseInteractionParams,
BaseSlashCommandParams, BaseSlashCommandParams,
BaseSlashCommandReturnType BaseSlashCommandReturnType
} from '../types/interactionTypes'; } from '../../types/interactionTypes';
import { Validator, ValidatorParams } from '../types/utilTypes'; import { Validator, ValidatorParams } from '../../types/utilTypes';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
abstract class BaseInteraction { abstract class BaseInteraction {
@@ -1,6 +1,6 @@
import Discord, { Client } from 'discord.js'; import Discord, { Client } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
export const createClient = async ({ executionId }: { executionId: string }): Promise<Client> => { export const createClient = async ({ executionId }: { executionId: string }): Promise<Client> => {
const logger: Logger = loggerModule.child({ const logger: Logger = loggerModule.child({
@@ -1,7 +1,7 @@
import config from 'config'; import config from 'config';
import { IPRotationConfig, Player } from 'discord-player'; import { IPRotationConfig, Player } from 'discord-player';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { CreatePlayerParams } from '../../types/playerTypes'; import { CreatePlayerParams } from '../../types/playerTypes';
export const createPlayer = async ({ client, executionId }: CreatePlayerParams): Promise<Player> => { export const createPlayer = async ({ client, executionId }: CreatePlayerParams): Promise<Player> => {
@@ -1,9 +1,9 @@
import { getPrismaClient } from './prismaClient'; import { usePrismaClient } from './prismaClient';
import loggerModule from './logger'; import loggerModule from './logger';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { Interaction, MessageComponentInteraction } from 'discord.js'; import { Interaction, MessageComponentInteraction } from 'discord.js';
const prisma = getPrismaClient(); const prisma = usePrismaClient();
function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger { function getLogger(executionId: string, interaction?: Interaction | MessageComponentInteraction): Logger {
return loggerModule.child({ return loggerModule.child({
@@ -1,8 +1,8 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import config from 'config'; import config from 'config';
import pino, { DestinationStream, Logger, LoggerOptions } from 'pino'; import pino, { DestinationStream, Logger, LoggerOptions } from 'pino';
import { CustomLoggerOptions } from '../types/configTypes'; import { CustomLoggerOptions } from '../../types/configTypes';
import { TargetOptions } from '../types/serviceTypes'; import { TargetOptions } from '../../types/serviceTypes';
// Retrieve logger options from config // Retrieve logger options from config
const loggerOptions: CustomLoggerOptions = config.get('loggerOptions'); const loggerOptions: CustomLoggerOptions = config.get('loggerOptions');
@@ -2,7 +2,7 @@ import { PrismaClient } from '@prisma/client';
let prisma: PrismaClient | undefined; let prisma: PrismaClient | undefined;
export const getPrismaClient = () => { export const usePrismaClient = () => {
if (!prisma) { if (!prisma) {
prisma = new PrismaClient(); prisma = new PrismaClient();
} }
File renamed without changes.
@@ -1,6 +1,6 @@
import { QueueRepeatMode } from 'discord-player'; import { QueueRepeatMode } from 'discord-player';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { EmbedOptions } from '../types/configTypes'; import { EmbedOptions } from '../../types/configTypes';
export function formatDuration(durationMs: number): string { export function formatDuration(durationMs: number): string {
const durationDate: Date = new Date(0); const durationDate: Date = new Date(0);
@@ -1,7 +1,7 @@
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { GetUptimeFormattedParams } from '../../types/utilTypes'; import { GetUptimeFormattedParams } from '../../types/utilTypes';
import { formatDuration } from '../../common/formattingUtils'; import { formatDuration } from './formattingUtils';
export const getUptimeFormatted = ({ executionId }: GetUptimeFormattedParams): string => { export const getUptimeFormatted = ({ executionId }: GetUptimeFormattedParams): string => {
const logger: Logger = loggerModule.child({ const logger: Logger = loggerModule.child({
@@ -13,8 +13,10 @@ import { lstatSync, readdirSync } from 'fs';
import i18n from 'i18next'; import i18n from 'i18next';
import i18nextFsBackend, { FsBackendOptions } from 'i18next-fs-backend'; import i18nextFsBackend, { FsBackendOptions } from 'i18next-fs-backend';
import { join } from 'path'; import { join } from 'path';
export const translatorInstance = i18n.createInstance(); export const translatorInstance = i18n.createInstance();
const localeDir = join(__dirname, '..', '..', 'locales'); const localeDir = join(__dirname, '..', '..', 'locales');
translatorInstance.use(i18nextFsBackend).init<FsBackendOptions>({ translatorInstance.use(i18nextFsBackend).init<FsBackendOptions>({
initImmediate: false, initImmediate: false,
fallbackLng: 'en', fallbackLng: 'en',
@@ -1,6 +1,6 @@
import { GuildQueueStatisticsMetadata } from 'discord-player'; import { GuildQueueStatisticsMetadata } from 'discord-player';
import { Client, Guild } from 'discord.js'; import { Client, Guild } from 'discord.js';
import { PlayerStatistics, ShardPlayerStatistics } from '../types/utilTypes'; import { PlayerStatistics, ShardPlayerStatistics } from '../../types/utilTypes';
async function fetchGuildsPerShard(client?: Client): Promise<Map<string, Guild>[]> { async function fetchGuildsPerShard(client?: Client): Promise<Map<string, Guild>[]> {
if (!client || !client.shard) { if (!client || !client.shard) {
@@ -1,7 +1,7 @@
import osu from 'node-os-utils'; import osu from 'node-os-utils';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { fetchTotalGuildStatistics, fetchTotalPlayerStatistics } from '../utils/shardUtils'; import { fetchTotalGuildStatistics, fetchTotalPlayerStatistics } from './shardUtils';
import { getUptimeFormatted } from '../utils/system/getUptimeFormatted'; import { getUptimeFormatted } from './getUptimeFormatted';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
export async function getBotStatistics( export async function getBotStatistics(
@@ -9,11 +9,11 @@ import {
VoiceChannel VoiceChannel
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions'; import { InteractionValidationError } from '../classes/interactions';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { EmbedOptions } from '../../types/configTypes'; import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes'; import { ValidatorParams } from '../../types/utilTypes';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId }: ValidatorParams) => { export const checkVoicePermissionJoinAndTalk = async ({ interaction, executionId }: ValidatorParams) => {
@@ -1,12 +1,12 @@
import config from 'config'; import config from 'config';
import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js'; import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions'; import { InteractionValidationError } from '../classes/interactions';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { EmbedOptions } from '../../types/configTypes'; import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes'; import { ValidatorParams } from '../../types/utilTypes';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../utils/formattingUtils';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkQueueExists = async ({ interaction, queue, executionId }: ValidatorParams) => { export const checkQueueExists = async ({ interaction, queue, executionId }: ValidatorParams) => {
@@ -1,5 +1,5 @@
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { TransformQueryParams } from '../../types/utilTypes'; import { TransformQueryParams } from '../../types/utilTypes';
export const transformQuery = ({ query, executionId }: TransformQueryParams) => { export const transformQuery = ({ query, executionId }: TransformQueryParams) => {
@@ -1,12 +1,12 @@
import config from 'config'; import config from 'config';
import { EmbedBuilder, InteractionType } from 'discord.js'; import { EmbedBuilder, InteractionType } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions'; import { InteractionValidationError } from '../classes/interactions';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { EmbedOptions, SystemOptions } from '../../types/configTypes'; import { EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes'; import { ValidatorParams } from '../../types/utilTypes';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../utils/formattingUtils';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const systemOptions: SystemOptions = config.get('systemOptions'); const systemOptions: SystemOptions = config.get('systemOptions');
@@ -1,11 +1,11 @@
import config from 'config'; import config from 'config';
import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js'; import { EmbedBuilder, GuildMember, InteractionType } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { InteractionValidationError } from '../../classes/interactions'; import { InteractionValidationError } from '../classes/interactions';
import loggerModule from '../../services/logger'; import loggerModule from '../services/logger';
import { EmbedOptions } from '../../types/configTypes'; import { EmbedOptions } from '../../types/configTypes';
import { ValidatorParams } from '../../types/utilTypes'; import { ValidatorParams } from '../../types/utilTypes';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
export const checkInVoiceChannel = async ({ interaction, executionId }: ValidatorParams) => { export const checkInVoiceChannel = async ({ interaction, executionId }: ValidatorParams) => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { Events } from 'discord.js'; import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: Events.Debug, name: Events.Debug,
+1 -1
View File
@@ -2,7 +2,7 @@ import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes'; import { EmbedOptions, SystemOptions } from '../../types/configTypes';
+1 -1
View File
@@ -1,7 +1,7 @@
import { Events } from 'discord.js'; import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: Events.Error, name: Events.Error,
+1 -1
View File
@@ -1,7 +1,7 @@
import { Events, Guild } from 'discord.js'; import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: Events.GuildCreate, name: Events.GuildCreate,
+1 -1
View File
@@ -1,7 +1,7 @@
import { Events, Guild } from 'discord.js'; import { Events, Guild } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: Events.GuildDelete, name: Events.GuildDelete,
+3 -3
View File
@@ -2,11 +2,11 @@ import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder, Events, PresenceData } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, LoadTestOptions, SystemOptions } from '../../types/configTypes'; import { EmbedOptions, LoadTestOptions, SystemOptions } from '../../types/configTypes';
import { postBotStats } from '../../utils/other/postBotStats'; import { postBotStats } from '../../startup/postBotStats';
import { startLoadTest } from '../../utils/other/startLoadTest'; import { startLoadTest } from '../../startup/startLoadTest';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const systemOptions: SystemOptions = config.get('systemOptions'); const systemOptions: SystemOptions = config.get('systemOptions');
+1 -1
View File
@@ -2,7 +2,7 @@ import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { EmbedOptions, SystemOptions } from '../../types/configTypes'; import { EmbedOptions, SystemOptions } from '../../types/configTypes';
+1 -1
View File
@@ -1,7 +1,7 @@
import { Events } from 'discord.js'; import { Events } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: Events.Warn, name: Events.Warn,
+2 -2
View File
@@ -8,12 +8,12 @@ import {
} from 'discord.js'; } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { CustomError } from '../../classes/interactions'; import { CustomError } from '../../common/classes/interactions';
import { handleAutocomplete } from '../../handlers/interactionAutocompleteHandler'; import { handleAutocomplete } from '../../handlers/interactionAutocompleteHandler';
import { handleCommand } from '../../handlers/interactionCommandHandler'; import { handleCommand } from '../../handlers/interactionCommandHandler';
import { handleComponent } from '../../handlers/interactionComponentHandler'; import { handleComponent } from '../../handlers/interactionComponentHandler';
import { handleError } from '../../handlers/interactionErrorHandler'; import { handleError } from '../../handlers/interactionErrorHandler';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
module.exports = { module.exports = {
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: 'debug', name: 'debug',
+2 -2
View File
@@ -2,10 +2,10 @@ import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes'; import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/localeUtil'; import { useLanguageTranslator } from '../../common/utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions'); const botOptions: BotOptions = config.get('botOptions');
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: 'error', name: 'error',
+2 -2
View File
@@ -2,10 +2,10 @@ import config from 'config';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes'; import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/localeUtil'; import { useLanguageTranslator } from '../../common/utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions'); const botOptions: BotOptions = config.get('botOptions');
+1 -1
View File
@@ -1,6 +1,6 @@
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { Track } from 'discord-player'; import { Track } from 'discord-player';
import { Snowflake } from 'discord.js'; import { Snowflake } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
+2 -2
View File
@@ -3,10 +3,10 @@ import { Track, TrackSkipReason } from 'discord-player';
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js'; import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes'; import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/localeUtil'; import { useLanguageTranslator } from '../../common/utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions'); const botOptions: BotOptions = config.get('botOptions');
+2 -2
View File
@@ -1,9 +1,9 @@
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { useLanguageTranslator } from '../../common/localeUtil'; import { useLanguageTranslator } from '../../common/utils/localeUtil';
import { EmbedBuilder, LocaleString } from 'discord.js'; import { EmbedBuilder, LocaleString } from 'discord.js';
import { EmbedOptions } from '../../types/configTypes'; import { EmbedOptions } from '../../types/configTypes';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { Track } from 'discord-player'; import { Track } from 'discord-player';
import { Logger } from 'pino'; import { Logger } from 'pino';
import config from 'config'; import config from 'config';
+1 -1
View File
@@ -1,7 +1,7 @@
import { Track } from 'discord-player'; import { Track } from 'discord-player';
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes'; import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
import { User } from 'discord.js'; import { User } from 'discord.js';
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: 'uncaughtException', name: 'uncaughtException',
+1 -1
View File
@@ -1,6 +1,6 @@
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../../common/services/logger';
module.exports = { module.exports = {
name: 'unhandledRejection', name: 'unhandledRejection',
@@ -1,7 +1,7 @@
import { AutocompleteInteraction } from 'discord.js'; import { AutocompleteInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseAutocompleteInteraction } from '../classes/interactions'; import { BaseAutocompleteInteraction } from '../common/classes/interactions';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
export const handleAutocomplete = async ( export const handleAutocomplete = async (
+3 -3
View File
@@ -1,9 +1,9 @@
import { ChatInputCommandInteraction } from 'discord.js'; import { ChatInputCommandInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../classes/interactions'; import { BaseSlashCommandInteraction } from '../common/classes/interactions';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator'; import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
export const handleCommand = async ( export const handleCommand = async (
interaction: ChatInputCommandInteraction, interaction: ChatInputCommandInteraction,
+3 -3
View File
@@ -1,9 +1,9 @@
import { MessageComponentInteraction } from 'discord.js'; import { MessageComponentInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseComponentInteraction } from '../classes/interactions'; import { BaseComponentInteraction } from '../common/classes/interactions';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { checkChannelPermissionViewable } from '../utils/validation/permissionValidator'; import { checkChannelPermissionViewable } from '../common/validation/permissionValidator';
export const handleComponent = async ( export const handleComponent = async (
interaction: MessageComponentInteraction, interaction: MessageComponentInteraction,
+3 -3
View File
@@ -8,10 +8,10 @@ import {
MessageComponentInteraction MessageComponentInteraction
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { CustomError, InteractionValidationError } from '../classes/interactions'; import { CustomError, InteractionValidationError } from '../common/classes/interactions';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { BotOptions, EmbedOptions } from '../types/configTypes'; import { BotOptions, EmbedOptions } from '../types/configTypes';
import { useServerTranslator } from '../common/localeUtil'; import { useServerTranslator } from '../common/utils/localeUtil';
const embedOptions: EmbedOptions = config.get('embedOptions'); const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions: BotOptions = config.get('botOptions'); const botOptions: BotOptions = config.get('botOptions');
+3 -3
View File
@@ -6,8 +6,8 @@ import { Client, Shard, ShardEvents, ShardingManager, ShardingManagerOptions } f
import { randomUUID as uuidv4 } from 'node:crypto'; import { randomUUID as uuidv4 } from 'node:crypto';
import { exec } from 'child_process'; import { exec } from 'child_process';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from './services/logger'; import loggerModule from './common/services/logger';
import { getPrismaClient } from './services/prismaClient'; import { usePrismaClient } from './common/services/prismaClient';
const shardingOptions: ShardingManagerOptions = config.get('shardingOptions'); const shardingOptions: ShardingManagerOptions = config.get('shardingOptions');
const manager: ShardingManager = new ShardingManager('./dist/bot.js', { const manager: ShardingManager = new ShardingManager('./dist/bot.js', {
@@ -27,7 +27,7 @@ manager.on('shardCreate', (shard: Shard) => {
shardId: 'manager' shardId: 'manager'
}); });
const prisma = getPrismaClient(); const prisma = usePrismaClient();
process.on('SIGINT', async () => { process.on('SIGINT', async () => {
await prisma.$disconnect(); await prisma.$disconnect();
+3 -3
View File
@@ -2,11 +2,11 @@ import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { Player, SearchResult, useMainPlayer } from 'discord-player'; import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js'; import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseAutocompleteInteraction } from '../../classes/interactions'; import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/autocompleteUtils'; import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes'; import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { useUserTranslator } from '../../common/localeUtil'; import { useUserTranslator } from '../../common/utils/localeUtil';
class LyricsAutocomplete extends BaseAutocompleteInteraction { class LyricsAutocomplete extends BaseAutocompleteInteraction {
private recentQueries = new Map<string, RecentQuery>(); private recentQueries = new Map<string, RecentQuery>();
+4 -4
View File
@@ -1,11 +1,11 @@
import { Player, SearchResult, useMainPlayer } from 'discord-player'; import { Player, SearchResult, useMainPlayer } from 'discord-player';
import { ApplicationCommandOptionChoiceData } from 'discord.js'; import { ApplicationCommandOptionChoiceData } from 'discord.js';
import { BaseAutocompleteInteraction } from '../../classes/interactions'; import { BaseAutocompleteInteraction } from '../../common/classes/interactions';
import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/autocompleteUtils'; import { getTrackName, isQueryTooShort, shouldUseLastQuery } from '../../common/utils/autocompleteUtils';
import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes'; import { BaseAutocompleteParams, BaseAutocompleteReturnType, RecentQuery } from '../../types/interactionTypes';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { useUserTranslator } from '../../common/localeUtil'; import { useUserTranslator } from '../../common/utils/localeUtil';
import { transformQuery } from '../../utils/validation/searchQueryValidator'; import { transformQuery } from '../../common/validation/searchQueryValidator';
class PlayAutocomplete extends BaseAutocompleteInteraction { class PlayAutocomplete extends BaseAutocompleteInteraction {
private recentQueries = new Map<string, RecentQuery>(); private recentQueries = new Map<string, RecentQuery>();
@@ -1,12 +1,12 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js'; import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions'; import { BaseComponentInteraction } from '../../common/classes/interactions';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../../common/utils/localeUtil';
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
class ActionPauseResumeButton extends BaseComponentInteraction { class ActionPauseResumeButton extends BaseComponentInteraction {
constructor() { constructor() {
@@ -1,13 +1,13 @@
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player'; import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js'; import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions'; import { BaseComponentInteraction } from '../../common/classes/interactions';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class ActionPreviousButton extends BaseComponentInteraction { class ActionPreviousButton extends BaseComponentInteraction {
constructor() { constructor() {
@@ -1,12 +1,12 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, MessageComponentInteraction } from 'discord.js'; import { EmbedBuilder, MessageComponentInteraction } from 'discord.js';
import { BaseComponentInteraction } from '../../classes/interactions'; import { BaseComponentInteraction } from '../../common/classes/interactions';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../../common/utils/localeUtil';
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
class ActionSkipButton extends BaseComponentInteraction { class ActionSkipButton extends BaseComponentInteraction {
constructor() { constructor() {
@@ -1,11 +1,11 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseComponentInteraction } from '../../classes/interactions'; import { BaseComponentInteraction } from '../../common/classes/interactions';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../../common/utils/localeUtil';
class FiltersDisableButtonComponent extends BaseComponentInteraction { class FiltersDisableButtonComponent extends BaseComponentInteraction {
constructor() { constructor() {
@@ -2,7 +2,7 @@ import config from 'config';
import { BiquadFilters, EqualizerConfigurationPreset, GuildQueue, QueueFilters, useQueue } from 'discord-player'; import { BiquadFilters, EqualizerConfigurationPreset, GuildQueue, QueueFilters, useQueue } from 'discord-player';
import { EmbedBuilder, Message, StringSelectMenuInteraction } from 'discord.js'; import { EmbedBuilder, Message, StringSelectMenuInteraction } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseComponentInteraction } from '../../classes/interactions'; import { BaseComponentInteraction } from '../../common/classes/interactions';
import { import {
EqualizerFilterOptions, EqualizerFilterOptions,
BiquadFilterOptions, BiquadFilterOptions,
@@ -10,9 +10,9 @@ import {
FilterOption FilterOption
} from '../../types/configTypes'; } from '../../types/configTypes';
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes'; import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { useServerTranslator } from '../../common/localeUtil'; import { useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions'); const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
+5 -5
View File
@@ -1,13 +1,13 @@
import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player'; import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkHistoryExists, checkQueueCurrentTrack } from '../../utils/validation/queueValidator'; import { checkHistoryExists, checkQueueCurrentTrack } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class BackCommand extends BaseSlashCommandInteraction { class BackCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+4 -4
View File
@@ -16,7 +16,7 @@ import {
StringSelectMenuOptionBuilder StringSelectMenuOptionBuilder
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { import {
BiquadFilterOptions, BiquadFilterOptions,
EqualizerFilterOptions, EqualizerFilterOptions,
@@ -24,9 +24,9 @@ import {
FilterOption FilterOption
} from '../../types/configTypes'; } from '../../types/configTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions'); const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
+7 -2
View File
@@ -13,9 +13,14 @@ import {
SlashCommandNumberOption, SlashCommandNumberOption,
SlashCommandStringOption SlashCommandStringOption
} from 'discord.js'; } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { CommandMetadata, localizeCommand, translatorInstance, useServerTranslator } from '../../common/localeUtil'; import {
CommandMetadata,
localizeCommand,
translatorInstance,
useServerTranslator
} from '../../common/utils/localeUtil';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
class HelpCommand extends BaseSlashCommandInteraction { class HelpCommand extends BaseSlashCommandInteraction {
+5 -5
View File
@@ -12,13 +12,13 @@ import {
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkHistoryExists } from '../../utils/validation/queueValidator'; import { checkHistoryExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
class HistoryCommand extends BaseSlashCommandInteraction { class HistoryCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -1,12 +1,12 @@
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player'; import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, GuildMember, Message, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, GuildMember, Message, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator'; import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
class JoinCommand extends BaseSlashCommandInteraction { class JoinCommand extends BaseSlashCommandInteraction {
+5 -5
View File
@@ -1,11 +1,11 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class LeaveCommand extends BaseSlashCommandInteraction { class LeaveCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -7,13 +7,13 @@ import {
SlashCommandIntegerOption SlashCommandIntegerOption
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatRepeatMode } from '../../common/formattingUtils'; import { formatRepeatMode } from '../../common/utils/formattingUtils';
class LoopCommand extends BaseSlashCommandInteraction { class LoopCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+4 -4
View File
@@ -2,11 +2,11 @@ import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
import { GuildQueue, Player, QueryType, SearchResult, Track, useMainPlayer, useQueue } from 'discord-player'; import { GuildQueue, Player, QueryType, SearchResult, Track, useMainPlayer, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
class LyricsCommand extends BaseSlashCommandInteraction { class LyricsCommand extends BaseSlashCommandInteraction {
+5 -5
View File
@@ -1,13 +1,13 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class MoveCommand extends BaseSlashCommandInteraction { class MoveCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -10,13 +10,13 @@ import {
EmbedField, EmbedField,
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatRepeatModeDetailed } from '../../common/formattingUtils'; import { formatRepeatModeDetailed } from '../../common/utils/formattingUtils';
class NowPlayingCommand extends BaseSlashCommandInteraction { class NowPlayingCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+4 -4
View File
@@ -1,11 +1,11 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
class PauseCommand extends BaseSlashCommandInteraction { class PauseCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+6 -6
View File
@@ -8,14 +8,14 @@ import {
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction, CustomError } from '../../classes/interactions'; import { BaseSlashCommandInteraction, CustomError } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator'; import { checkVoicePermissionJoinAndTalk } from '../../common/validation/permissionValidator';
import { transformQuery } from '../../utils/validation/searchQueryValidator'; import { transformQuery } from '../../common/validation/searchQueryValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class PlayCommand extends BaseSlashCommandInteraction { class PlayCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -12,12 +12,12 @@ import {
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
class QueueCommand extends BaseSlashCommandInteraction { class QueueCommand extends BaseSlashCommandInteraction {
+3 -3
View File
@@ -6,11 +6,11 @@ import {
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
class ReloadCommand extends BaseSlashCommandInteraction { class ReloadCommand extends BaseSlashCommandInteraction {
+5 -5
View File
@@ -1,13 +1,13 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class RemoveCommand extends BaseSlashCommandInteraction { class RemoveCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -1,13 +1,13 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class SeekCommand extends BaseSlashCommandInteraction { class SeekCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+3 -3
View File
@@ -1,10 +1,10 @@
import { EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import guildDatabaseClient from '../../services/guildDatabaseClient'; import guildDatabaseClient from '../../common/services/guildDatabaseClient';
class SettingsCommand extends BaseSlashCommandInteraction { class SettingsCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+3 -3
View File
@@ -5,12 +5,12 @@ import {
EmbedFooterData, EmbedFooterData,
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { ExtendedClient } from '../../types/clientTypes'; import { ExtendedClient } from '../../types/clientTypes';
import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../types/interactionTypes';
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand } from '../../common/localeUtil'; import { localizeCommand } from '../../common/utils/localeUtil';
class ShardsCommand extends BaseSlashCommandInteraction { class ShardsCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -1,11 +1,11 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueEmpty, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueEmpty, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class ShuffleCommand extends BaseSlashCommandInteraction { class ShuffleCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -1,13 +1,13 @@
import { GuildQueue, Track, useQueue } from 'discord-player'; import { GuildQueue, Track, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueCurrentTrack, checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/utils/formattingUtils';
class SkipCommand extends BaseSlashCommandInteraction { class SkipCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+8 -3
View File
@@ -10,10 +10,15 @@ import {
EmbedBuilder, EmbedBuilder,
SlashCommandBuilder SlashCommandBuilder
} from 'discord.js'; } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils'; import {
getBotStatistics,
getDiscordStatus,
getPlayerStatistics,
getSystemStatus
} from '../../common/utils/statusUtils';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
class StatusCommand extends BaseSlashCommandInteraction { class StatusCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+5 -5
View File
@@ -1,11 +1,11 @@
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player'; import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { formatSlashCommand } from '../../common/formattingUtils'; import { formatSlashCommand } from '../../common/utils/formattingUtils';
class StopCommand extends BaseSlashCommandInteraction { class StopCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
@@ -1,11 +1,16 @@
// @ts-ignore // @ts-ignore
import { dependencies, version } from '../../../package.json'; import { dependencies, version } from '../../../package.json';
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils'; import {
getBotStatistics,
getDiscordStatus,
getPlayerStatistics,
getSystemStatus
} from '../../common/utils/statusUtils';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; import { checkValidGuildId } from '../../common/validation/systemCommandValidator';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
class SystemStatusCommand extends BaseSlashCommandInteraction { class SystemStatusCommand extends BaseSlashCommandInteraction {
constructor() { constructor() {
+4 -4
View File
@@ -1,11 +1,11 @@
import { GuildQueue, useQueue } from 'discord-player'; import { GuildQueue, useQueue } from 'discord-player';
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BaseSlashCommandInteraction } from '../../common/classes/interactions';
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
import { checkQueueExists } from '../../utils/validation/queueValidator'; import { checkQueueExists } from '../../common/validation/queueValidator';
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { checkInVoiceChannel, checkSameVoiceChannel } from '../../common/validation/voiceChannelValidator';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { localizeCommand, useServerTranslator } from '../../common/utils/localeUtil';
import { TFunction } from 'i18next'; import { TFunction } from 'i18next';
class VolumeCommand extends BaseSlashCommandInteraction { class VolumeCommand extends BaseSlashCommandInteraction {
@@ -5,8 +5,8 @@ import { randomUUID as uuidv4 } from 'node:crypto';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { Logger } from 'pino'; import { Logger } from 'pino';
import { BaseSlashCommandInteraction } from '../classes/interactions'; import { BaseSlashCommandInteraction } from '../common/classes/interactions';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { SystemOptions } from '../types/configTypes'; import { SystemOptions } from '../types/configTypes';
const systemOptions: SystemOptions = config.get('systemOptions'); const systemOptions: SystemOptions = config.get('systemOptions');
@@ -2,9 +2,9 @@ import { Client } from 'discord.js';
import { ClientRequest, ClientRequestArgs, IncomingMessage } from 'node:http'; import { ClientRequest, ClientRequestArgs, IncomingMessage } from 'node:http';
import https from 'node:https'; import https from 'node:https';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../common/services/logger';
import { PostBotStatsParams, PostBotStatsSite } from '../../types/utilTypes'; import { PostBotStatsParams, PostBotStatsSite } from '../types/utilTypes';
import { fetchTotalGuildStatistics } from '../shardUtils'; import { fetchTotalGuildStatistics } from '../common/utils/shardUtils';
export const postBotStats = async ({ client, executionId }: PostBotStatsParams) => { export const postBotStats = async ({ client, executionId }: PostBotStatsParams) => {
const logger: Logger = loggerModule.child({ const logger: Logger = loggerModule.child({
@@ -2,7 +2,7 @@ import { Collection } from 'discord.js';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { ExtendedClient } from '../types/clientTypes'; import { ExtendedClient } from '../types/clientTypes';
import { RegisterClientInteractionsParams } from '../types/utilTypes'; import { RegisterClientInteractionsParams } from '../types/utilTypes';
@@ -4,7 +4,7 @@ import { Client } from 'discord.js';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../services/logger'; import loggerModule from '../common/services/logger';
import { CustomLoggerOptions } from '../types/configTypes'; import { CustomLoggerOptions } from '../types/configTypes';
import { ClientEventArguments, PlayerEventArguments, ProcessEventArguments } from '../types/eventTypes'; import { ClientEventArguments, PlayerEventArguments, ProcessEventArguments } from '../types/eventTypes';
import { CustomEvent, RegisterEventListenersParams } from '../types/utilTypes'; import { CustomEvent, RegisterEventListenersParams } from '../types/utilTypes';
@@ -1,9 +1,9 @@
import config from 'config'; import config from 'config';
import { Channel, Client } from 'discord.js'; import { Channel, Client } from 'discord.js';
import { Logger } from 'pino'; import { Logger } from 'pino';
import loggerModule from '../../services/logger'; import loggerModule from '../common/services/logger';
import { LoadTestOptions } from '../../types/configTypes'; import { LoadTestOptions } from '../types/configTypes';
import { StartLoadTestParams } from '../../types/utilTypes'; import { StartLoadTestParams } from '../types/utilTypes';
const loadTestOptions: LoadTestOptions = config.get('loadTestOptions'); const loadTestOptions: LoadTestOptions = config.get('loadTestOptions');
+1 -1
View File
@@ -1,6 +1,6 @@
import helpCommand from '../interactions/slashcommands/help'; import helpCommand from '../interactions/slashcommands/help';
import { SlashCommandNumberOption } from 'discord.js'; import { SlashCommandNumberOption } from 'discord.js';
import { BaseSlashCommandInteraction } from '../classes/interactions'; import { BaseSlashCommandInteraction } from '../common/classes/interactions';
describe('HelpCommand', () => { describe('HelpCommand', () => {
describe('getCommandParams', () => { describe('getCommandParams', () => {
+1 -1
View File
@@ -1,4 +1,4 @@
import { transformQuery } from '../utils/validation/searchQueryValidator'; import { transformQuery } from '../common/validation/searchQueryValidator';
describe('searchQueryValidator', () => { describe('searchQueryValidator', () => {
it.each(['us', 'nb', 'intl', 'en-us', 'long-code'])( it.each(['us', 'nb', 'intl', 'en-us', 'long-code'])(
+1 -1
View File
@@ -3,7 +3,7 @@ import {
BaseAutocompleteInteraction, BaseAutocompleteInteraction,
BaseComponentInteraction, BaseComponentInteraction,
BaseSlashCommandInteraction BaseSlashCommandInteraction
} from '../classes/interactions'; } from '../common/classes/interactions';
type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void; type RegisterClientInteractionsFunction = (params: { client: Client; executionId: string }) => void;
-19
View File
@@ -1,19 +0,0 @@
import fs from 'node:fs';
import path from 'node:path';
/* eslint-disable @typescript-eslint/no-var-requires */
const cookies: { name: string; value: string }[] = require(path.resolve('./cookies.json'));
try {
const cookieString: string = cookies
.map(({ name, value }: { name: string; value: string }) => {
return `${name}=${value}`;
})
.join('; ');
fs.writeFile(path.resolve('./cookies.txt'), cookieString, () => {
return process.exit(0);
});
} catch (error) {
process.exit(1);
}