From 1f35ee9390dbc3cbf373c06068c5e2ad48ca5a38 Mon Sep 17 00:00:00 2001 From: nathomp3 Date: Sun, 7 Aug 2022 13:35:14 -0400 Subject: [PATCH] linted code --- commands/help.js | 2 +- commands/leaderboard.js | 14 +++++++------- commands/search.js | 2 +- commands/unverified.js | 4 ++-- scheduledcommands/checkInvalid.js | 2 +- scheduledcommands/combinedLB.js | 9 +++++---- scheduledcommands/dailyLB.js | 6 +++--- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/commands/help.js b/commands/help.js index 8c82933..8134d26 100644 --- a/commands/help.js +++ b/commands/help.js @@ -27,7 +27,7 @@ module.exports = { { name: "/queuelength ", value: "Provides the number of unverified runs for the given game." }, { name: "/dream (simulations)", value: "Simulates Dream's pearl and blaze rod odds." }, { name: "/ping", value: "Provides bot response time." } - ]) + ]); await interaction.editReply("Sending you help!"); await interaction.followUp({ embeds: [embed], ephemeral: true }); }, diff --git a/commands/leaderboard.js b/commands/leaderboard.js index 951651a..31144ef 100644 --- a/commands/leaderboard.js +++ b/commands/leaderboard.js @@ -19,15 +19,15 @@ module.exports = { ) .addBooleanOption(option => option.setName("misc") - .setDescription("Include misc categories? Default: true") + .setDescription("Include misc categories? Default: true") ) .addBooleanOption(option => option.setName("fullgame") - .setDescription("Include Full Game Categories? Default: true") + .setDescription("Include Full Game Categories? Default: true") ) .addBooleanOption(option => option.setName("ils") - .setDescription("Include Individual Levels? Default: true") + .setDescription("Include Individual Levels? Default: true") ), async execute(interaction) { // From rsp via https://stackoverflow.com/questions/12303989/cartesian-product-of-multiple-arrays-in-javascript @@ -135,7 +135,7 @@ module.exports = { } } - if(!game.startsWith('hypixel_') && count + count2 > 500) { + if(!game.startsWith("hypixel_") && count + count2 > 500) { return await interaction.editReply(`Game ${game} has too many categories. Number of categories: ${count + count2}.`); } @@ -148,7 +148,7 @@ module.exports = { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); await interaction.editReply({ embeds: [embed] }); let playerList = []; // Iterates through each category @@ -241,7 +241,7 @@ module.exports = { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); await interaction.editReply({ embeds: [embed] }); lastEmbed = Math.floor(progress/10); } @@ -337,7 +337,7 @@ module.exports = { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); await interaction.editReply({ embeds: [embed] }); lastEmbed = Math.floor(progress2/10); } diff --git a/commands/search.js b/commands/search.js index 860c026..f763a5b 100644 --- a/commands/search.js +++ b/commands/search.js @@ -50,7 +50,7 @@ module.exports = { answer.forEach(entry => { embed.addFields([ {name: entry[0], value: entry[1] } - ]) + ]); }); if (answer.length == 20) { embed.setFooter({ text: "There may be more pages. Use /search " }); diff --git a/commands/unverified.js b/commands/unverified.js index b338c95..c4ecd28 100644 --- a/commands/unverified.js +++ b/commands/unverified.js @@ -41,11 +41,11 @@ module.exports = { embed.addFields([ { name: "Number of unverified runs: ", value: String(num) }, { name: "Oldest unverified run: ", value: firstPage.submitted.substring(0,10) } - ]) + ]); } else { embed.addFields([ {name: "Number of unverified runs: ", value: String(num) } - ]); + ]); } await interaction.editReply({ embeds: [embed] }); }, diff --git a/scheduledcommands/checkInvalid.js b/scheduledcommands/checkInvalid.js index 207abf8..39b9995 100644 --- a/scheduledcommands/checkInvalid.js +++ b/scheduledcommands/checkInvalid.js @@ -1,5 +1,5 @@ +const { EmbedBuilder } = require("@discordjs/builders"); const tokens = require("../index.js"); -const { EmbedBuilder } = require('@discordjs/builders'); /** * Modified version of leaderboard.js to perform daily leaderboard updates and combine data diff --git a/scheduledcommands/combinedLB.js b/scheduledcommands/combinedLB.js index 22865e5..77e9033 100644 --- a/scheduledcommands/combinedLB.js +++ b/scheduledcommands/combinedLB.js @@ -1,3 +1,4 @@ +const { EmbedBuilder } = require("@discordjs/builders"); const tokens = require("../index.js"); /** @@ -13,7 +14,7 @@ module.exports = { await findPlayers("wdmlzyxk", "3v3v3v3"); await findPlayers("vdom0912", "4v4v4v4"); await findPlayers("wkpm70jk", "4v4"); - await updateRuns("zd3q41ek"); + await updateRuns("zd3q41ek", client); }, }; @@ -59,7 +60,7 @@ async function findPlayers(category, mode) { } } -async function updateRuns(category) { +async function updateRuns(category, client) { const channel = await client.channels.cache.get("795130255324348456"); let date = new Date().toISOString().slice(0, 10); let embed = new EmbedBuilder() @@ -119,7 +120,7 @@ async function updateRuns(category) { } }; // Submits the run - await tokens.post("https://www.speedrun.com/api/v1/runs", { + const submittedRun = await tokens.post("https://www.speedrun.com/api/v1/runs", { method: "post", body: JSON.stringify(run), headers: {"Content-Type": "application/json", "X-API-Key": tokens.src} @@ -133,6 +134,6 @@ async function updateRuns(category) { await channel.send({ embeds: [embed] }); for(let i = 0; i < weblinks.length; i += 20) { - await channel.send('```\n' + weblinks.slice(i, i + 20).join('\n') + '```'); + await channel.send("```\n" + weblinks.slice(i, i + 20).join("\n") + "```"); } } \ No newline at end of file diff --git a/scheduledcommands/dailyLB.js b/scheduledcommands/dailyLB.js index c0cabf6..093256f 100644 --- a/scheduledcommands/dailyLB.js +++ b/scheduledcommands/dailyLB.js @@ -198,7 +198,7 @@ async function generateBoard(game, channel) { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); let message = await channel.send({ embeds: [embed] }); let playerList = []; // Iterates through each category @@ -291,7 +291,7 @@ async function generateBoard(game, channel) { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); await message.edit({ embeds: [embed] }); lastEmbed = Math.floor(progress/10); } @@ -387,7 +387,7 @@ async function generateBoard(game, channel) { .addFields([ { name: "Full Game Progress:", value: `${progress}/${count}` }, { name: "Individual Levels Progress:", value: `${progress2}/${count2}` } - ]) + ]); await message.edit({ embeds: [embed] }); lastEmbed = Math.floor(progress2/10); }