diff --git a/bot/commands/Configuration/blocklist.js b/bot/commands/Configuration/blocklist.js index 49874a5..d487f86 100644 --- a/bot/commands/Configuration/blocklist.js +++ b/bot/commands/Configuration/blocklist.js @@ -21,7 +21,7 @@ module.exports = class { if (!action || action.toLowerCase() === 'list') { const list = []; for (const userID of data.guild.blocklist) { - const user = await client.helpers.getUser(userID); + const user = await client.functions.getUser(userID); list.push(`${user.username}#${user.discriminator}`); } @@ -60,7 +60,7 @@ module.exports = class { `${client.constants.emojis.userError} You can't block the owner, silly!` ); - if (client.helpers.highestRole(member).position >= client.helpers.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { + if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't add them to the blocklist!`); } @@ -81,7 +81,7 @@ module.exports = class { } if (action === 'remove') { - if (client.helpers.highestRole(member).position >= client.helpers.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { + if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) { return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't remove them to the blocklist!`); } diff --git a/bot/commands/Developer/eval.js b/bot/commands/Developer/eval.js index 9753b6a..6ecc928 100644 --- a/bot/commands/Developer/eval.js +++ b/bot/commands/Developer/eval.js @@ -19,14 +19,14 @@ module.exports = class { const code = args.join(' '); try { const evaled = eval(code); - const clean = await client.helpers.clean(evaled); + const clean = await client.functions.clean(evaled); const MAX_CHARS = 3 + 2 + clean.length + 3; if (MAX_CHARS > 2000) { - return message.channel.createMessage(undefined, { file: Buffer.from(clean), name: 'EVAL_SUCCESS.txt' }); + return message.channel.createMessage(undefined, { file: Buffer.from(clean), name: 'EVAL_SUCCESS.js' }); } message.channel.createMessage(`\`\`\`js\n${clean}\n\`\`\``); } catch (err) { - const e = await client.helpers.clean(err); + const e = await client.functions.clean(err); const MAX_CHARS = 3 + 2 + e.length + 3; if (MAX_CHARS > 2000) { return message.channel.createMessage(undefined, { file: Buffer.from(e), name: 'EVAL_ERROR.txt' }); diff --git a/bot/index.js b/bot/index.js index 22200f8..819eae8 100644 --- a/bot/index.js +++ b/bot/index.js @@ -5,7 +5,7 @@ const CommandLoader = require('./util/commandLoader'); const EventLoader = require('./util/eventLoader'); const EventHandler = require('./util/handlers/eventHandler'); const MessageHandler = require('./util/handlers/messageHandler'); -const Helpers = require('./util/helpers'); +const Functions = require('./util/functions'); const Database = require('./util/database'); const Logger = require('./util/logger'); const sentry = require('@sentry/node'); @@ -27,7 +27,7 @@ class WoomyClient extends Eris.Client { this.constants = constants; this.logger = Logger; this.db = new Database(this); - this.helpers = new Helpers(this); + this.functions = new Functions(this); this.commandLoader = new CommandLoader(this); this.eventLoader = new EventLoader(this); this.eventHandler = new EventHandler(this); @@ -100,7 +100,7 @@ class WoomyClient extends Eris.Client { const client = new WoomyClient(config.token, { maxShards: 'auto', restMode: true, - getAllUsers: true, + //getAllUsers: true, defaultImageSize: 2048, intents: [ 'guilds', diff --git a/bot/util/helpers.js b/bot/util/functions.js similarity index 98% rename from bot/util/helpers.js rename to bot/util/functions.js index 9d7e8c1..2aa2765 100644 --- a/bot/util/helpers.js +++ b/bot/util/functions.js @@ -1,7 +1,7 @@ // const { MessageCollector } = require('eris-collector'); const { inspect, promisify } = require('util'); -class Helpers { +class Functions { constructor (client) { this.client = client; } @@ -144,4 +144,4 @@ class Helpers { } } -module.exports = Helpers; \ No newline at end of file +module.exports = Functions; \ No newline at end of file diff --git a/bot/util/handlers/messageHandler.js b/bot/util/handlers/messageHandler.js index b027030..75965f6 100644 --- a/bot/util/handlers/messageHandler.js +++ b/bot/util/handlers/messageHandler.js @@ -65,12 +65,12 @@ class MessageHandler { ); // Both of these blocks check the permissions of the user, and reply with missing perms if any are found - const missingUserPerms = this.client.helpers.checkPermissions(message.channel, message.author.id, command.userPerms); + 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('`, `')}\`` ); - const missingBotPerms = this.client.helpers.checkPermissions(message.channel, this.client.user.id, command.botPerms); + 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('`, `')}\`` ); @@ -81,7 +81,7 @@ class MessageHandler { ); // Return if the command is restricted to developers (and the user is not a developer) - if (command.devOnly === true && this.client.helpers.isDeveloper(message.author.id) !== true) { + if (command.devOnly === true && this.client.functions.isDeveloper(message.author.id) !== true) { return message.channel.createMessage( this.client.constants.emojis.permError + ' This command\'s usage is restricted to developers only. Sorry!' );