aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/next.js12
-rw-r--r--commands/pause.js2
-rw-r--r--commands/previous.js8
-rw-r--r--commands/reshuffle.js2
-rw-r--r--commands/status.js4
5 files changed, 18 insertions, 10 deletions
diff --git a/commands/next.js b/commands/next.js
index 88dac40..759c5bb 100644
--- a/commands/next.js
+++ b/commands/next.js
@@ -21,7 +21,7 @@
import { SlashCommandBuilder } from 'discord.js';
import { player } from '../backend/VoiceInitialization.js';
-import { nextAudio } from '../backend/AudioControl.js';
+import { nextAudio, playerState } from '../backend/AudioControl.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
export default {
@@ -31,8 +31,12 @@ 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 });
- await interaction.reply({ content: 'Playing next music', ephemeral: true });
- player.stop();
- return await nextAudio(bot);
+ if (playerState === 'Playing' || playerState === 'Paused') {
+ await interaction.reply({ content: 'Playing next music', ephemeral: true });
+ player.stop();
+ return await nextAudio(bot);
+ } else if (playerState === 'Stopped') {
+ return await interaction.reply({ content: 'Cannot play next music. Player is currently stopped...', ephemeral: true });
+ }
}
};
diff --git a/commands/pause.js b/commands/pause.js
index c467675..61b9e21 100644
--- a/commands/pause.js
+++ b/commands/pause.js
@@ -30,7 +30,7 @@ export default {
.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) {
+ if (!isAudioStatePaused) {
toggleAudioState();
return await interaction.reply({ content: 'Pausing music', ephemeral: true });
} else {
diff --git a/commands/previous.js b/commands/previous.js
index 66c1930..ebedbb6 100644
--- a/commands/previous.js
+++ b/commands/previous.js
@@ -20,7 +20,7 @@
***************************************************************************/
import { SlashCommandBuilder } from 'discord.js';
-import { previousAudio } from '../backend/AudioControl.js';
+import { playerState, previousAudio } from '../backend/AudioControl.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
export default {
@@ -30,6 +30,10 @@ 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 });
- return await previousAudio(bot, interaction);
+ if (playerState === 'Playing' || playerState === 'Paused') {
+ return await previousAudio(bot, interaction);
+ } else if (playerState === 'Stopped') {
+ return await interaction.reply({ content: 'Cannot play next music. Player is currently stopped...', ephemeral: true });
+ }
}
};
diff --git a/commands/reshuffle.js b/commands/reshuffle.js
index f60bb1c..e1d37d0 100644
--- a/commands/reshuffle.js
+++ b/commands/reshuffle.js
@@ -39,6 +39,6 @@ export default {
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 });
+ return (shuffle) ? 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 cf49509..d19e4ac 100644
--- a/commands/status.js
+++ b/commands/status.js
@@ -38,7 +38,7 @@ export default {
if (audioName === undefined) {
audioName = 'Playlist Finished';
} else {
- if (metadataEmpty === false) {
+ if (!metadataEmpty) {
try {
const { common } = await parseFile('music/' + audioName);
audioName = common.title;
@@ -59,7 +59,7 @@ export default {
)
.setColor('#0066ff');
- if (metadataEmpty === true) {
+ if (metadataEmpty) {
controlEmbed.addFields(
{ name: 'Currently Playing', value: audio },
{ name: 'Up Next', value: audioName }