aboutsummaryrefslogtreecommitdiff
path: root/Commands/pause.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-02-17 00:07:31 -0500
committerGitHub <noreply@github.com>2024-02-17 00:07:31 -0500
commit214a83c0f696ac731c54b00bf7503f87e497afa6 (patch)
tree15d57b08e69d19fb4c2f3effb9937aec8d042bdc /Commands/pause.js
parentb29ab06623fd24cfc2a611bdd658b4d2ef934335 (diff)
parentc848f1d90fef40ffa81915d7dd875a2ee6d6c8d5 (diff)
downloadDLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.gz
DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.tar.bz2
DLAP-214a83c0f696ac731c54b00bf7503f87e497afa6.zip
Merge pull request #17 from Alee14/testing
Merging testing branch
Diffstat (limited to 'Commands/pause.js')
-rw-r--r--Commands/pause.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/Commands/pause.js b/Commands/pause.js
index 9e6026c..1d04404 100644
--- a/Commands/pause.js
+++ b/Commands/pause.js
@@ -20,23 +20,29 @@
***************************************************************************/
import { SlashCommandBuilder } from 'discord.js';
-import { toggleAudioState, isAudioStatePaused } from '../AudioBackend/AudioControl.js';
+import { toggleAudioState, isAudioStatePaused, playerStatus } from '../AudioBackend/AudioControl.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
import { readFileSync } from 'node:fs';
+import i18next from '../Utilities/i18n.js';
+const t = i18next.t;
const { djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8'));
export default {
data: new SlashCommandBuilder()
.setName('pause')
.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 (!interaction.member.voice.channel) return await interaction.reply({ content: t('voicePermission'), ephemeral: true });
+ if (!interaction.member.roles.cache.has(djRole) && interaction.user.id !== ownerID && !interaction.memberPermissions.has(PermissionFlagsBits.ManageGuild)) return interaction.reply({ content: t('rolePermission'), ephemeral: true });
- if (!isAudioStatePaused) {
- toggleAudioState();
- return await interaction.reply({ content: 'Pausing music', ephemeral: true });
+ if (playerStatus === 2) {
+ return await interaction.reply({ content: t('alreadyLeave'), ephemeral: true });
} else {
- return await interaction.reply({ content: 'Music is already paused', ephemeral: true });
+ if (!isAudioStatePaused) {
+ toggleAudioState();
+ return await interaction.reply({ content: t('pausingMusic'), ephemeral: true });
+ } else {
+ return await interaction.reply({ content: t('pausedAlready'), ephemeral: true });
+ }
}
}
};