mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
fix: Also validate is user is in same voice channel as bot for commands
This commit is contained in:
1 parent
f59055807f
commit
311e141992
14 files changed
+94
-17
No files matched your search
@@ -1,6 +1,6 @@
|
||||
const logger = require('../../services/logger');
|
||||
const { embedOptions, playerOptions, botOptions } = require('../../config');
|
||||
const { notInVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||
const { notInVoiceChannel, notInSameVoiceChannel } = require('../../utils/validation/voiceChannelValidator');
|
||||
const { cannotJoinVoiceOrTalk } = require('../../utils/validation/permissionValidator');
|
||||
const { transformQuery } = require('../../utils/validation/searchQueryValidator');
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
@@ -48,8 +48,8 @@ module.exports = {
|
||||
|
||||
return interaction.respond(response);
|
||||
},
|
||||
execute: async ({ interaction }) => {
|
||||
if (await notInVoiceChannel(interaction)) {
|
||||
execute: async ({ interaction, client }) => {
|
||||
if (await notInVoiceChannel(interaction, client)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
let queue = useQueue(interaction.guild.id);
|
||||
if (queue && (await notInSameVoiceChannel(interaction, queue))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const player = useMainPlayer();
|
||||
const query = interaction.options.getString('query');
|
||||
|
||||
@@ -107,7 +112,7 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
let queue = useQueue(interaction.guild.id);
|
||||
queue = useQueue(interaction.guild.id);
|
||||
let queueSize = queue?.size ?? 0;
|
||||
|
||||
if ((searchResult.playlist && searchResult.tracks.length) > playerOptions.maxQueueSize - queueSize) {
|
||||
|
||||
Reference in new issue
Block a user