This commit is contained in:
Emily 2020-10-20 12:27:34 +11:00
parent 4ac2d2e927
commit 00bbebcf4a
32 changed files with 0 additions and 3610 deletions

View file

@ -1,92 +0,0 @@
const Command = require('../../base/Command.js');
class Blacklist extends Command {
constructor (client) {
super(client, {
description: 'Add and remove users from the blacklist, preventing them from using commands in this server.',
usage: '`blacklist [add <user> | remove <user>]`',
examples: '`blacklist`\n`blacklist add @annoyinguser123`\n`blacklist remove @cooluser456`',
userPerms: ['ADMINISTRATOR'],
guildOnly: true
});
}
async run (message, [action, ...user], data) { // eslint-disable-line no-unused-vars
if (!action) {
return;
} else {
if (!user) return message.channel.send(
'You didn\'t specify a user!'
);
let member = message.mentions.users.first();
if (!member && message.guild) {
member = this.client.functions.searchForMembers(message.guild, user);
if (member.length > 1) {
return message.channel.send(
'Found multiple users, please be more specific or @mention the user instead.'
);
}
if (member.length < 1) {
return message.channel.send(
'Specified user couldn\'t be found, check for typing errors.'
);
}
}
member = member[0];
const array = data.guild.blacklist;
action = action.toLowerCase();
if (action === 'add') {
if (member.user.id === message.guild.owner.id) return message.channel.send(
'You can\'t add the owner to the blocklist!'
);
if (member.roles.highest.position >= message.guild.member(message.author).roles.highest.position && message.author.id !== message.guild.ownerID) {
return message.channel.send(
'You can\'t add people higher ranked than yourself to the blocklist!'
);
}
if (array.includes(member.user.id)) return message.channel.send(
'This user has already been blacklisted.'
);
array.push(member.user.id);
await this.client.db.updateGuild(message.guild.id, 'blacklist', array);
return message.channel.send(
`Added \`${member.user.tag}\` to the blocklist.`
);
}
if (action === 'remove') {
if (member.roles.highest.position >= message.guild.member(message.author).roles.highest.position && message.author.id !== message.guild.ownerID) {
return message.channel.send(
'You can\'t remove people higher ranked than yourself from the blocklist!'
);
}
if (!array.includes(member.user.id)) return message.channel.send(
'This user isn\'t blacklisted.'
);
array.remove(member.user.id);
await this.client.db.updateGuild(message.guild.id, 'blacklist', array);
return message.channel.send(
`Removed \`${member.user.tag}\` from the blocklist.`
);
}
}
}
}
module.exports = Blacklist;

View file

@ -1,90 +0,0 @@
const Command = require('../../base/Command.js');
class Disable extends Command {
constructor (client) {
super(client, {
description: 'Disables a command/category so they can\'t be used in this server.',
usage: '`disable command [command]` - Disables the specified command.\n`disable category [category]` - Disables the specified category.',
examples: '`disable command cuddle`\n`disable category music`',
userPerms: ['ADMINISTRATOR'],
guildOnly: true
});
}
async run (message, args, data) {
const essentialCategories = [
'Configuration',
'Developer'
];
const essentialCommands = [
'help'
];
if (!args[0]) {
return;
} else {
if (!args[1]) return message.channel.send(
'You didn\'t specify a command/category to disable!'
);
if (args[0] === 'command') {
const array = data.guild.disabledcommands;
const name = args[1].toLowerCase();
let command;
if (this.client.commands.has(name)) {
command = this.client.commands.get(name);
} else if (this.client.aliases.has(name)) {
command = this.client.commands.get(this.client.aliases.get(name));
}
if (!command) return message.channel.send(
`\`${args[0]}\` does not exist as a command or an alias.`
);
if (essentialCategories.includes(command.help.category) || essentialCommands.includes(command.help.name)) {
return message.channel.send('This command is essential, and cannot be disabled.');
}
if (array.includes(command.help.name)) return message.channel.send(
'This command has already been disabled. Use `enable` to re-enable it.'
);
array.push(command.help.name);
await this.client.db.updateGuild(message.guild.id, 'disabledcommands', array);
return message.channel.send(`Disabled command \`${name}\``);
}
if (args[0] === 'category') {
const array = data.guild.disabledcategories;
const name = args[1].toProperCase();
if (!this.client.categories.includes(name)) return message.channel.send(
'I couldn\'t find this category. Are you sure you spelt it correctly?'
);
if (essentialCategories.includes(name)) return message.channel.send(
'This category is essential, and cannot be disabled.'
);
if (array.includes(name)) return message.channel.send(
'This command has already been disabled. Use `enable` to re-enable it.'
);
array.push(name);
await this.client.db.updateGuild(message.guild.id, 'disabledcategories', array);
return message.channel.send(`Disabled category \`${name}\``);
}
}
return message.channel.send('didn\'t specify whether to disable a command or category');
}
}
module.exports = Disable;

