diff --git a/commands/100-games/beatGame.js b/commands/100-games/beatGame.js index e2e151c..d3784c5 100644 --- a/commands/100-games/beatGame.js +++ b/commands/100-games/beatGame.js @@ -34,7 +34,9 @@ module.exports = { body = body.concat('fields *;'); - const res = await getGameJson(body); + let res = await getGameJson(body); + res = res.filter(entry => entry.status == 6); + res.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count)); if (!res[0]) return interaction.followUp({ content: 'No game found for the options supplied.', ephemeral: true }); diff --git a/commands/100-games/planGame.js b/commands/100-games/planGame.js index ed37c7e..943e6b0 100644 --- a/commands/100-games/planGame.js +++ b/commands/100-games/planGame.js @@ -31,7 +31,9 @@ module.exports = { body = body.concat('fields *;'); - const res = await getGameJson(body); + let res = await getGameJson(body); + res = res.filter(entry => entry.status == 6); + res.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count)); if (!res[0]) return interaction.followUp({ content: 'No game found for the options supplied.', ephemeral: true }); diff --git a/commands/100-games/startplaying.js b/commands/100-games/startplaying.js index fbb8fc8..41d795a 100644 --- a/commands/100-games/startplaying.js +++ b/commands/100-games/startplaying.js @@ -31,7 +31,9 @@ module.exports = { body = body.concat('fields *;'); - const res = await getGameJson(body); + let res = await getGameJson(body); + res = res.filter(entry => entry.status == 6); + res.sort((a, b) => parseInt(b.total_rating_count) - parseInt(a.total_rating_count)); if (!res[0]) return interaction.followUp({ content: 'No game found for the options supplied.', ephemeral: true });