naar-music-bot
Version:
Simple JavaScript Music Discord Bot Powerd By: NAAR Studio.
50 lines (49 loc) • 2.14 kB
JavaScript
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "stop",
aliases: ["leave", "end"],
cooldown: 5,
description: `Stop song for you!.`,
run: async(client, message, args) => {
if (client.stop_command == true) {
if (!message.guild) return;
message.react("✅").catch(err => {
throw new TypeError(err)
});
const { channel } = message.member.voice;
const queue = message.client.queue.get(message.guild.id);
if (!channel) return message.channel.send(
new MessageEmbed()
.setTitle("You Have To Join a \`Voice Channel\` First!")
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
if (queue && channel !== message.guild.me.voice.channel)
return message.channel.send(
new MessageEmbed()
.setTitle(`Iam Only Work In \`${channel.name}\``)
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
if (!queue)
return message.channel.send(
new MessageEmbed()
.setTitle("Thare is nothing in the music queue!")
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
await channel.leave();
message.channel.send(new MessageEmbed()
.setColor("#c219d8")
.setAuthor(`**${message.author.username}** stopped the music!`))
.catch(err => {
throw new TypeError(err)
});
} else if (client.help_command == false) {
message.channel.send(
new MessageEmbed()
.setTitle(`\`${module.exports.name}\` Has Been Disabled From The Music System`)
)
} else throw new TypeError(`❌ | "${module.exports.name}_command" value must be true or false`)
}
};