1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 04:31:56 +00:00

Update blacklist.js

This commit is contained in:
MatteZ02 2020-06-29 20:48:44 +03:00
parent 83b56b73a0
commit 0e25ac5752

View File

@ -3,7 +3,9 @@ const discord = require("discord.js");
module.exports = { module.exports = {
name: "blacklist", name: "blacklist",
async execute(msg, args, client) { async execute(msg, args, client) {
if (args[2] === "add") { let embed;
switch (args[2]) {
case "add":
if (msg.mentions.channels.first()) { if (msg.mentions.channels.first()) {
if ( if (
client.global.db.guilds[msg.guild.id].blacklist.includes( client.global.db.guilds[msg.guild.id].blacklist.includes(
@ -39,7 +41,8 @@ module.exports = {
); );
msg.channel.send(message); msg.channel.send(message);
} }
} else if (args[2] === "remove") { break;
case "remove":
if (msg.mentions.channels.first()) { if (msg.mentions.channels.first()) {
if ( if (
!client.global.db.guilds[msg.guild.id].blacklist.includes( !client.global.db.guilds[msg.guild.id].blacklist.includes(
@ -63,6 +66,7 @@ module.exports = {
"%CHANNEL%", "%CHANNEL%",
msg.mentions.channels.first().name msg.mentions.channels.first().name
); );
msg.channel.send(message);
} }
} else { } else {
if (!client.global.db.guilds[msg.guild.id].blacklist.includes(args[3])) if (!client.global.db.guilds[msg.guild.id].blacklist.includes(args[3]))
@ -83,8 +87,9 @@ module.exports = {
msg.channel.send(message); msg.channel.send(message);
} }
} }
} else if (args[2] === "list") { break;
const embed = new discord.MessageEmbed() case "list":
embed = new discord.MessageEmbed()
.setTitle(client.messages.blacklistTitle) .setTitle(client.messages.blacklistTitle)
.setDescription( .setDescription(
`${client.global.db.guilds[msg.guild.id].blacklist `${client.global.db.guilds[msg.guild.id].blacklist
@ -93,8 +98,9 @@ module.exports = {
) )
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
msg.channel.send(embed); msg.channel.send(embed);
} else { break;
const embed = new discord.MessageEmbed() case undefined:
embed = new discord.MessageEmbed()
.setTitle(client.messages.blacklistTitle) .setTitle(client.messages.blacklistTitle)
.addField("add", "Add a channel to the blacklist. (ID or mention)") .addField("add", "Add a channel to the blacklist. (ID or mention)")
.addField( .addField(
@ -104,6 +110,7 @@ module.exports = {
.addField("list", "List the currently blacklisted channels.") .addField("list", "List the currently blacklisted channels.")
.setColor(client.config.embedColor); .setColor(client.config.embedColor);
msg.channel.send(embed); msg.channel.send(embed);
break;
} }
}, },
}; };