Skip to content

Commit

Permalink
linted code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-NCSU committed Aug 7, 2022
1 parent 422464b commit 1f35ee9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
{ name: "/queuelength <game>", 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 });
},
Expand Down
14 changes: 7 additions & 7 deletions commands/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}.`);
}

Expand All @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion commands/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <game> <page>" });
Expand Down
4 changes: 2 additions & 2 deletions commands/unverified.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
},
Expand Down
2 changes: 1 addition & 1 deletion scheduledcommands/checkInvalid.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions scheduledcommands/combinedLB.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { EmbedBuilder } = require("@discordjs/builders");
const tokens = require("../index.js");

/**
Expand All @@ -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);
},
};

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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}
Expand All @@ -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") + "```");
}
}
6 changes: 3 additions & 3 deletions scheduledcommands/dailyLB.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 1f35ee9

Please sign in to comment.