mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2025-10-03 19:51:33 +01:00
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
const { SlashCommandBuilder } = require("discord.js");
|
|
const { requireVC, requireQueue } = require("../../utils/musicGuards");
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName("pause")
|
|
.setDescription("Pauses the current song."),
|
|
category: "Music",
|
|
|
|
async execute(interaction, client) {
|
|
try {
|
|
await interaction.deferReply({ ephemeral: false });
|
|
|
|
requireVC(interaction);
|
|
const queue = requireQueue(client, interaction);
|
|
|
|
if (queue.paused) {
|
|
return interaction.followUp({
|
|
content: "⏸️ Music is already paused.",
|
|
ephemeral: true,
|
|
});
|
|
}
|
|
|
|
queue.pause();
|
|
return interaction.followUp("⏸️ Paused the current song!");
|
|
} catch (e) {
|
|
console.error("pause command failed:", e);
|
|
const msg = e?.message || "❌ Failed to pause the music.";
|
|
// If something above threw (e.g., guards), ensure user gets a response
|
|
if (interaction.deferred || interaction.replied) {
|
|
return interaction.followUp({ content: msg, ephemeral: true });
|
|
}
|
|
return interaction.reply({ content: msg, ephemeral: true });
|
|
}
|
|
},
|
|
};
|