Skip to content

Commit

Permalink
more jsdoc and better try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Nov 28, 2023
1 parent 70926c4 commit 84f7970
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/helpers/functions/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export async function computeMissingResults(
};
}

/**
* Compute missing results for all Minecraft editions
* @author Juknum
*/
export async function computeAllEditions(
client: Client,
pack: FaithfulPack,
Expand All @@ -165,16 +169,10 @@ export async function computeAllEditions(
* @param results results to format channel with
*/
export async function updateVoiceChannel(client: Client, results: MissingData) {
let packProgress: any;
try {
const prom = await axios
.get(`${client.tokens.apiUrl}settings/channels.pack_progress`)
// fix for "Error: socket hang up", I know it's stupid but it works somehow
.catch(() => axios.get(`https://api.faithfulpack.net/v2/settings/channels.pack_progress`));
packProgress = prom.data;
} catch {
return;
}
const { data: packProgress } = await axios
.get(`${client.tokens.apiUrl}settings/channels.pack_progress`)
// fix for "Error: socket hang up", I know it's stupid but it works somehow
.catch(() => axios.get(`https://api.faithfulpack.net/v2/settings/channels.pack_progress`));

const channel = client.channels.cache.get(packProgress[results.pack][results.edition]);
// channel doesn't exist or can't be fetched, return early
Expand Down

0 comments on commit 84f7970

Please sign in to comment.