Add stop functionality, fix duration

This commit is contained in:
Azaaxin
2023-06-25 11:08:14 +02:00
committed by Myx
parent dddbe81fab
commit c802be1a61
17 changed files with 304 additions and 226 deletions

34
commands/pauseResume.js Normal file
View File

@@ -0,0 +1,34 @@
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();
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();
interaction.followUp("Resumed the music.");
}
module.exports.pauseCommand = pauseCommand;
module.exports.unpauseCommand = unpauseCommand;