diff options
Diffstat (limited to 'commands')
| -rw-r--r-- | commands/join.js | 1 | ||||
| -rw-r--r-- | commands/leave.js | 1 | ||||
| -rw-r--r-- | commands/next.js | 1 | ||||
| -rw-r--r-- | commands/pause.js | 1 | ||||
| -rw-r--r-- | commands/play.js | 1 | ||||
| -rw-r--r-- | commands/previous.js | 1 | ||||
| -rw-r--r-- | commands/reshuffle.js | 5 | ||||
| -rw-r--r-- | commands/status.js | 1 |
8 files changed, 10 insertions, 2 deletions
diff --git a/commands/join.js b/commands/join.js index c5f686d..aa3eb66 100644 --- a/commands/join.js +++ b/commands/join.js @@ -29,6 +29,7 @@ export default { .setDescription('Joins voice chat') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); await interaction.reply({ content: 'Joining voice channel', ephemeral: true }); return await voiceInit(bot); } diff --git a/commands/leave.js b/commands/leave.js index 781bc0a..1577baa 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -29,6 +29,7 @@ export default { .setDescription('Leaves the voice chat') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); console.log('Leaving voice channel...'); await destroyAudio(interaction); return await interaction.reply({ content: 'Leaving voice channel', ephemeral: true }); diff --git a/commands/next.js b/commands/next.js index b507cd1..88dac40 100644 --- a/commands/next.js +++ b/commands/next.js @@ -30,6 +30,7 @@ export default { .setDescription('Goes to next music') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); await interaction.reply({ content: 'Playing next music', ephemeral: true }); player.stop(); return await nextAudio(bot); diff --git a/commands/pause.js b/commands/pause.js index d5d8edc..c467675 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -29,6 +29,7 @@ export default { .setDescription('Pauses music') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); if (isAudioStatePaused === false) { toggleAudioState(); return await interaction.reply({ content: 'Pausing music', ephemeral: true }); diff --git a/commands/play.js b/commands/play.js index fd8132c..3b226ec 100644 --- a/commands/play.js +++ b/commands/play.js @@ -38,6 +38,7 @@ export default { .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); integer = interaction.options.getInteger('int'); if (integer) { if (integer < files.length) { diff --git a/commands/previous.js b/commands/previous.js index 6d5eff3..66c1930 100644 --- a/commands/previous.js +++ b/commands/previous.js @@ -29,6 +29,7 @@ export default { .setDescription('Goes to previous music') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); return await previousAudio(bot, interaction); } }; diff --git a/commands/reshuffle.js b/commands/reshuffle.js index 517c272..f60bb1c 100644 --- a/commands/reshuffle.js +++ b/commands/reshuffle.js @@ -20,10 +20,10 @@ ***************************************************************************/ import { SlashCommandBuilder } from 'discord.js'; -import { player } from '../backend/VoiceInitialization.js'; import { shufflePlaylist } from '../backend/QueueSystem.js'; import { PermissionFlagsBits } from 'discord-api-types/v10'; import { readFileSync } from 'node:fs'; +import { audioState } from '../backend/AudioControl.js'; // import config from './config.json' assert {type: 'json'} const { shuffle } = JSON.parse(readFileSync('./config.json', 'utf-8')); @@ -33,9 +33,10 @@ export default { .setDescription('Reshuffles the playlist') .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); async function shuffleDetected(bot) { await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true }); - player.stop(); + await audioState(2); await shufflePlaylist(bot); } return (shuffle === true) ? await shuffleDetected(bot) : await interaction.reply({ content: 'Shuffle mode is disabled, enable it in the configuration file to access this command.', ephemeral: true }); diff --git a/commands/status.js b/commands/status.js index 3143e16..cf49509 100644 --- a/commands/status.js +++ b/commands/status.js @@ -29,6 +29,7 @@ export default { .setName('status') .setDescription('Checks what audio file is playing currently'), async execute(interaction, bot) { + if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true }); let audioID = currentTrack; audioID++; |
