From 80e0eb9c69d18917b158afa93fd2e4763f0b9b51 Mon Sep 17 00:00:00 2001 From: baz Date: Mon, 18 Mar 2024 19:54:35 +0000 Subject: [PATCH] Unify formatting of lists --- commands/100-games/beatlist.js | 5 +++-- commands/100-games/currentlyplaying.js | 5 +++-- commands/100-games/plannedGames.js | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/commands/100-games/beatlist.js b/commands/100-games/beatlist.js index 604612c..d2aeae3 100644 --- a/commands/100-games/beatlist.js +++ b/commands/100-games/beatlist.js @@ -26,13 +26,14 @@ module.exports = { if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) { desc = `${user.displayName} has not beaten any games yet.`; } else { - desc = desc.concat('__Total: ', beatenGamesDatabaseEntries.length, '/100__\n\n'); + desc = desc.concat('__Total: ', beatenGamesDatabaseEntries.length, '/100__\n'); 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), '** ', game.name, '\n'); + const date = beatenGamesDatabaseEntries[i].updatedAt.toLocaleDateString('en-GB', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '/'); + desc = desc.concat('**#', (i + 1), ' (', date, ')**: ', game.name, '\n'); } } diff --git a/commands/100-games/currentlyplaying.js b/commands/100-games/currentlyplaying.js index 150f8ee..d33a2a4 100644 --- a/commands/100-games/currentlyplaying.js +++ b/commands/100-games/currentlyplaying.js @@ -26,13 +26,14 @@ module.exports = { if (!databaseEntries || databaseEntries.length == 0) { desc = `${user.displayName} is currently playing no games.`; } else { - desc = desc.concat('__Total: ', databaseEntries.length, '__\n\n'); + desc = desc.concat('__Total: ', databaseEntries.length, '__\n'); 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), '** ', game.name, '\n'); + const date = databaseEntries[i].updatedAt.toLocaleDateString('en-GB', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '/'); + desc = desc.concat('**#', (i + 1), ' (', date, ')**: ', game.name, '\n'); } } diff --git a/commands/100-games/plannedGames.js b/commands/100-games/plannedGames.js index ff02cb6..f24a34c 100644 --- a/commands/100-games/plannedGames.js +++ b/commands/100-games/plannedGames.js @@ -26,7 +26,7 @@ module.exports = { if (!databaseEntries || databaseEntries.length == 0) { desc = `${user.displayName} currently has no planned games.`; } else { - desc = desc.concat('__Total: ', databaseEntries.length, '__\n\n'); + desc = desc.concat('__Total: ', databaseEntries.length, '__\n'); for (let i = 0; i < databaseEntries.length; i++) { const gameid = await checkGameStorageId(databaseEntries[i].gameId);