29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import BotCommand from "../../libs/BotCommand";
|
|
import BotClient from "../../libs/BotClient";
|
|
import { ChatInputCommandInteraction, GuildMember } from "discord.js";
|
|
|
|
export default class StopCommand extends BotCommand {
|
|
constructor() {
|
|
super("stop", "Stop Command", "/stop");
|
|
}
|
|
|
|
override async execute(Discord: any, client: BotClient, interaction: ChatInputCommandInteraction): Promise<any> {
|
|
const member = interaction.member as GuildMember;
|
|
|
|
if(!member?.voice?.channel) {
|
|
return await interaction.reply({ content: "❌ | You need to be in a voice channel!" });
|
|
}
|
|
|
|
const queue = client.distube.getQueue(interaction);
|
|
if(!queue) return await interaction.reply({ content: `❌ | There is no music playing!` });
|
|
|
|
client.distube.stop(interaction);
|
|
|
|
const embed = new Discord.EmbedBuilder()
|
|
.setDescription(` Successfully **Stopped** the music.`)
|
|
.setFooter({ text: `Request by ${interaction.user.tag}`, iconURL: interaction.user.displayAvatarURL() });
|
|
|
|
return await interaction.reply({ embeds: [embed] });
|
|
}
|
|
}
|