aboutsummaryrefslogtreecommitdiff
path: root/commands/reshuffle.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-11 23:14:58 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-11 23:14:58 -0400
commit1cd0056d71ab84421b40538ff7b0bb76a2e6a766 (patch)
tree2aa0f2334d68cf3ed8809ce82b87e55b90fd4776 /commands/reshuffle.js
parenteb90e1a4ffbe5f0b82bea296a97786ca5cc81041 (diff)
downloadDLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.tar.gz
DLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.tar.bz2
DLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.zip
Fully implemented order playlist
Diffstat (limited to 'commands/reshuffle.js')
-rw-r--r--commands/reshuffle.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/commands/reshuffle.js b/commands/reshuffle.js
index 162a52e..e4e6745 100644
--- a/commands/reshuffle.js
+++ b/commands/reshuffle.js
@@ -22,6 +22,9 @@
import { SlashCommandBuilder } from '@discordjs/builders';
import { player, shufflePlaylist } from '../AudioBackend.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
+import { readFileSync } from 'node:fs';
+// import config from './config.json' assert {type: 'json'}
+const { shuffle } = JSON.parse(readFileSync('./config.json'));
export default {
data: new SlashCommandBuilder()
@@ -29,8 +32,11 @@ export default {
.setDescription('Reshuffles the playlist')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction, bot) {
- await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true });
- player.stop();
- return await shufflePlaylist(bot);
+ async function shuffleDetected(bot) {
+ await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true });
+ player.stop();
+ await shufflePlaylist(bot);
+ }
+ return (shuffle === true) ? await shuffleDetected(bot) : await interaction.reply({ content: 'Shuffle mode is disabled, enable it on the configuration to access this command.', ephemeral: true });
}
};