JaBa/commands/Music/stop.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2024-09-14 19:52:56 +05:00
const { SlashCommandBuilder, InteractionContextType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Stop extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("stop")
.setDescription(client.translate("music/stop:DESCRIPTION"))
.setDescriptionLocalizations({
2023-07-05 00:58:06 +05:00
uk: client.translate("music/stop:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/stop:DESCRIPTION", null, "ru-RU"),
})
2024-09-14 19:52:56 +05:00
.setContexts([InteractionContextType.PrivateChannel, InteractionContextType.Guild]),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async execute(client, interaction) {
const voice = interaction.member.voice.channel;
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
2024-04-30 12:19:44 +05:00
const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
2024-04-30 12:19:44 +05:00
queue.delete();
2022-08-26 00:31:42 +05:00
interaction.success("music/stop:SUCCESS");
}
}
2023-07-05 00:58:06 +05:00
module.exports = Stop;