mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
fix: update validation in interactions
This commit is contained in:
1 parent
37546405e2
commit
5bc0239cdf
17 files changed
+162
-217
No files matched your search
@@ -47,21 +47,19 @@ const command: CustomSlashCommandInteraction = {
|
||||
let geniusSearchQuery = '';
|
||||
|
||||
if (!query) {
|
||||
if (await notInVoiceChannel({ interaction, executionId })) {
|
||||
return;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (await queueDoesNotExist({ interaction, queue, executionId })) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await notInSameVoiceChannel({ interaction, queue, executionId })) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await queueNoCurrentTrack({ interaction, queue, executionId })) {
|
||||
return;
|
||||
}
|
||||
geniusSearchQuery = queue.currentTrack!.title.slice(0, 50);
|
||||
|
||||
logger.debug(
|
||||
|
||||
Reference in new issue
Block a user