remove constants directory

This commit is contained in:
Emily 2020-11-10 14:31:49 +11:00
parent c297e45a64
commit 4d8eecff04
19 changed files with 74 additions and 79 deletions

View file

@ -1,4 +1,4 @@
const colours = require('../assets/constants/colours.json');
const colours = require('../assets/colours.json');
const HEX_REGEX = /#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
class RichEmbed {

View file

@ -1,5 +1,6 @@
// const { MessageCollector } = require('eris-collector');
const { inspect, promisify } = require('util');
const colours = require('../assets/colours.json');
class Functions {
constructor (client) {
@ -44,8 +45,8 @@ class Functions {
if (object.color !== 0) return '#' + object.color.toString(16);
}
const colours = Object.keys(this.client.constants.colours);
return this.client.constants.colours[colours[ colours.length * Math.random() << 0]];
const colourKeys = Object.keys(colours);
return colours[colourKeys[ colours.length * Math.random() << 0]];
}
highestRole (member) {

View file

@ -62,33 +62,33 @@ class MessageHandler {
// Both of these blocks check if the command is disabled/in a disabled category
if (data.guild.disabledcommands.includes(command.name)) return message.channel.createMessage(
this.client.constants.emojis.permError + ' This command has been disabled by a server administrator.'
this.client.emojis.permError + ' This command has been disabled by a server administrator.'
);
if (data.guild.disabledcategories.includes(command.category)) return message.channel.createMessage(
this.client.constants.emojis.permError + ' The category this command is apart of has been disabled by a server administrator.'
this.client.emojis.permError + ' The category this command is apart of has been disabled by a server administrator.'
);
// Both of these blocks check the permissions of the user, and reply with missing perms if any are found
const missingUserPerms = this.client.functions.checkPermissions(message.channel, message.author.id, command.userPerms);
if (missingUserPerms) return message.channel.createMessage(
`${this.client.constants.emojis.permError} You can't use this command because you lack these permissions: \`${missingUserPerms.join('`, `')}\``
`${this.client.emojis.permError} You can't use this command because you lack these permissions: \`${missingUserPerms.join('`, `')}\``
);
const missingBotPerms = this.client.functions.checkPermissions(message.channel, this.client.user.id, command.botPerms);
if (missingBotPerms) return message.channel.createMessage(
`${this.client.constants.emojis.permError} I can't run this command because I lack these permissions: \`${missingBotPerms.join('`, `')}\``
`${this.client.emojis.permError} I can't run this command because I lack these permissions: \`${missingBotPerms.join('`, `')}\``
);
// Return if the command is disabled globally
if (command.enabled === false) return message.channel.createMessage(
this.client.constants.emojis.permError + ' This command has been disabled by my developers.'
this.client.emojis.permError + ' This command has been disabled by my developers.'
);
// Return if the command is restricted to developers (and the user is not a developer)
if (command.devOnly === true && this.client.config.ownerIDs.includes(message.author.id) !== true) {
return message.channel.createMessage(
`${this.client.constants.emojis.permError} ${message.author.username} is not in the sudoers file. This incident will be reported.`
`${this.client.emojis.permError} ${message.author.username} is not in the sudoers file. This incident will be reported.`
);
}
@ -99,7 +99,7 @@ class MessageHandler {
const cooldown = command.cooldown / 1000;
const timePassed = Math.floor((currentTime - timestamp) / 1000);
return message.channel.createMessage(
`${this.client.constants.emojis.wait} ${message.author.mention}, you need to wait ${cooldown - timePassed} seconds before using this command again.`
`${this.client.emojis.wait} ${message.author.mention}, you need to wait ${cooldown - timePassed} seconds before using this command again.`
);
} else {
this.client.cooldowns.get(command.name).set(message.author.id, new Date());