mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
fix: separated types and classes
This commit is contained in:
1 parent
6dcddee2e9
commit
ea32ae6c61
42 files changed
+234
-296
No files matched your search
@@ -1,13 +1,10 @@
|
||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||
import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
||||
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
||||
import {
|
||||
BaseAutocompleteInteraction,
|
||||
BaseAutocompleteParams,
|
||||
BaseAutocompleteReturnType
|
||||
} from '../../types/interactionTypes';
|
||||
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
|
||||
import { BaseAutocompleteInteraction } from '../../classes/interactions';
|
||||
|
||||
// TODO: create interface for recent query object
|
||||
// TODO: create type for recent query object
|
||||
const recentQueries = new Map();
|
||||
|
||||
class LyricsAutocomplete extends BaseAutocompleteInteraction {
|
||||
@@ -34,7 +31,7 @@ class LyricsAutocomplete extends BaseAutocompleteInteraction {
|
||||
|
||||
const genius = lyricsExtractor();
|
||||
const lyricsResult: LyricsData = (await genius.search(query).catch(() => null)) as LyricsData;
|
||||
// TODO: Update TS Type for lyricsResult and create response object interface
|
||||
// TODO: Update TS Type for lyricsResult and create response object type
|
||||
let response: ApplicationCommandOptionChoiceData<string>[] = [];
|
||||
|
||||
if (!lyricsResult) {
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
||||
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
||||
import {
|
||||
BaseAutocompleteInteraction,
|
||||
BaseAutocompleteParams,
|
||||
BaseAutocompleteReturnType
|
||||
} from '../../types/interactionTypes';
|
||||
import { BaseAutocompleteParams, BaseAutocompleteReturnType } from '../../types/interactionTypes';
|
||||
import { BaseAutocompleteInteraction } from '../../classes/interactions';
|
||||
|
||||
// TODO: create interface for recent query object
|
||||
// TODO: create type for recent query object
|
||||
const recentQueries = new Map();
|
||||
|
||||
class PlayAutocomplete extends BaseAutocompleteInteraction {
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
|
||||
class HelpCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('help')
|
||||
.setDescription('Show the list of bot commands.');
|
||||
const data = new SlashCommandBuilder().setName('help').setDescription('Show the list of bot commands.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import osu from 'node-os-utils';
|
||||
// @ts-ignore
|
||||
import { version } from '../../../../package.json';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||
|
||||
class StatusCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -14,11 +14,8 @@ import {
|
||||
StringSelectMenuOptionBuilder
|
||||
} from 'discord.js';
|
||||
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -26,9 +23,7 @@ const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions
|
||||
|
||||
class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('filters')
|
||||
.setDescription('Toggle various audio filters.');
|
||||
const data = new SlashCommandBuilder().setName('filters').setDescription('Toggle various audio filters.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -11,12 +11,8 @@ import {
|
||||
SlashCommandBuilder
|
||||
} from 'discord.js';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
TrackMetadata
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -36,7 +32,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
// TODO: define TS type/interface for validators
|
||||
// TODO: define TS type for validators
|
||||
const validators = [
|
||||
() => notInVoiceChannel({ interaction, executionId }),
|
||||
() => notInSameVoiceChannel({ interaction, queue, executionId }),
|
||||
@@ -128,6 +124,13 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
|
||||
const getRepeatModeMessage = (repeatMode: number): string => {
|
||||
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplay : this.embedOptions.icons.loop;
|
||||
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n`;
|
||||
};
|
||||
|
||||
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
|
||||
|
||||
logger.debug('Successfully retrieved information about the current track.');
|
||||
|
||||
logger.debug('Sending info embed with action row components.');
|
||||
@@ -145,15 +148,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
`**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` +
|
||||
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
||||
`\n ${bar}\n\n` +
|
||||
`${
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `**${
|
||||
queue.repeatMode === 3
|
||||
? this.embedOptions.icons.autoplay
|
||||
: this.embedOptions.icons.loop
|
||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
`${repeatModeString}`
|
||||
)
|
||||
.addFields(
|
||||
{
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction, CustomError } from '../../../classes/interactions';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
CustomError
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||
|
||||
class QueueCommand extends BaseSlashCommandInteraction {
|
||||
@@ -97,13 +93,12 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
|
||||
const repeatModeString: string = `${
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `**${
|
||||
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
|
||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n`
|
||||
}`;
|
||||
const getRepeatModeMessage = (repeatMode: number): string => {
|
||||
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplay : this.embedOptions.icons.loop;
|
||||
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.\n\n`;
|
||||
};
|
||||
|
||||
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
|
||||
|
||||
if (!currentTrack) {
|
||||
logger.debug('Queue exists but there is no current track.');
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -14,10 +11,7 @@ class SeekCommand extends BaseSlashCommandInteraction {
|
||||
.setName('seek')
|
||||
.setDescription('Seek to a duration in the current track.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('duration')
|
||||
.setDescription('Duration in format 00:00:00 (HH:mm:ss).')
|
||||
.setRequired(true)
|
||||
option.setName('duration').setDescription('Duration in format 00:00:00 (HH:mm:ss).').setRequired(true)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -134,6 +131,13 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
|
||||
const getRepeatModeMessage = (repeatMode: number): string => {
|
||||
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplaying : this.embedOptions.icons.looping;
|
||||
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`;
|
||||
};
|
||||
|
||||
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
@@ -153,16 +157,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` +
|
||||
`${
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `\n\n**${
|
||||
queue.repeatMode === 3
|
||||
? this.embedOptions.icons.autoplaying
|
||||
: this.embedOptions.icons.looping
|
||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` + `\n\n${repeatModeString}`
|
||||
)
|
||||
.setThumbnail(skippedTrack.thumbnail)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class GuildsCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
ShardInfo
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -2,11 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import osu from 'node-os-utils';
|
||||
// @ts-ignore
|
||||
import { dependencies, version } from '../../../../package.json';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import config from 'config';
|
||||
import { GuildQueue, QueueFilters, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.js';
|
||||
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
|
||||
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
import { BaseComponentInteraction, BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentParams, BaseComponentReturnType } from '../../types/interactionTypes';
|
||||
import { BaseComponentInteraction } from '../../classes/interactions';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
|
||||
@@ -79,7 +80,14 @@ class NowplayingSkipButton extends BaseComponentInteraction {
|
||||
[3, 'autoplay']
|
||||
]);
|
||||
|
||||
const repeatModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
const loopModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
|
||||
const getRepeatModeMessage = (repeatMode: number): string => {
|
||||
const icon = repeatMode === 3 ? this.embedOptions.icons.autoplaying : this.embedOptions.icons.looping;
|
||||
return `**${icon} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`;
|
||||
};
|
||||
|
||||
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
@@ -100,16 +108,7 @@ class NowplayingSkipButton extends BaseComponentInteraction {
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` +
|
||||
`${
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `\n\n**${
|
||||
queue.repeatMode === 3
|
||||
? this.embedOptions.icons.autoplaying
|
||||
: this.embedOptions.icons.looping
|
||||
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` + `\n\n${repeatModeString}`
|
||||
)
|
||||
.setThumbnail(skippedTrack.thumbnail)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
|
||||
Reference in new issue
Block a user