diff --git a/commands/100-games/beatlist.js b/commands/100-games/beatlist.js index c0f371b..c93509c 100644 --- a/commands/100-games/beatlist.js +++ b/commands/100-games/beatlist.js @@ -21,16 +21,17 @@ module.exports = { if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); const beatenGamesDatabaseEntries = await getBeatenGames(userDatabaseEntry.id); - if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true }); - let desc = ''; - for (let i = 0; i < beatenGamesDatabaseEntries.length; i++) { - const gameid = await checkGameStorageId(beatenGamesDatabaseEntries[i].gameId); - const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); - const game = res[0]; - - desc = desc.concat('#', (i + 1), ' \t', game.name, '\n'); + if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) { + desc = `${user.displayName} has not beaten any games yet.`; + } else { + for (let i = 0; i < beatenGamesDatabaseEntries.length; i++) { + const gameid = await checkGameStorageId(beatenGamesDatabaseEntries[i].gameId); + const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); + const game = res[0]; + desc = desc.concat('#', (i + 1), ' \t', game.name, '\n'); + } } const embed = new EmbedBuilder() diff --git a/commands/100-games/currentlyplaying.js b/commands/100-games/currentlyplaying.js index d3681d1..08b1884 100644 --- a/commands/100-games/currentlyplaying.js +++ b/commands/100-games/currentlyplaying.js @@ -21,16 +21,17 @@ module.exports = { if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); const databaseEntries = await getPlayingGames(userDatabaseEntry.id); - if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true }); - let desc = ''; - for (let i = 0; i < databaseEntries.length; i++) { - const gameid = await checkGameStorageId(databaseEntries[i].gameId); - const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); - const game = res[0]; - - desc = desc.concat('-\t', game.name, '\n'); + if (!databaseEntries || databaseEntries.length == 0) { + desc = `${user.displayName} is currently playing no games.`; + } else { + for (let i = 0; i < databaseEntries.length; i++) { + const gameid = await checkGameStorageId(databaseEntries[i].gameId); + const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); + const game = res[0]; + desc = desc.concat('#', (i + 1), ' \t', game.name, '\n'); + } } const embed = new EmbedBuilder() diff --git a/commands/100-games/plannedGames.js b/commands/100-games/plannedGames.js index 2e3f2a3..dcfea2c 100644 --- a/commands/100-games/plannedGames.js +++ b/commands/100-games/plannedGames.js @@ -21,16 +21,17 @@ module.exports = { if (!userDatabaseEntry) return interaction.followUp({ content: `Issue checking registration with "${user.username}".`, ephemeral: true }); const databaseEntries = await getPlanningGames(userDatabaseEntry.id); - if (!databaseEntries || databaseEntries.length == 0) return interaction.followUp({ content: 'No games found.', ephemeral: true }); - let desc = ''; - for (let i = 0; i < databaseEntries.length; i++) { - const gameid = await checkGameStorageId(databaseEntries[i].gameId); - const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); - const game = res[0]; - - desc = desc.concat('-\t', game.name, '\n'); + if (!databaseEntries || databaseEntries.length == 0) { + desc = `${user.displayName} currently has no planned games.`; + } else { + for (let i = 0; i < databaseEntries.length; i++) { + const gameid = await checkGameStorageId(databaseEntries[i].gameId); + const res = await getGameJson(`where id = ${ gameid.igdb_id }; fields *;`); + const game = res[0]; + desc = desc.concat('#', (i + 1), ' \t', game.name, '\n'); + } } const embed = new EmbedBuilder()