chore: some error protection

This commit is contained in:
ethanf 2024-02-02 02:39:02 -06:00
parent 1c0144b076
commit 2034c56208

View File

@ -766,6 +766,7 @@ client.on("interactionCreate", async (interaction) => {
a.player.displayName.localeCompare(b.player.displayName)
);
try {
let teamStr = `${backticks}BLU:`;
for (const player of bluPlayers) {
teamStr += `\n${player.player.displayName}`;
@ -777,6 +778,10 @@ client.on("interactionCreate", async (interaction) => {
teamStr += backticks;
await interaction.followUp(teamStr);
} catch (error) {
console.error(error);
await interaction.followUp("Couldn't print teams before moving players");
}
let moveErr = 0;
@ -978,6 +983,10 @@ client.on("messageCreate", async (message) => {
for (const [playerId, rank] of Object.entries(rankings)) {
if (rank > 0) {
const player = await pickupGuild.members.fetch(playerId);
if (!player) {
console.error(`Could not find player ${playerId}`);
continue;
}
const applicableName = getApplicableName(player);
players.push({ name: applicableName, rank });
}