From ac9b59281e757fa740db4875e829ac42f606ec02 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Tue, 5 Nov 2024 06:32:40 +0100 Subject: [PATCH] Fix all eslint warnings --- commands/info/help.js | 3 --- commands/misc/emoji.js | 3 ++- server/ready.js | 3 ++- util/getSubdirFiles.js | 25 +++++++++++-------------- util/lastfm/getCurrentCover.js | 1 + util/lastfm/getCurrentScrobble.js | 1 + util/reloadCommands.js | 1 - util/timer/checkTimer.js | 1 - util/timer/convertJSONToSQL.js | 1 - util/timer/createTimer.js | 1 - util/timer/parseTime.js | 6 +++--- 11 files changed, 20 insertions(+), 26 deletions(-) diff --git a/commands/info/help.js b/commands/info/help.js index 6174e26..e88df47 100644 --- a/commands/info/help.js +++ b/commands/info/help.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const {EmbedBuilder} = require('discord.js'); const getSubdirFiles = require('../../util/getSubdirFiles'); @@ -17,7 +16,6 @@ module.exports = { let fieldName = `Page [[page]]/${Math.round(client.commands.size / 10)}`; let iteration = 0; let num_in_args = false; - let added_commands = 0; let page = -1; @@ -53,7 +51,6 @@ module.exports = { if (!command.admin){ if(start < iteration){ }else{ - added_commands++ commands = commands + `${prefix}${command.name} | ${command.description}\n`; iteration++ } diff --git a/commands/misc/emoji.js b/commands/misc/emoji.js index 6ce12dc..58befa8 100644 --- a/commands/misc/emoji.js +++ b/commands/misc/emoji.js @@ -19,7 +19,8 @@ module.exports = { try { num = num.slice(0, -1); } catch (e) { - message.channel.send("There was an error."); + console.error(e) + message.channel.send("There was an error. Check the logs"); return; } message.channel.send("https://cdn.discordapp.com/emojis/" + num + extension); diff --git a/server/ready.js b/server/ready.js index 20324b7..b65e8ff 100644 --- a/server/ready.js +++ b/server/ready.js @@ -9,7 +9,8 @@ module.exports = function(client, enableLoginMessage, loginChannel, loginMessage try{ client.channels.cache.get(loginChannel).send(loginMessage) }catch(err){ - console.log("Failed trying to send a message on login.\n") + console.error("Failed trying to send a message on login.\n") + console.error(err) } loadServerPrefixes(client) checkTimer(client); diff --git a/util/getSubdirFiles.js b/util/getSubdirFiles.js index 437a035..d748256 100644 --- a/util/getSubdirFiles.js +++ b/util/getSubdirFiles.js @@ -3,20 +3,17 @@ const fs = require('fs') module.exports = function (path) { let subdir = fs.readdirSync(path) let commandFiles = []; - subdir.forEach(item => { - if(fs.statSync(path+item).isDirectory()){ - let subdirFiles = fs.readdirSync(path+item) - subdirFiles.forEach(file => { - if(file.endsWith('.js')){ - commandFiles.push(path+item+"/"+file) + if(fs.statSync(path+subdir).isDirectory()){ + goDeeper(path+subdir, commandFiles); + }else if(subdir.endsWith(".js")){ + commandFiles.push(path+subdir) + } - } - }); - - }else if(item.endsWith('.js')){ - commandFiles.push(path+item) - } - }); - return commandFiles + //return commandFiles // ARRAY OF FILES ENDING WITH .js } + + +function goDeeper(subdir, commandFiles){ + +} \ No newline at end of file diff --git a/util/lastfm/getCurrentCover.js b/util/lastfm/getCurrentCover.js index bc4224c..16a1b98 100644 --- a/util/lastfm/getCurrentCover.js +++ b/util/lastfm/getCurrentCover.js @@ -25,6 +25,7 @@ module.exports = async function(userID, guild) { try { track = data.recenttracks.track[0]; } catch (error) { + console.error(error); scrobble.error = true; switch(data.error){ case 6: diff --git a/util/lastfm/getCurrentScrobble.js b/util/lastfm/getCurrentScrobble.js index d1071ff..5c83bd5 100644 --- a/util/lastfm/getCurrentScrobble.js +++ b/util/lastfm/getCurrentScrobble.js @@ -39,6 +39,7 @@ module.exports = async function (userID, guild) { } resolve(tracks); } catch (error) { + console.error(error) let scrobble = {}; scrobble.error = true; if (data.error === 6) { diff --git a/util/reloadCommands.js b/util/reloadCommands.js index 025632e..6faad91 100644 --- a/util/reloadCommands.js +++ b/util/reloadCommands.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const getSubdirFiles = require('./getSubdirFiles'); const commandPath = 'commands/' const utilPath = 'util/' diff --git a/util/timer/checkTimer.js b/util/timer/checkTimer.js index 1bea13b..8902f5c 100644 --- a/util/timer/checkTimer.js +++ b/util/timer/checkTimer.js @@ -1,5 +1,4 @@ const sendTimerReminder = require('./sendTimerReminder') -const fs = require('fs') const sqlite3 = require('sqlite3').verbose(); module.exports = async function (client) { const checkTimer = require('./checkTimer') diff --git a/util/timer/convertJSONToSQL.js b/util/timer/convertJSONToSQL.js index efa1bed..ad3d2d5 100644 --- a/util/timer/convertJSONToSQL.js +++ b/util/timer/convertJSONToSQL.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const sqlite3 = require('sqlite3').verbose(); module.exports = async function () { const timers = require('../../data/timers.json') diff --git a/util/timer/createTimer.js b/util/timer/createTimer.js index 3910d09..4ff2fb4 100644 --- a/util/timer/createTimer.js +++ b/util/timer/createTimer.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const parseTime = require('./parseTime'); const sqlite3 = require('sqlite3').verbose(); module.exports = async function (message, args, compatibility) { diff --git a/util/timer/parseTime.js b/util/timer/parseTime.js index 732fe80..e20dd99 100644 --- a/util/timer/parseTime.js +++ b/util/timer/parseTime.js @@ -30,9 +30,9 @@ module.exports = function(time, currentUnixTime){ -function getTime(time, currentUnixTime) { +// function getTime(time, currentUnixTime) { - return timeInSeconds; -} +// return timeInSeconds; +// }