diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-12-04 01:55:58 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-12-04 01:55:58 -0500 |
| commit | f91f277a30a081cde95805bf39adeb835be98c3f (patch) | |
| tree | 86c3c8c1299dcf33a180c87c16e7d37bade0291f /commands/previous.js | |
| parent | c576ed4e454fe6b4974e7ad873670e3adc9d0a96 (diff) | |
| download | DLAP-f91f277a30a081cde95805bf39adeb835be98c3f.tar.gz DLAP-f91f277a30a081cde95805bf39adeb835be98c3f.tar.bz2 DLAP-f91f277a30a081cde95805bf39adeb835be98c3f.zip | |
Added repeat toggle; Did some optiminizations to the code
Diffstat (limited to 'commands/previous.js')
| -rw-r--r-- | commands/previous.js | 8 |
1 files changed, 6 insertions, 2 deletions
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 }); + } } }; |
