mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
organize command files into one folder
This commit is contained in:
1 parent
e85cd4dfc2
commit
676c915e6e
26 files changed
+139
-149
No files matched your search
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class BackCommand extends BaseSlashCommandInteraction {
|
class BackCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+6
-6
@@ -16,17 +16,17 @@ 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 '../../classes/interactions';
|
||||||
import {
|
import {
|
||||||
BiquadFilterOptions,
|
BiquadFilterOptions,
|
||||||
EqualizerFilterOptions,
|
EqualizerFilterOptions,
|
||||||
FFmpegFilterOptions,
|
FFmpegFilterOptions,
|
||||||
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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
@@ -13,10 +13,10 @@ import {
|
|||||||
SlashCommandNumberOption,
|
SlashCommandNumberOption,
|
||||||
SlashCommandStringOption
|
SlashCommandStringOption
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../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/localeUtil';
|
||||||
import { ExtendedClient } from '../../../types/clientTypes';
|
import { ExtendedClient } from '../../types/clientTypes';
|
||||||
|
|
||||||
class HelpCommand extends BaseSlashCommandInteraction {
|
class HelpCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+6
-6
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkHistoryExists } from '../../../utils/validation/queueValidator';
|
import { checkHistoryExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class HistoryCommand extends BaseSlashCommandInteraction {
|
class HistoryCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class JoinCommand extends BaseSlashCommandInteraction {
|
class JoinCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class LeaveCommand extends BaseSlashCommandInteraction {
|
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatMode } from '../../../common/formattingUtils';
|
import { formatRepeatMode } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class LoopCommand extends BaseSlashCommandInteraction {
|
class LoopCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+5
-5
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class LyricsCommand extends BaseSlashCommandInteraction {
|
class LyricsCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class MoveCommand extends BaseSlashCommandInteraction {
|
class MoveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+6
-6
@@ -10,13 +10,13 @@ import {
|
|||||||
EmbedField,
|
EmbedField,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed } from '../../../common/formattingUtils';
|
import { formatRepeatModeDetailed } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
|
|
||||||
class PauseCommand extends BaseSlashCommandInteraction {
|
class PauseCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator';
|
import { checkVoicePermissionJoinAndTalk } from '../../utils/validation/permissionValidator';
|
||||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../utils/validation/searchQueryValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class PlayCommand extends BaseSlashCommandInteraction {
|
class PlayCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatDuration, formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class QueueCommand extends BaseSlashCommandInteraction {
|
class QueueCommand extends BaseSlashCommandInteraction {
|
||||||
+5
-5
@@ -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 '../../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 '../../utils/validation/systemCommandValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class ReloadCommand extends BaseSlashCommandInteraction {
|
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||||
+6
-6
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/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/localeUtil';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class RemoveCommand extends BaseSlashCommandInteraction {
|
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class SeekCommand extends BaseSlashCommandInteraction {
|
class SeekCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+5
-5
@@ -5,12 +5,12 @@ import {
|
|||||||
EmbedFooterData,
|
EmbedFooterData,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../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 '../../utils/validation/systemCommandValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand } from '../../../common/localeUtil';
|
import { localizeCommand } from '../../common/localeUtil';
|
||||||
|
|
||||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+6
-6
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class ShuffleCommand extends BaseSlashCommandInteraction {
|
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../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 '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
import { formatRepeatModeDetailed, formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatRepeatModeDetailed, formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class SkipCommand extends BaseSlashCommandInteraction {
|
class SkipCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { version } from '../../../../package.json';
|
import { version } from '../../../package.json';
|
||||||
import {
|
import {
|
||||||
APIActionRowComponent,
|
APIActionRowComponent,
|
||||||
APIButtonComponent,
|
APIButtonComponent,
|
||||||
@@ -10,10 +10,10 @@ import {
|
|||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
||||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
|
|
||||||
class StatusCommand extends BaseSlashCommandInteraction {
|
class StatusCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { formatSlashCommand } from '../../../common/formattingUtils';
|
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||||
|
|
||||||
class StopCommand extends BaseSlashCommandInteraction {
|
class StopCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+6
-6
@@ -1,11 +1,11 @@
|
|||||||
// @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 '../../classes/interactions';
|
||||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
|
|
||||||
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
+5
-5
@@ -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 '../../classes/interactions';
|
||||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||||
import { TFunction } from 'i18next';
|
import { TFunction } from 'i18next';
|
||||||
|
|
||||||
class VolumeCommand extends BaseSlashCommandInteraction {
|
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import helpCommand from '../interactions/commands/info/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 '../classes/interactions';
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const logger: Logger = loggerModule.child({
|
|||||||
|
|
||||||
const userSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
const userSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||||
const systemSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
const systemSlashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||||
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
|
||||||
|
|
||||||
if (!process.env.DISCORD_BOT_TOKEN) {
|
if (!process.env.DISCORD_BOT_TOKEN) {
|
||||||
throw new Error('DISCORD_BOT_TOKEN environment variable is not set.');
|
throw new Error('DISCORD_BOT_TOKEN environment variable is not set.');
|
||||||
@@ -40,19 +39,17 @@ const rest: REST = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const folder of commandFolders) {
|
|
||||||
const commandFiles: string[] = fs
|
const commandFiles: string[] = fs
|
||||||
.readdirSync(path.resolve(`./dist/interactions/commands/${folder}`))
|
.readdirSync(path.resolve('./dist/interactions/slashcommands'))
|
||||||
.filter((file) => file.endsWith('.js'));
|
.filter((file) => file.endsWith('.js'));
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const { default: command } = await import(`../interactions/commands/${folder}/${file}`);
|
const { default: command } = await import(`../interactions/slashcommands/${file}`);
|
||||||
const slashCommand = command as BaseSlashCommandInteraction;
|
const slashCommand = command as BaseSlashCommandInteraction;
|
||||||
slashCommand.isSystemCommand
|
slashCommand.isSystemCommand
|
||||||
? systemSlashCommands.push(slashCommand.data.toJSON())
|
? systemSlashCommands.push(slashCommand.data.toJSON())
|
||||||
: userSlashCommands.push(slashCommand.data.toJSON());
|
: userSlashCommands.push(slashCommand.data.toJSON());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
@@ -25,19 +25,15 @@ async function registerSlashCommandInteractions(logger: Logger, client: Extended
|
|||||||
logger.debug('Registering client slash command interactions...');
|
logger.debug('Registering client slash command interactions...');
|
||||||
client.slashCommandInteractions = new Collection();
|
client.slashCommandInteractions = new Collection();
|
||||||
|
|
||||||
const baseFolderPath = './dist/interactions/commands';
|
const basePath = './dist/interactions/slashcommands';
|
||||||
const slashCommandInteractionFolders: string[] = fs.readdirSync(path.resolve(baseFolderPath));
|
|
||||||
|
|
||||||
for (const categoryFolder of slashCommandInteractionFolders) {
|
logger.trace('Registering client commands...');
|
||||||
logger.trace(`Registering client commands for folder '${categoryFolder}'...`);
|
|
||||||
|
|
||||||
const files: string[] = fs
|
const files: string[] = fs.readdirSync(path.resolve(`${basePath}`)).filter((file) => file.endsWith('.js'));
|
||||||
.readdirSync(path.resolve(`${baseFolderPath}/${categoryFolder}`))
|
|
||||||
.filter((file) => file.endsWith('.js'));
|
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
try {
|
try {
|
||||||
const filePath = path.resolve(`${baseFolderPath}/${categoryFolder}/${file}`);
|
const filePath = path.resolve(`${basePath}/${file}`);
|
||||||
|
|
||||||
// delete require cache for file
|
// delete require cache for file
|
||||||
delete require.cache[filePath];
|
delete require.cache[filePath];
|
||||||
@@ -48,15 +44,12 @@ async function registerSlashCommandInteractions(logger: Logger, client: Extended
|
|||||||
client.slashCommandInteractions.set(slashCommandInteraction.name, slashCommandInteraction);
|
client.slashCommandInteractions.set(slashCommandInteraction.name, slashCommandInteraction);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
logger.error(
|
logger.error(`Error registering slash command interaction '${file}': ${error.message}`);
|
||||||
`Error registering slash command interaction '${categoryFolder}/${file}': ${error.message}`
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logger.trace('Registering client slash command interactions complete.');
|
logger.trace('Registering client slash command interactions complete.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user