mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
I don't use blacklist and whitelist... ever
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class BlacklistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'blacklist',
|
||||
aliases: ['blacklist-add'],
|
||||
group: 'util',
|
||||
memberName: 'blacklist',
|
||||
description: 'Blacklists a user from using commands.',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user do you want to blacklist?',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (this.client.isOwner(user)) return msg.reply('The bot owner cannot be blacklisted.');
|
||||
if (user.bot) return msg.reply('Bots cannot be blacklisted.');
|
||||
const blacklist = this.client.provider.get('global', 'blacklist', []);
|
||||
if (blacklist.includes(user.id)) return msg.reply(`${user.tag} is already blacklisted!`);
|
||||
blacklist.push(user.id);
|
||||
this.client.provider.set('global', 'blacklist', blacklist);
|
||||
return msg.say(`${user.tag} has been blacklisted.`);
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class WhitelistCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'whitelist',
|
||||
aliases: ['blacklist-remove', 'blacklist-delete', 'unblacklist'],
|
||||
group: 'util',
|
||||
memberName: 'whitelist',
|
||||
description: 'Removes a user from the blacklist.',
|
||||
ownerOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user do you want to whitelist?',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (this.client.isOwner(user)) return msg.reply('The bot owner cannot be blacklisted.');
|
||||
if (user.bot) return msg.reply('Bots cannot be blacklisted.');
|
||||
const blacklist = this.client.provider.get('global', 'blacklist', []);
|
||||
if (!blacklist.includes(user.id)) return msg.reply(`${user.tag} is not blacklisted!`);
|
||||
blacklist.splice(blacklist.indexOf(user.id), 1);
|
||||
if (!blacklist.length) this.client.provider.remove('global', 'blacklist');
|
||||
else this.client.provider.set('global', 'blacklist', blacklist);
|
||||
return msg.say(`${user.tag} has been whitelisted.`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user