mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
fix: Update validators with new types
This commit is contained in:
1 parent
af6bdd4da8
commit
e67d0004b0
7 files changed
+39
-73
No files matched your search
@@ -40,8 +40,14 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
{ name: 'Disable', value: 'disable' }
|
||||
)
|
||||
);
|
||||
|
||||
super(data);
|
||||
|
||||
this.validators = [
|
||||
(args) => notInVoiceChannel(args),
|
||||
(args) => notInSameVoiceChannel(args),
|
||||
(args) => queueDoesNotExist(args),
|
||||
(args) => queueNoCurrentTrack(args)
|
||||
];
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
@@ -50,18 +56,9 @@ class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
const validators = [
|
||||
() => notInVoiceChannel({ interaction, executionId }),
|
||||
() => notInSameVoiceChannel({ interaction, queue, executionId }),
|
||||
() => queueDoesNotExist({ interaction, queue, executionId }),
|
||||
() => queueNoCurrentTrack({ interaction, queue, executionId })
|
||||
];
|
||||
|
||||
for (const validator of validators) {
|
||||
if (await validator()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
await this.runValidators({ interaction, queue, executionId }).catch(() => {
|
||||
return;
|
||||
});
|
||||
|
||||
const filterProvider: string = interaction.options.getString('type') || 'ffmpeg';
|
||||
|
||||
|
||||
Reference in new issue
Block a user