Add files via upload

This commit is contained in:
Emily 2020-01-25 11:18:38 +00:00 committed by GitHub
parent 430747016c
commit ee0cf0cce5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 114 additions and 114 deletions

View File

@ -1,114 +1,114 @@
exports.run = async (client, message, [action, ...member]) => { exports.run = async (client, message, [action, ...member]) => {
const settings = message.settings; const settings = message.settings;
if(settings.blacklisted == "ARRAY") { if(settings.blacklisted == "ARRAY") {
client.settings.set(message.guild.id, [], "blacklisted"); await client.settings.set(message.guild.id, [], "blacklisted");
} }
if(!action) { if(!action) {
return message.channel.send( return message.channel.send(
`<:error:466995152976871434> You didn't tell me if I was meant to add or remove someone from the blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\`` `<:error:466995152976871434> You didn't tell me if I was meant to add or remove someone from the blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\``
) )
} }
member = member.join(" ") member = member.join(" ")
if(!member) { if(!member) {
return message.channel.send( return message.channel.send(
`<:error:466995152976871434> You didn't tell me who to blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\`` `<:error:466995152976871434> You didn't tell me who to blacklist! Usage: \`${client.commands.get(`blacklist`).help.usage}\``
); );
}; };
let user = message.mentions.members.first(); let user = message.mentions.members.first();
if(action == "add") { if(action == "add") {
if (!user) { if (!user) {
let users; let users;
users = client.searchForMembers(message.guild, member); users = client.searchForMembers(message.guild, member);
if (users.length > 1) if (users.length > 1)
return message.channel.send( return message.channel.send(
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead." "<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
); );
else if (users.length == 0) else if (users.length == 0)
return message.channel.send( return message.channel.send(
"<:error:466995152976871434> That user doesn't seem to exist. Try again!" "<:error:466995152976871434> That user doesn't seem to exist. Try again!"
); );
user = users[0]; user = users[0];
}; };
if(user.id === client.user.id) { if(user.id === client.user.id) {
return message.channel.send('lol no'); return message.channel.send('lol no');
}; };
if(user.id === message.member.id) { if(user.id === message.member.id) {
return message.channel.send('<:error:466995152976871434> You can\'t blacklist yourself!'); return message.channel.send('<:error:466995152976871434> You can\'t blacklist yourself!');
}; };
let blacklisted = false; let blacklisted = false;
if(settings.blacklisted.length > 0) { if(settings.blacklisted.length > 0) {
settings.blacklisted.forEach(function(ID) { settings.blacklisted.forEach(function(ID) {
if(ID == user.id) { if(ID == user.id) {
blacklisted = true; blacklisted = true;
} }
}); });
if(blacklisted == true) { if(blacklisted == true) {
return message.channel.send('<:error:466995152976871434> This person has already been blacklisted!'); return message.channel.send('<:error:466995152976871434> This person has already been blacklisted!');
}; };
}; };
client.settings.push(message.guild.id, user.id, "blacklisted") client.settings.push(message.guild.id, user.id, "blacklisted")
return message.channel.send(`<:success:466995111885144095> Blacklisted \`${user.user.tag}\``) return message.channel.send(`<:success:466995111885144095> Blacklisted \`${user.user.tag}\``)
}; };
if (action == "remove") { if (action == "remove") {
if (!user) { if (!user) {
let users; let users;
users = client.searchForMembers(message.guild, member); users = client.searchForMembers(message.guild, member);
if (users.length > 1) if (users.length > 1)
return message.channel.send( return message.channel.send(
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead." "<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
); );
else if (users.length == 0) else if (users.length == 0)
return message.channel.send( return message.channel.send(
"<:error:466995152976871434> That user doesn't seem to exist. Try again!" "<:error:466995152976871434> That user doesn't seem to exist. Try again!"
); );
user = users[0]; user = users[0];
}; };
let blacklisted = false; let blacklisted = false;
settings.blacklisted.forEach(function(ID) { settings.blacklisted.forEach(function(ID) {
console.log("does this work") console.log("does this work")
if(ID == user.id) { if(ID == user.id) {
blacklisted = true; blacklisted = true;
} }
}); });
if(blacklisted != true) { if(blacklisted != true) {
return message.channel.send('<:error:466995152976871434> This user isn\'t blacklisted!'); return message.channel.send('<:error:466995152976871434> This user isn\'t blacklisted!');
}; };
client.settings.remove(message.guild.id, user.id, "blacklisted") client.settings.remove(message.guild.id, user.id, "blacklisted")
return message.channel.send(`<:success:466995111885144095> Removed \`${user.user.tag}\` from the blacklist.`) return message.channel.send(`<:success:466995111885144095> Removed \`${user.user.tag}\` from the blacklist.`)
}; };
}; };
exports.conf = { exports.conf = {
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
permLevel: "Administrator", permLevel: "Administrator",
requiredPerms: [] requiredPerms: []
}; };
exports.help = { exports.help = {
name: "blacklist", name: "blacklist",
category: "Moderation", category: "Moderation",
description: "Allows you to configure Woomy's blacklist. Blacklisted users cannot use commands.", description: "Allows you to configure Woomy's blacklist. Blacklisted users cannot use commands.",
usage: "blacklist [add/remove] [member]" usage: "blacklist [add/remove] [member]"
}; };