Skip to content

Commit 256bce1

Browse files
committed
Merge branch 'main' into Unverified-Role
2 parents d50f8b1 + 26cb9c7 commit 256bce1

File tree

7 files changed

+37
-26
lines changed

7 files changed

+37
-26
lines changed

API/stats/talismans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = async (profile) => {
6666
output.enriched++;
6767
}
6868
}
69-
if(profile.rift.access.consumed_prism === true) {
69+
if (profile?.rift?.access?.consumed_prism === true) {
7070
output.magicPower += 11
7171
}
7272

src/discord/commands/forceUpdateEveryone.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333
.setTitle("Updating Users")
3434
.setDescription(`Progress: 0 / ${Object.keys(linked).length} (\`0%\`)`)
3535
.setFooter({
36-
text: `by @kathund. | /help [command] for more information`,
36+
text: `by @.kathund | /help [command] for more information`,
3737
iconURL: "https://i.imgur.com/uUuZx2E.png",
3838
});
3939

@@ -59,7 +59,7 @@ module.exports = {
5959
`Progress: ${Object.keys(linked).indexOf(id)} / ${Object.keys(linked).length} (\`${((Object.keys(linked).indexOf(id) / Object.keys(linked).length) * 100).toFixed(2)}%\`)`,
6060
)
6161
.setFooter({
62-
text: `by @kathund. | /help [command] for more information`,
62+
text: `by @.kathund | /help [command] for more information`,
6363
iconURL: "https://i.imgur.com/uUuZx2E.png",
6464
});
6565

@@ -81,7 +81,7 @@ module.exports = {
8181
.setTitle("Users Updated")
8282
.setDescription(description.join("\n"))
8383
.setFooter({
84-
text: `by @kathund. | /help [command] for more information`,
84+
text: `by @.kathund | /help [command] for more information`,
8585
iconURL: "https://i.imgur.com/uUuZx2E.png",
8686
});
8787

@@ -93,7 +93,7 @@ module.exports = {
9393
.setAuthor({ name: "An Error has occurred" })
9494
.setDescription(`\`\`\`${error}\`\`\``)
9595
.setFooter({
96-
text: `by @kathund. | /help [command] for more information`,
96+
text: `by @.kathund | /help [command] for more information`,
9797
iconURL: "https://i.imgur.com/uUuZx2E.png",
9898
});
9999

src/discord/commands/linkedCommand.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module.exports = {
5252

5353
const username = await getUsername(uuid);
5454
const embed = new SuccessEmbed(`<@${user.id}> is linked to \`${username}\` (\`${uuid}\`).`, {
55-
text: `by @kathund. | /help [command] for more information`,
55+
text: `by @.kathund | /help [command] for more information`,
5656
iconURL: "https://i.imgur.com/uUuZx2E.png",
5757
});
5858
await interaction.followUp({ embeds: [embed], ephemeral: true });
@@ -68,7 +68,7 @@ module.exports = {
6868
}
6969

7070
const embed = new SuccessEmbed(`\`${name}\` (\`${uuid}\`) is linked to <@${discordID}>.`, {
71-
text: `by @kathund. | /help [command] for more information`,
71+
text: `by @.kathund | /help [command] for more information`,
7272
iconURL: "https://i.imgur.com/uUuZx2E.png",
7373
});
7474

@@ -82,7 +82,7 @@ module.exports = {
8282
.setAuthor({ name: "An Error has occurred" })
8383
.setDescription(`\`\`\`${error}\`\`\``)
8484
.setFooter({
85-
text: `by @kathund. | /help [command] for more information`,
85+
text: `by @.kathund | /help [command] for more information`,
8686
iconURL: "https://i.imgur.com/uUuZx2E.png",
8787
});
8888

src/discord/commands/unverifyCommand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333

3434
const updateRole = new SuccessEmbed(
3535
`You have successfully unlinked \`${await getUsername(uuid)}\`. Run \`/verify\` to link a new account.`,
36-
{ text: `by @kathund. | /help [command] for more information`, iconURL: "https://i.imgur.com/uUuZx2E.png" },
36+
{ text: `by @.kathund | /help [command] for more information`, iconURL: "https://i.imgur.com/uUuZx2E.png" },
3737
);
3838
await interaction.followUp({ embeds: [updateRole] });
3939
} catch (error) {
@@ -42,7 +42,7 @@ module.exports = {
4242
.setAuthor({ name: "An Error has occurred" })
4343
.setDescription(`\`\`\`${error}\`\`\``)
4444
.setFooter({
45-
text: `by @kathund. | /help [command] for more information`,
45+
text: `by @.kathund | /help [command] for more information`,
4646
iconURL: "https://i.imgur.com/uUuZx2E.png",
4747
});
4848

src/discord/commands/updateCommand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ module.exports = {
158158

159159
const updateRole = new SuccessEmbed(
160160
`<@${interaction.user.id}>'s roles have been successfully synced with \`${player.nickname ?? "Unknown"}\`!`,
161-
{ text: `by @kathund. | /help [command] for more information`, iconURL: "https://i.imgur.com/uUuZx2E.png" },
161+
{ text: `by @.kathund | /help [command] for more information`, iconURL: "https://i.imgur.com/uUuZx2E.png" },
162162
);
163163

164164
await interaction.followUp({ embeds: [updateRole], ephemeral: true });
@@ -168,7 +168,7 @@ module.exports = {
168168
.setAuthor({ name: "An Error has occurred" })
169169
.setDescription(`\`\`\`${error}\`\`\``)
170170
.setFooter({
171-
text: `by @kathund. | /help [command] for more information`,
171+
text: `by @.kathund | /help [command] for more information`,
172172
iconURL: "https://i.imgur.com/uUuZx2E.png",
173173
});
174174

src/discord/commands/verifyCommand.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = {
8181
.setAuthor({ name: "Successfully linked!" })
8282
.setDescription(`${user ? `<@${user.id}>'s` : "Your"} account has been successfully linked to \`${nickname}\``)
8383
.setFooter({
84-
text: `by @kathund. | /help [command] for more information`,
84+
text: `by @.kathund | /help [command] for more information`,
8585
iconURL: "https://i.imgur.com/uUuZx2E.png",
8686
});
8787

@@ -109,7 +109,7 @@ module.exports = {
109109
.setAuthor({ name: "An Error has occurred" })
110110
.setDescription(`\`\`\`${error}\`\`\``)
111111
.setFooter({
112-
text: `by @kathund. | /help [command] for more information`,
112+
text: `by @.kathund | /help [command] for more information`,
113113
iconURL: "https://i.imgur.com/uUuZx2E.png",
114114
});
115115

@@ -129,11 +129,11 @@ module.exports = {
129129
)
130130
.setImage("https://media.discordapp.net/attachments/922202066653417512/1066476136953036800/tutorial.gif")
131131
.setFooter({
132-
text: `by @kathund. | /help [command] for more information`,
132+
text: `by @.kathund | /help [command] for more information`,
133133
iconURL: "https://i.imgur.com/uUuZx2E.png",
134134
});
135135

136-
await interaction.followUp({ embeds: [verificationTutorialEmbed], ephemeral: true });
136+
await interaction.followUp({ embeds: [verificationTutorialEmbed], ephemeral: true });
137137
}
138138
}
139139
},

src/minecraft/commands/personalBestCommand.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ class PersonalBestCommand extends minecraftCommand {
2929
username = this.getArgs(message)[0] || username;
3030
const floor = (this.getArgs(message)[1] ?? "M7").toLowerCase();
3131
const rank = (this.getArgs(message)[2] ?? "S+").toLowerCase();
32+
const floors = ["e", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "m1", "m2", "m3", "m4", "m5", "m6", "m7"];
33+
const ranks = ["", "s", "s+"];
34+
if (floors.includes(floor) === false) {
35+
// eslint-disable-next-line no-throw-literal
36+
throw "Invalid Usage: !pb [user] [floor (m7/f4/etc)] [rank (S+, S, any)]";
37+
}
38+
if (ranks.includes(rank) === false) {
39+
// eslint-disable-next-line no-throw-literal
40+
throw "Invalid Usage: !pb [user] [floor (m7/f4/etc)] [rank (S+, S, any)]";
41+
}
3242

3343
const data = await getLatestProfile(username);
3444

@@ -41,41 +51,42 @@ class PersonalBestCommand extends minecraftCommand {
4151
throw `${username} has never played dungeons on ${data.profileData.cute_name}.`;
4252
}
4353

44-
let requested_floor = dungeons.catacombs;
54+
let requested_floor = null;
4555
let time = 0;
4656
const floor_type = floor.charAt(floor.length - 2);
4757
const floor_number = floor.charAt(floor.length - 1);
4858
switch (floor_type) {
4959
case "m":
50-
requested_floor = dungeons.catacombs?.MASTER_MODE_FLOORS?.[`floor_${floor_number}`] ?? null;
60+
requested_floor = dungeons.catacombs?.MASTER_MODE_FLOORS?.[`floor_${floor_number}`] || null;
5161
break;
5262
case "f":
53-
requested_floor = dungeons.catacombs?.floors?.[`floor_${floor_number}`] ?? null;
63+
requested_floor = dungeons.catacombs?.floors?.[`floor_${floor_number}`] || null;
5464
break;
5565
case "e":
56-
requested_floor = dungeons.catacombs?.floors?.entrance ?? null;
66+
requested_floor = dungeons.catacombs?.floors?.entrance || null;
5767
break;
5868
default:
59-
this.send("/gc Invalid Usage: !pb [user] [floor (m7/f4/etc)] [rank (S+, S, any)]");
60-
break;
69+
// eslint-disable-next-line no-throw-literal
70+
throw "Invalid Usage: !pb [user] [floor (m7/f4/etc)] [rank (S+, S, any)]";
6171
}
6272
// eslint-disable-next-line no-throw-literal
6373
if (requested_floor === null) throw `${username} has never gotten a ${rank} on ${floor} before.`;
6474

6575
switch (rank) {
6676
case "s+":
67-
time = requested_floor.fastest_s_plus;
77+
time = requested_floor?.fastest_s_plus || 0;
6878
break;
6979
case "s":
70-
time = requested_floor.fastest_s;
80+
time = requested_floor?.fastest_s || 0;
7181
break;
7282
default:
73-
this.send("/gc Invalid Usage: !pb [user] [floor (m7/f4/etc)] [rank (S+, S, any)]");
83+
time = requested_floor?.fastest || 0;
7484
break;
7585
}
7686

7787
if (time === 0) {
78-
this.send(`/gc ${username} has no PB on ${floor} ${rank}`);
88+
// eslint-disable-next-line no-throw-literal
89+
throw `${username} has no PB on ${floor} ${rank}`;
7990
} else {
8091
this.send(`/gc ${username}'s PB on ${floor} with ${rank} rank is ${millisToMinutesAndSeconds(time)}`);
8192
}

0 commit comments

Comments
 (0)