mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
fix: use new runValidators format on components
This commit is contained in:
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.');
|
||||
|
||||
Reference in new issue
Block a user