diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 17:54:56 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2022-12-20 18:05:51 -0500 |
| commit | e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7 (patch) | |
| tree | 96c04baa3f064a160a595a0faf73696cc5cf8eaa /Commands/pause.js | |
| parent | 239b254760381946f57d6cbccb077f5341ca2f30 (diff) | |
| download | DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.gz DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.tar.bz2 DLAP-e5c86859e4c6a9a6829bcc2e3cf626b05a873ff7.zip | |
Revamped next/previous cmds (Voting system); Basic i18n support;
Diffstat (limited to 'Commands/pause.js')
| -rw-r--r-- | Commands/pause.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Commands/pause.js b/Commands/pause.js index e461a4c..51376cd 100644 --- a/Commands/pause.js +++ b/Commands/pause.js @@ -22,14 +22,16 @@ import { SlashCommandBuilder } from 'discord.js'; import { toggleAudioState, isAudioStatePaused } from '../AudioBackend/AudioControl.js'; import { PermissionFlagsBits } from 'discord-api-types/v10'; - +import { readFileSync } from 'node:fs'; +const { djRole } = JSON.parse(readFileSync('./config.json', 'utf-8')); export default { data: new SlashCommandBuilder() .setName('pause') - .setDescription('Pauses music') - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), - async execute(interaction) { + .setDescription('Pauses music'), + 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 }); + if (!isAudioStatePaused) { toggleAudioState(); return await interaction.reply({ content: 'Pausing music', ephemeral: true }); |
