mbot/commands/music/stop.js

26 lines
984 B
JavaScript
Raw Permalink Normal View History

2024-07-04 09:14:01 +00:00
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('stop')
.setDescription('Stops the music bot and clears queue.'),
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.delete();
return interaction.reply("<:checkmark:1238964552482422844> Stopped music and got rid of the queue.");
} catch (error) {
interaction.reply({ content: "Something went wrong, try again later.", ephemeral: true });
return console.log(error);
}
}
}