mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
feat: added equalizer filters to /filters command
This commit is contained in:
1 parent
ebe20fe8c8
commit
9584fe8ebe
4 files changed
+213
-38
No files matched your search
@@ -17,13 +17,19 @@ import {
|
||||
} from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BiquadFilterOptions, FFmpegFilterOptions, FilterOption } from '../../../types/configTypes';
|
||||
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';
|
||||
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
const biquadFilterOptions: BiquadFilterOptions = config.get('biquadFilterOptions');
|
||||
const equalizerFilterOptions: EqualizerFilterOptions = config.get('equalizerFilterOptions');
|
||||
|
||||
class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -66,9 +72,7 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
case 'biquad':
|
||||
return await this.handleBiquadFilters(logger, interaction, queue);
|
||||
case 'equalizer':
|
||||
// TODO: implement
|
||||
logger.debug('Handling equalizer filters.');
|
||||
return await this.tempNotImplementedResponse(logger, interaction);
|
||||
return await this.handleEqualizerFilters(logger, interaction);
|
||||
case 'disable':
|
||||
return await this.disableAllFiltersAndRespondWithSuccess(logger, interaction, queue);
|
||||
}
|
||||
@@ -129,6 +133,24 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
return await this.sendFiltersEmbed(logger, interaction, 'biquad', filterOptions);
|
||||
}
|
||||
|
||||
private async handleEqualizerFilters(logger: Logger, interaction: ChatInputCommandInteraction): Promise<Message> {
|
||||
logger.debug('Handling biquad filters.');
|
||||
const filterOptions: StringSelectMenuOptionBuilder[] = [];
|
||||
|
||||
equalizerFilterOptions.availableFilters.forEach((filter: FilterOption) => {
|
||||
filterOptions.push(
|
||||
new StringSelectMenuOptionBuilder()
|
||||
.setLabel(filter.label)
|
||||
.setDescription(filter.description)
|
||||
.setValue(filter.value)
|
||||
.setEmoji(filter.emoji)
|
||||
.setDefault(false)
|
||||
);
|
||||
});
|
||||
|
||||
return await this.sendFiltersEmbed(logger, interaction, 'equalizer', filterOptions);
|
||||
}
|
||||
|
||||
private async sendFiltersEmbed(
|
||||
logger: Logger,
|
||||
interaction: ChatInputCommandInteraction,
|
||||
@@ -218,24 +240,6 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
components: []
|
||||
});
|
||||
}
|
||||
|
||||
private async tempNotImplementedResponse(
|
||||
logger: Logger,
|
||||
interaction: ChatInputCommandInteraction
|
||||
): Promise<Message> {
|
||||
logger.debug('Responding with info embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.bot} Coming soon**\n` +
|
||||
'This functionality has not yet been implemented, and will be available soon.'
|
||||
)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
],
|
||||
components: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new FiltersCommand();
|
||||
Reference in new issue
Block a user