fixing linter warnings

This commit is contained in:
Erik 2020-08-08 13:40:43 +03:00
parent 581745b016
commit 5530886a51

View File

@ -34,9 +34,9 @@ class RateLimiter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(!channel || !(channel instanceof TextChannel)) reject('Missing channel'); if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel'));
if(!message || !(message instanceof Message)) reject('Missing message'); if(!message || !(message instanceof Message)) reject(new Error('Missing message'));
if(!channel.permissionsFor(channel.guild.me).has('MANAGE_MESSAGES')) reject('Missing permission MANAGE_MESSAGES'); 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] = []; if(!this.deleteQueue[channel.id]) this.deleteQueue[channel.id] = [];
this.deleteQueue[channel.id].push({ message, resolve, reject }); this.deleteQueue[channel.id].push({ message, resolve, reject });
@ -93,9 +93,9 @@ class RateLimiter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(!channel || !(channel instanceof TextChannel)) reject('Missing channel.'); if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel.'));
if(!message || !message.length) reject('Missing message.'); if(!message || !message.length) reject(new Error('Missing message.'));
if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject('Missing permission SEND_MESSAGES'); if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES'));
//Initiate queue //Initiate queue
if(!this.sendQueue[channel.id]) this.sendQueue[channel.id] = []; if(!this.sendQueue[channel.id]) this.sendQueue[channel.id] = [];
@ -169,9 +169,9 @@ class RateLimiter {
limitSend(channel, message, limit = 15, utility = 'default') { limitSend(channel, message, limit = 15, utility = 'default') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(!channel || !(channel instanceof TextChannel)) reject('Missing channel'); if(!channel || !(channel instanceof TextChannel)) reject(new Error('Missing channel'));
if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject('Missing permission SEND_MESSAGES'); if(!channel.permissionsFor(channel.guild.me).has('SEND_MESSAGES')) reject(new Error('Missing permission SEND_MESSAGES'));
if(!message) reject('Missing message'); if(!message) reject(new Error('Missing message'));
const now = Math.floor(Date.now()/1000); const now = Math.floor(Date.now()/1000);
if(!this.lastSend[channel.id]) this.lastSend[channel.id] = {}; if(!this.lastSend[channel.id]) this.lastSend[channel.id] = {};