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
@@ -28,22 +28,19 @@ const command: CustomSlashCommandInteraction = {
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
|
||||
if (await notInVoiceChannel({ interaction, executionId })) {
|
||||
return;
|
||||
}
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
if (await queueDoesNotExist({ interaction, queue, executionId })) {
|
||||
return;
|
||||
}
|
||||
const validators = [
|
||||
() => notInVoiceChannel({ interaction, executionId }),
|
||||
() => notInSameVoiceChannel({ interaction, queue, executionId }),
|
||||
() => queueDoesNotExist({ interaction, queue, executionId }),
|
||||
() => queueNoCurrentTrack({ interaction, queue, executionId })
|
||||
];
|
||||
|
||||
if (await notInSameVoiceChannel({ interaction, queue, executionId })) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (await queueNoCurrentTrack({ interaction, queue, executionId })) {
|
||||
return;
|
||||
for (const validator of validators) {
|
||||
if (await validator()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const currentTrack = queue.currentTrack!;
|
||||
|
||||
Reference in new issue
Block a user