diff --git a/src/interactions/commands/player/back.ts b/src/interactions/slashcommands/back.ts similarity index 94% rename from src/interactions/commands/player/back.ts rename to src/interactions/slashcommands/back.ts index 79a2cb2..29290e1 100644 --- a/src/interactions/commands/player/back.ts +++ b/src/interactions/slashcommands/back.ts @@ -1,13 +1,13 @@ import { GuildQueue, GuildQueueHistory, Track, useHistory, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkHistoryExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkHistoryExists, checkQueueCurrentTrack } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { formatSlashCommand } from '../../common/formattingUtils'; class BackCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/filters.ts b/src/interactions/slashcommands/filters.ts similarity index 96% rename from src/interactions/commands/player/filters.ts rename to src/interactions/slashcommands/filters.ts index 37897ab..bb5b8d0 100644 --- a/src/interactions/commands/player/filters.ts +++ b/src/interactions/slashcommands/filters.ts @@ -16,17 +16,17 @@ import { StringSelectMenuOptionBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; import { BiquadFilterOptions, EqualizerFilterOptions, FFmpegFilterOptions, FilterOption -} from '../../../types/configTypes'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +} from '../../types/configTypes'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions'); diff --git a/src/interactions/commands/info/help.ts b/src/interactions/slashcommands/help.ts similarity index 95% rename from src/interactions/commands/info/help.ts rename to src/interactions/slashcommands/help.ts index 3ff15fd..14d66e6 100644 --- a/src/interactions/commands/info/help.ts +++ b/src/interactions/slashcommands/help.ts @@ -13,10 +13,10 @@ import { SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { CommandMetadata, localizeCommand, translatorInstance, useServerTranslator } from '../../../common/localeUtil'; -import { ExtendedClient } from '../../../types/clientTypes'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { CommandMetadata, localizeCommand, translatorInstance, useServerTranslator } from '../../common/localeUtil'; +import { ExtendedClient } from '../../types/clientTypes'; class HelpCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/history.ts b/src/interactions/slashcommands/history.ts similarity index 96% rename from src/interactions/commands/player/history.ts rename to src/interactions/slashcommands/history.ts index 4946a42..b812541 100644 --- a/src/interactions/commands/player/history.ts +++ b/src/interactions/slashcommands/history.ts @@ -12,13 +12,13 @@ import { SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkHistoryExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkHistoryExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils'; +import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; class HistoryCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/join.ts b/src/interactions/slashcommands/join.ts similarity index 91% rename from src/interactions/commands/player/join.ts rename to src/interactions/slashcommands/join.ts index 1c13ced..3174d04 100644 --- a/src/interactions/commands/player/join.ts +++ b/src/interactions/slashcommands/join.ts @@ -1,12 +1,12 @@ import { GuildQueue, useMainPlayer, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, GuildMember, Message, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; +import { formatSlashCommand } from '../../common/formattingUtils'; import { TFunction } from 'i18next'; class JoinCommand extends BaseSlashCommandInteraction { diff --git a/src/interactions/commands/player/leave.ts b/src/interactions/slashcommands/leave.ts similarity index 82% rename from src/interactions/commands/player/leave.ts rename to src/interactions/slashcommands/leave.ts index 23560e6..bfa410f 100644 --- a/src/interactions/commands/player/leave.ts +++ b/src/interactions/slashcommands/leave.ts @@ -1,11 +1,11 @@ import { GuildQueue, useQueue } from 'discord-player'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; +import { formatSlashCommand } from '../../common/formattingUtils'; class LeaveCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/loop.ts b/src/interactions/slashcommands/loop.ts similarity index 94% rename from src/interactions/commands/player/loop.ts rename to src/interactions/slashcommands/loop.ts index a355eee..9702e3e 100644 --- a/src/interactions/commands/player/loop.ts +++ b/src/interactions/slashcommands/loop.ts @@ -7,13 +7,13 @@ import { SlashCommandIntegerOption } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatRepeatMode } from '../../../common/formattingUtils'; +import { formatRepeatMode } from '../../common/formattingUtils'; class LoopCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/lyrics.ts b/src/interactions/slashcommands/lyrics.ts similarity index 97% rename from src/interactions/commands/player/lyrics.ts rename to src/interactions/slashcommands/lyrics.ts index 7f80cda..8f795c8 100644 --- a/src/interactions/commands/player/lyrics.ts +++ b/src/interactions/slashcommands/lyrics.ts @@ -2,11 +2,11 @@ import { LyricsData, lyricsExtractor } from '@discord-player/extractor'; import { GuildQueue, Player, QueryType, SearchResult, Track, useMainPlayer, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; class LyricsCommand extends BaseSlashCommandInteraction { diff --git a/src/interactions/commands/player/move.ts b/src/interactions/slashcommands/move.ts similarity index 93% rename from src/interactions/commands/player/move.ts rename to src/interactions/slashcommands/move.ts index 4670b4c..456d65e 100644 --- a/src/interactions/commands/player/move.ts +++ b/src/interactions/slashcommands/move.ts @@ -1,13 +1,13 @@ import { GuildQueue, Track, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { formatSlashCommand } from '../../common/formattingUtils'; class MoveCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/nowplaying.ts b/src/interactions/slashcommands/nowplaying.ts similarity index 95% rename from src/interactions/commands/player/nowplaying.ts rename to src/interactions/slashcommands/nowplaying.ts index 3381728..93db9b8 100644 --- a/src/interactions/commands/player/nowplaying.ts +++ b/src/interactions/slashcommands/nowplaying.ts @@ -10,13 +10,13 @@ import { EmbedField, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatRepeatModeDetailed } from '../../../common/formattingUtils'; +import { formatRepeatModeDetailed } from '../../common/formattingUtils'; class NowPlayingCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/pause.ts b/src/interactions/slashcommands/pause.ts similarity index 89% rename from src/interactions/commands/player/pause.ts rename to src/interactions/slashcommands/pause.ts index c392919..e43f9f9 100644 --- a/src/interactions/commands/player/pause.ts +++ b/src/interactions/slashcommands/pause.ts @@ -1,11 +1,11 @@ import { GuildQueue, Track, useQueue } from 'discord-player'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; class PauseCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/play.ts b/src/interactions/slashcommands/play.ts similarity index 97% rename from src/interactions/commands/player/play.ts rename to src/interactions/slashcommands/play.ts index 457bdaa..792ee3b 100644 --- a/src/interactions/commands/player/play.ts +++ b/src/interactions/slashcommands/play.ts @@ -8,14 +8,14 @@ import { SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction, CustomError } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator'; -import { transformQuery } from '../../../utils/validation/searchQueryValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction, CustomError } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator'; +import { transformQuery } from '../../utils/validation/searchQueryValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { formatSlashCommand } from '../../common/formattingUtils'; class PlayCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/queue.ts b/src/interactions/slashcommands/queue.ts similarity index 96% rename from src/interactions/commands/player/queue.ts rename to src/interactions/slashcommands/queue.ts index c7210dc..27a3c7e 100644 --- a/src/interactions/commands/player/queue.ts +++ b/src/interactions/slashcommands/queue.ts @@ -12,12 +12,12 @@ import { SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; class QueueCommand extends BaseSlashCommandInteraction { diff --git a/src/interactions/commands/system/reload.ts b/src/interactions/slashcommands/reload.ts similarity index 92% rename from src/interactions/commands/system/reload.ts rename to src/interactions/slashcommands/reload.ts index dea92bc..c109992 100644 --- a/src/interactions/commands/system/reload.ts +++ b/src/interactions/slashcommands/reload.ts @@ -6,11 +6,11 @@ import { SlashCommandBuilder } from 'discord.js'; import { Logger } from 'pino'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { ExtendedClient } from '../../../types/clientTypes'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { ExtendedClient } from '../../types/clientTypes'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; class ReloadCommand extends BaseSlashCommandInteraction { diff --git a/src/interactions/commands/player/remove.ts b/src/interactions/slashcommands/remove.ts similarity index 96% rename from src/interactions/commands/player/remove.ts rename to src/interactions/slashcommands/remove.ts index a0965e4..9d1fcc9 100644 --- a/src/interactions/commands/player/remove.ts +++ b/src/interactions/slashcommands/remove.ts @@ -1,13 +1,13 @@ import { GuildQueue, Track, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; import { TFunction } from 'i18next'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; +import { formatSlashCommand } from '../../common/formattingUtils'; class RemoveCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/seek.ts b/src/interactions/slashcommands/seek.ts similarity index 95% rename from src/interactions/commands/player/seek.ts rename to src/interactions/slashcommands/seek.ts index 069e6e1..362c795 100644 --- a/src/interactions/commands/player/seek.ts +++ b/src/interactions/slashcommands/seek.ts @@ -1,13 +1,13 @@ import { GuildQueue, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, Message, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { formatSlashCommand } from '../../common/formattingUtils'; class SeekCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/system/shards.ts b/src/interactions/slashcommands/shards.ts similarity index 96% rename from src/interactions/commands/system/shards.ts rename to src/interactions/slashcommands/shards.ts index 3b83f0b..30bb2ee 100644 --- a/src/interactions/commands/system/shards.ts +++ b/src/interactions/slashcommands/shards.ts @@ -5,12 +5,12 @@ import { EmbedFooterData, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { ExtendedClient } from '../../../types/clientTypes'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes'; -import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { ExtendedClient } from '../../types/clientTypes'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../types/interactionTypes'; +import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; import { Logger } from 'pino'; -import { localizeCommand } from '../../../common/localeUtil'; +import { localizeCommand } from '../../common/localeUtil'; class ShardsCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/shuffle.ts b/src/interactions/slashcommands/shuffle.ts similarity index 81% rename from src/interactions/commands/player/shuffle.ts rename to src/interactions/slashcommands/shuffle.ts index 6880875..8520d36 100644 --- a/src/interactions/commands/player/shuffle.ts +++ b/src/interactions/slashcommands/shuffle.ts @@ -1,11 +1,11 @@ import { GuildQueue, useQueue } from 'discord-player'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueEmpty, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueEmpty, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; +import { formatSlashCommand } from '../../common/formattingUtils'; class ShuffleCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/skip.ts b/src/interactions/slashcommands/skip.ts similarity index 94% rename from src/interactions/commands/player/skip.ts rename to src/interactions/slashcommands/skip.ts index 9752ac7..32a7f33 100644 --- a/src/interactions/commands/player/skip.ts +++ b/src/interactions/slashcommands/skip.ts @@ -1,13 +1,13 @@ import { GuildQueue, Track, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueCurrentTrack, checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; -import { formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils'; +import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils'; class SkipCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/info/status.ts b/src/interactions/slashcommands/status.ts similarity index 91% rename from src/interactions/commands/info/status.ts rename to src/interactions/slashcommands/status.ts index 1f51ca2..5d1d514 100644 --- a/src/interactions/commands/info/status.ts +++ b/src/interactions/slashcommands/status.ts @@ -1,5 +1,5 @@ // @ts-ignore -import { version } from '../../../../package.json'; +import { version } from '../../../package.json'; import { APIActionRowComponent, APIButtonComponent, @@ -10,10 +10,10 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; class StatusCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/stop.ts b/src/interactions/slashcommands/stop.ts similarity index 82% rename from src/interactions/commands/player/stop.ts rename to src/interactions/slashcommands/stop.ts index 8458cf5..355ed07 100644 --- a/src/interactions/commands/player/stop.ts +++ b/src/interactions/slashcommands/stop.ts @@ -1,11 +1,11 @@ import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; -import { formatSlashCommand } from '../../../common/formattingUtils'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; +import { formatSlashCommand } from '../../common/formattingUtils'; class StopCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/system/systemstatus.ts b/src/interactions/slashcommands/systemstatus.ts similarity index 90% rename from src/interactions/commands/system/systemstatus.ts rename to src/interactions/slashcommands/systemstatus.ts index 2b088d1..e148bec 100644 --- a/src/interactions/commands/system/systemstatus.ts +++ b/src/interactions/slashcommands/systemstatus.ts @@ -1,11 +1,11 @@ // @ts-ignore -import { dependencies, version } from '../../../../package.json'; +import { dependencies, version } from '../../../package.json'; import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkValidGuildId } from '../../utils/validation/systemCommandValidator'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; class SystemStatusCommand extends BaseSlashCommandInteraction { constructor() { diff --git a/src/interactions/commands/player/volume.ts b/src/interactions/slashcommands/volume.ts similarity index 93% rename from src/interactions/commands/player/volume.ts rename to src/interactions/slashcommands/volume.ts index 0a5efdc..3c8307d 100644 --- a/src/interactions/commands/player/volume.ts +++ b/src/interactions/slashcommands/volume.ts @@ -1,11 +1,11 @@ import { GuildQueue, useQueue } from 'discord-player'; import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; -import { BaseSlashCommandInteraction } from '../../../classes/interactions'; -import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes'; -import { checkQueueExists } from '../../../utils/validation/queueValidator'; -import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator'; +import { BaseSlashCommandInteraction } from '../../classes/interactions'; +import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes'; +import { checkQueueExists } from '../../utils/validation/queueValidator'; +import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator'; import { Logger } from 'pino'; -import { localizeCommand, useServerTranslator } from '../../../common/localeUtil'; +import { localizeCommand, useServerTranslator } from '../../common/localeUtil'; import { TFunction } from 'i18next'; class VolumeCommand extends BaseSlashCommandInteraction { diff --git a/src/tests/help.test.ts b/src/tests/help.test.ts index 6b74448..a74f1fa 100644 --- a/src/tests/help.test.ts +++ b/src/tests/help.test.ts @@ -1,4 +1,4 @@ -import helpCommand from '../interactions/commands/info/help'; +import helpCommand from '../interactions/slashcommands/help'; import { SlashCommandNumberOption } from 'discord.js'; import { BaseSlashCommandInteraction } from '../classes/interactions'; diff --git a/src/utils/deploySlashCommands.ts b/src/utils/deploySlashCommands.ts index 9090f5b..77dff7e 100644 --- a/src/utils/deploySlashCommands.ts +++ b/src/utils/deploySlashCommands.ts @@ -20,7 +20,6 @@ const logger: Logger = loggerModule.child({ const userSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = []; const systemSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = []; -const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands')); if (!process.env.DISCORD_BOT_TOKEN) { throw new Error('DISCORD_BOT_TOKEN environment variable is not set.'); @@ -40,18 +39,16 @@ const rest: REST = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_ process.exit(1); } - for (const folder of commandFolders) { - const commandFiles: string[] = fs - .readdirSync(path.resolve(`./dist/interactions/commands/${folder}`)) - .filter((file) => file.endsWith('.js')); + const commandFiles: string[] = fs + .readdirSync(path.resolve('./dist/interactions/slashcommands')) + .filter((file) => file.endsWith('.js')); - for (const file of commandFiles) { - const { default: command } = await import(`../interactions/commands/${folder}/${file}`); - const slashCommand = command as BaseSlashCommandInteraction; - slashCommand.isSystemCommand - ? systemSlashCommands.push(slashCommand.data.toJSON()) - : userSlashCommands.push(slashCommand.data.toJSON()); - } + for (const file of commandFiles) { + const { default: command } = await import(`../interactions/slashcommands/${file}`); + const slashCommand = command as BaseSlashCommandInteraction; + slashCommand.isSystemCommand + ? systemSlashCommands.push(slashCommand.data.toJSON()) + : userSlashCommands.push(slashCommand.data.toJSON()); } try { diff --git a/src/utils/registerClientInteractions.ts b/src/utils/registerClientInteractions.ts index e8df56f..149a3b2 100644 --- a/src/utils/registerClientInteractions.ts +++ b/src/utils/registerClientInteractions.ts @@ -25,35 +25,28 @@ async function registerSlashCommandInteractions(logger: Logger, client: Extended logger.debug('Registering client slash command interactions...'); client.slashCommandInteractions = new Collection(); - const baseFolderPath = './dist/interactions/commands'; - const slashCommandInteractionFolders: string[] = fs.readdirSync(path.resolve(baseFolderPath)); + const basePath = './dist/interactions/slashcommands'; - for (const categoryFolder of slashCommandInteractionFolders) { - logger.trace(`Registering client commands for folder '${categoryFolder}'...`); + logger.trace('Registering client commands...'); - const files: string[] = fs - .readdirSync(path.resolve(`${baseFolderPath}/${categoryFolder}`)) - .filter((file) => file.endsWith('.js')); + const files: string[] = fs.readdirSync(path.resolve(`${basePath}`)).filter((file) => file.endsWith('.js')); - for (const file of files) { - try { - const filePath = path.resolve(`${baseFolderPath}/${categoryFolder}/${file}`); + for (const file of files) { + try { + const filePath = path.resolve(`${basePath}/${file}`); - // delete require cache for file - delete require.cache[filePath]; + // delete require cache for file + delete require.cache[filePath]; - // import and register to client collection - const { default: slashCommandInteraction } = await import(filePath); - client.slashCommandInteractions.delete(slashCommandInteraction.name); - client.slashCommandInteractions.set(slashCommandInteraction.name, slashCommandInteraction); - } catch (error) { - if (error instanceof Error) { - logger.error( - `Error registering slash command interaction '${categoryFolder}/${file}': ${error.message}` - ); - } else { - throw error; - } + // import and register to client collection + const { default: slashCommandInteraction } = await import(filePath); + client.slashCommandInteractions.delete(slashCommandInteraction.name); + client.slashCommandInteractions.set(slashCommandInteraction.name, slashCommandInteraction); + } catch (error) { + if (error instanceof Error) { + logger.error(`Error registering slash command interaction '${file}': ${error.message}`); + } else { + throw error; } } }