aboutsummaryrefslogtreecommitdiff
path: root/Commands/play.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-12-20 17:54:56 -0500
committerAndrew Lee <alee14498@protonmail.com>2022-12-20 18:05:51 -0500
commite5c86859e4c6a9a6829bcc2e3cf626b05a873ff7 (patch)
tree96c04baa3f064a160a595a0faf73696cc5cf8eaa /Commands/play.js
parent239b254760381946f57d6cbccb077f5341ca2f30 (diff)
downloadDLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.gz
DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.bz2
DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.zip
Revamped next/previous cmds (Voting system); Basic i18n support;
Diffstat (limited to 'Commands/play.js')
-rw-r--r--Commands/play.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/Commands/play.js b/Commands/play.js
index a0af3f3..49f0d3e 100644
--- a/Commands/play.js
+++ b/Commands/play.js
@@ -24,6 +24,10 @@ import { inputAudio } from '../AudioBackend/QueueSystem.js';
import { files, isAudioStatePaused, toggleAudioState } from '../AudioBackend/AudioControl.js';
import { audio } from '../AudioBackend/PlayAudio.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
+import { readFileSync } from 'node:fs';
+import { votes } from '../Utilities/Voting.js';
+
+const { djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8'));
export let integer;
@@ -34,15 +38,17 @@ export default {
.addIntegerOption(option =>
option.setName('int')
.setDescription('Input a number for the selection for the audio file.')
- )
- .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 });
+ if (!interaction.member.roles.cache.has(djRole) && interaction.user.id !== ownerID && !interaction.member.permission.has(PermissionFlagsBits.ManageGuild)) return interaction.reply({ content: 'You need a specific role to execute this command', ephemeral: true });
+
integer = interaction.options.getInteger('int');
if (integer) {
if (integer < files.length) {
await inputAudio(bot, integer);
+ await votes.clear();
return await interaction.reply({ content: `Now playing: ${audio}`, ephemeral: true });
} else {
return await interaction.reply({ content: 'Number is too big, choose a number that\'s less than ' + files.length + '.', ephemeral: true });