This repository has been archived on 2026-01-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Lunaris/commands/pauseResume.js
2023-06-28 03:04:01 +02:00

34 lines
867 B
JavaScript

const { getVoiceConnection } = require('@discordjs/voice');
async function pauseCommand(interaction) {
await interaction.deferReply();
const connection = getVoiceConnection(interaction.guild.id);
if (!connection) {
return interaction.followUp(
'There is no active music player in this server.',
);
}
connection.state.subscription.player.pause();
return interaction.followUp('Paused the music.');
}
async function unpauseCommand(interaction) {
await interaction.deferReply();
const connection = getVoiceConnection(interaction.guild.id);
if (!connection) {
return interaction.followUp(
'There is no active music player in this server.',
);
}
connection.state.subscription.player.unpause();
return interaction.followUp('Resumed the music.');
}
module.exports.pauseCommand = pauseCommand;
module.exports.unpauseCommand = unpauseCommand;