diff --git a/middleware/ShardManager.js b/middleware/ShardManager.js index e61c2c1..04b369a 100644 --- a/middleware/ShardManager.js +++ b/middleware/ShardManager.js @@ -23,42 +23,42 @@ class ShardManager extends EventEmitter { }, options.shard); this.file = file; - if(!file) throw new Error("[shardmanager] File must be specified."); + if(!file) throw new Error('[shardmanager] File must be specified.'); if(!path.isAbsolute(file)) this.file = path.resolve(process.cwd(), file); const stats = fs.statSync(this.file); - if(!stats.isFile()) throw new Error("[shardmanager] File path does not point to a valid file."); + if(!stats.isFile()) throw new Error('[shardmanager] File path does not point to a valid file.'); this.shardList = options.shardList || 'auto'; if(this.shardList !== 'auto') { if(!Array.isArray(this.shardList)) { - throw new TypeError("[shardmanager] ShardList must be an array."); + throw new TypeError('[shardmanager] ShardList must be an array.'); } this.shardList = [...new Set(this.shardList)]; - if(this.shardList.length < 1) throw new RangeError("[shardmanager] ShardList must have one ID."); + if(this.shardList.length < 1) throw new RangeError('[shardmanager] ShardList must have one ID.'); if(this.shardList.some(shardID => typeof shardID !== 'number' || isNaN(shardID) || !Number.isInteger(shardID) || shardID < 0) ) { - throw new TypeError("[shardmanager] ShardList must be an array of positive integers."); + throw new TypeError('[shardmanager] ShardList must be an array of positive integers.'); } } this.totalShards = options.totalShards || 'auto'; if(this.totalShards !== 'auto') { if(typeof this.totalShards !== 'number' || isNaN(this.totalShards)) { - throw new TypeError("[shardmanager] TotalShards must be an integer."); + throw new TypeError('[shardmanager] TotalShards must be an integer.'); } - if(this.totalShards < 1) throw new RangeError("[shardmanager] TotalShards must be at least one."); + if(this.totalShards < 1) throw new RangeError('[shardmanager] TotalShards must be at least one.'); if(!Number.isInteger(this.totalShards)) { - throw new RangeError("[shardmanager] TotalShards must be an integer."); + throw new RangeError('[shardmanager] TotalShards must be an integer.'); } } this.mode = options.mode; if(this.mode !== 'process' && this.mode !== 'worker') { - throw new RangeError("[shardmanager] Mode must be either 'worker' or 'process'."); + throw new RangeError('[shardmanager] Mode must be either \'worker\' or \'process\'.'); } this.respawn = options.respawn; @@ -87,15 +87,15 @@ class ShardManager extends EventEmitter { amount = await Util.fetchRecommendedShards(this.token); } else { if(typeof amount !== 'number' || isNaN(amount)) { - throw new TypeError("[shardmanager] Amount of shards must be a number."); + throw new TypeError('[shardmanager] Amount of shards must be a number.'); } - if(amount < 1) throw new RangeError("[shardmanager] Amount of shards must be at least one."); + if(amount < 1) throw new RangeError('[shardmanager] Amount of shards must be at least one.'); if(!Number.isInteger(amount)) { - throw new TypeError("[shardmanager] Amount of shards must be an integer."); + throw new TypeError('[shardmanager] Amount of shards must be an integer.'); } } - if(this.shards.size >= amount) throw new Error("[shardmanager] Already spawned all necessary shards."); + if(this.shards.size >= amount) throw new Error('[shardmanager] Already spawned all necessary shards.'); if(this.shardList === 'auto' || this.totalShards === 'auto' || this.totalShards !== amount) { this.shardList = [...Array(amount).keys()]; } @@ -103,7 +103,7 @@ class ShardManager extends EventEmitter { this.totalShards = amount; } if(this.shardList.some(id => id >= amount)) { - throw new RangeError("[shardmanager] Amount of shards cannot be larger than the highest shard ID."); + throw new RangeError('[shardmanager] Amount of shards cannot be larger than the highest shard ID.'); } for(const shardID of this.shardList) { @@ -131,8 +131,8 @@ class ShardManager extends EventEmitter { } fetchClientValues(prop) { - if(this.shards.size === 0) return Promise.reject(new Error("[shardmanager] No shards available.")); - if(this.shards.size !== this.totalShards) return Promise.reject(new Error("[shardmanager] Sharding in progress.")); + if(this.shards.size === 0) return Promise.reject(new Error('[shardmanager] No shards available.')); + if(this.shards.size !== this.totalShards) return Promise.reject(new Error('[shardmanager] Sharding in progress.')); const promises = []; for(const shard of this.shards.values()) promises.push(shard.fetchClientValue(prop)); return Promise.all(promises); diff --git a/middleware/logger/transports/DiscordWebhook.js b/middleware/logger/transports/DiscordWebhook.js index d6d9f0d..a715909 100644 --- a/middleware/logger/transports/DiscordWebhook.js +++ b/middleware/logger/transports/DiscordWebhook.js @@ -5,6 +5,7 @@ const { inspect } = require('util'); const options = require('../../../options.json'); +// eslint-disable-next-line no-control-regex const regex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g class DiscordWebhook extends Transport { diff --git a/structure/client/components/commands/administration/Permissions.js b/structure/client/components/commands/administration/Permissions.js index b0fccfe..de8556d 100644 --- a/structure/client/components/commands/administration/Permissions.js +++ b/structure/client/components/commands/administration/Permissions.js @@ -9,15 +9,15 @@ class GrantCommand extends Command { super(client, { name: 'permissions', module: 'administration', - usage: "", + usage: '', aliases: [ 'perms', 'permission', 'perm' ], examples: [ - "Server Moderators", - "@nolan#2887" + 'Server Moderators', + '@nolan#2887' ], memberPermissions: ['ADMINISTRATOR', 'MANAGE_SERVER'], guildOnly: true