View file

@ -1,73 +0,0 @@
const Command = require('../../base/Command.js');
class Enable extends Command {
constructor (client) {
super(client, {
description: 'Re-enables a previously disabled command/category.',
usage: '`enable command [command]` - Enables the specified command.\n`enable category [category]` - Enables the specified category.',
examples: '`enable command cuddle`\n`enable category music`',
userPerms: ['ADMINISTRATOR'],
guildOnly: true
});
}
async run (message, args, data) {
if (!args[0]) {
return;
} else {
if (!args[1]) return message.channel.send(
'You didn\'t specify a command/category to enable!'
);
if (args[0] === 'command') {
const array = data.guild.disabledcommands;
const name = args[1].toLowerCase();
let command;
if (this.client.commands.has(name)) {
command = this.client.commands.get(name);
} else if (this.client.aliases.has(name)) {
command = this.client.commands.get(this.client.aliases.get(name));
}
if (!command) return message.channel.send(
`\`${args[0]}\` does not exist as a command or an alias.`
);
if (!array.includes(command.help.name)) return message.channel.send(
'This command isn\'t disabled.'
);
array.remove(command.help.name);
await this.client.db.updateGuild(message.guild.id, 'disabledcommands', array);
return message.channel.send(`Enabled command \`${name}\``);
}
if (args[0] === 'category') {
const array = data.guild.disabledcategories;
const name = args[1].toProperCase();
if (!this.client.categories.includes(name)) return message.channel.send(
'I couldn\'t find this category. Are you sure you spelt it correctly?'
);
if (!array.includes(name)) return message.channel.send(
'This command isn\'t disabled.'
);
array.remove(name);
await this.client.db.updateGuild(message.guild.id, 'disabledcategories', array);
return message.channel.send(`Enabled category \`${name}\``);
}
}
return message.channel.send('didn\'t specify whether to enable a command or category');
}
}
module.exports = Enable;

View file

@ -1,26 +0,0 @@
const { MessageEmbed } = require('discord.js');
const Command = require('../../base/Command.js');
class Settings extends Command {
constructor (client) {
super(client, {
description: 'View all of your server\'s settings.',
usage: 'settings',
guildOnly: true,
aliases: ['config']
});
}
async run (message, args) { // eslint-disable-line no-unused-vars
const settings = await this.client.db.getGuild(message.guild.id);
const embed = new MessageEmbed()
.setAuthor('Settings Panel', message.guild.iconURL({dynamic: true}))
.setDescription('All the settings for this server are listed below. To set a setting, use `set [setting] [what you want to set it to]')
.addFields(
{ name: '**Prefix**', value: settings.prefix }
);
}
}
module.exports = Settings;

View file

@ -1,25 +0,0 @@
const Command = require('../../base/Command.js');
class Userprefix extends Command {
constructor (client) {
super(client, {
description: 'Change the prefix you use for Woomy. This will affect servers and commands in DM\'s.',
usage: '`userprefix` <new prefix>',
examples: '`userprefix !!` - Sets your personal prefix to !!'
});
}
async run (message, args, data) { // eslint-disable-line no-unused-vars
if (!args[0]) {
return message.channel.send(
`Your prefix for Woomy is currently: \`${data.user.prefix}\``
);
}
await this.client.db.updateUser(message.author.id, 'prefix', args[0]);
message.channel.send(`Your personal prefix has been set to: \`${args[0]}\``);
}
}
module.exports = Userprefix;