32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
const { SlashCommandBuilder, PermissionsBitField } = require('discord.js');
|
|
const { useQueue } = require("discord-player");
|
|
|
|
const informationStatus = "[INFO]: ";
|
|
const warningStatus = "[WARNING]: ";
|
|
const errorStatus = "[ERROR]: ";
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('pause')
|
|
.setDescription('Pauses/Unpauses the current music playing.'),
|
|
async execute(interaction) {
|
|
const queue = useQueue(interaction.guild.id);
|
|
|
|
if(!interaction.member.permissions.has(PermissionsBitField.Flags.ManageMessages)) return interaction.reply({ content: "<:xmark:1238963594758979736> You dont have permission to use this command", ephemeral: true });
|
|
|
|
try {
|
|
await queue.node.setPaused(!queue.node.isPaused());
|
|
|
|
if(queue.node.isPaused() === true){
|
|
return interaction.reply("<:checkmark:1238964552482422844> Current song has been paused.");
|
|
} else {
|
|
return interaction.reply("<:checkmark:1238964552482422844> Current song has been unpaused.");
|
|
}
|
|
|
|
} catch(error){
|
|
interaction.reply({ content: "Something went wrong, try again later.", ephemeral: true });
|
|
return console.log(error);
|
|
}
|
|
}
|
|
}
|