fix: use new runValidators format on components

This commit is contained in:
Marius Begby committed 2023-09-10 18:29:44 +02:00
1 parent ae392f1a11
commit 74c1447e7d
3 files changed
+16 -22

No files matched your search

@@ -8,12 +8,6 @@ import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validati
class FiltersDisableButtonComponent extends BaseComponentInteraction {
constructor() {
super('filters-disable-button');
this.validators = [
(args) => checkInVoiceChannel(args),
(args) => checkSameVoiceChannel(args),
(args) => checkQueueExists(args)
];
}
async execute(params: BaseComponentParams): BaseComponentReturnType {
@@ -22,7 +16,11 @@ class FiltersDisableButtonComponent extends BaseComponentInteraction {
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
await this.runValidators({ interaction, queue, executionId });
await this.runValidators({ interaction, queue, executionId }, [
checkInVoiceChannel,
checkSameVoiceChannel,
checkQueueExists
]);
// Reset filters before enabling provided filters
if (queue.filters.ffmpeg.filters.length > 0) {
@@ -12,12 +12,6 @@ const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions
class FiltersSelectMenuComponent extends BaseComponentInteraction {
constructor() {
super('filters-select-menu');
this.validators = [
(args) => checkInVoiceChannel(args),
(args) => checkSameVoiceChannel(args),
(args) => checkQueueExists(args)
];
}
async execute(params: BaseComponentParams): BaseComponentReturnType {
@@ -29,7 +23,11 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
const selectMenuInteraction: StringSelectMenuInteraction = interaction as StringSelectMenuInteraction;
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
await this.runValidators({ interaction, queue, executionId });
await this.runValidators({ interaction, queue, executionId }, [
checkInVoiceChannel,
checkSameVoiceChannel,
checkQueueExists
]);
queue.filters.ffmpeg.setInputArgs([
'-threads',
@@ -8,13 +8,6 @@ import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validati
class NowplayingSkipButton extends BaseComponentInteraction {
constructor() {
super('nowplaying-skip-button');
this.validators = [
(args) => checkInVoiceChannel(args),
(args) => checkSameVoiceChannel(args),
(args) => checkQueueExists(args),
(args) => checkQueueCurrentTrack(args)
];
}
async execute(params: BaseComponentParams): BaseComponentReturnType {
@@ -23,7 +16,12 @@ class NowplayingSkipButton extends BaseComponentInteraction {
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
await this.runValidators({ interaction, queue, executionId });
await this.runValidators({ interaction, queue, executionId }, [
checkInVoiceChannel,
checkSameVoiceChannel,
checkQueueExists,
checkQueueCurrentTrack
]);
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
logger.debug('Tried skipping track but there was no queue.');