diff --git a/structure/client/RateLimiter.js b/structure/client/RateLimiter.js index 43db52b..5461f30 100644 --- a/structure/client/RateLimiter.js +++ b/structure/client/RateLimiter.js @@ -34,9 +34,9 @@ class RateLimiter { return new Promise((resolve, reject) => { - if(!channel || !(channel instanceof TextChannel)) reject('Missing channel'); - if(!message || !(message instanceof Message)) reject('Missing message'); - if(!channel.permissionsFor(channel.guild.me).has('MANAGE_MESSAGES')) reject('Missing permission MANAGE_MESSAGES'); + if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel')); + if(!message || !(message instanceof Message)) reject(new Error('Missing message')); + if(!channel.permissionsFor(channel.guild.me).has('MANAGE_MESSAGES')) reject(new Error('Missing permission MANAGE_MESSAGES')); if(!this.deleteQueue[channel.id]) this.deleteQueue[channel.id] = []; this.deleteQueue[channel.id].push({ message, resolve, reject }); @@ -93,9 +93,9 @@ class RateLimiter { return new Promise((resolve, reject) => { - if(!channel || !(channel instanceof TextChannel)) reject('Missing channel.'); - if(!message || !message.length) reject('Missing message.'); - if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject('Missing permission SEND_MESSAGES'); + if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel.')); + if(!message || !message.length) reject(new Error('Missing message.')); + if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES')); //Initiate queue if(!this.sendQueue[channel.id]) this.sendQueue[channel.id] = []; @@ -169,9 +169,9 @@ class RateLimiter { limitSend(channel, message, limit = 15, utility = 'default') { return new Promise((resolve, reject) => { - if(!channel || !(channel instanceof TextChannel)) reject('Missing channel'); - if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject('Missing permission SEND_MESSAGES'); - if(!message) reject('Missing message'); + if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel')); + if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES')); + if(!message) reject(new Error('Missing message')); const now = Math.floor(Date.now()/1000); if(!this.lastSend[channel.id]) this.lastSend[channel.id] = {};