mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const { Command } = require('discord.js-commando');
|
|
|
|
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.`);
|
|
}
|
|
};
|