Compare commits

...

2 Commits

Author SHA1 Message Date
baz 1afb610912 Updates to /globalbeatlist 2024-04-20 16:28:16 +01:00
baz 24f437bedc Add total count to /leaderboard 2024-04-20 16:24:37 +01:00
2 changed files with 14 additions and 2 deletions

View File

@ -14,6 +14,8 @@ module.exports = {
const beatenGamesDatabaseEntries = await getAllBeatenGames(); const beatenGamesDatabaseEntries = await getAllBeatenGames();
let desc = ''; let desc = '';
desc = desc.concat('__Total: ', beatenGamesDatabaseEntries.length, '__\n');
if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) { if (!beatenGamesDatabaseEntries || beatenGamesDatabaseEntries.length == 0) {
desc = 'No games beaten yet.'; desc = 'No games beaten yet.';
} else { } else {
@ -27,9 +29,8 @@ module.exports = {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(0x6441a5) .setColor(0x6441a5)
.setAuthor({ name: `${user.displayName}`, iconURL: user.avatarURL() })
.setThumbnail(interaction.client.user.avatarURL()) .setThumbnail(interaction.client.user.avatarURL())
.setTitle('Global Beat List') .setTitle('The 100 Games Challenge Global Beat List')
.setDescription(desc) .setDescription(desc)
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() }) .setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() })
.setTimestamp(); .setTimestamp();

View File

@ -15,6 +15,17 @@ module.exports = {
await leaderboard.sort((a, b) => parseInt(b.count) - parseInt(a.count)); await leaderboard.sort((a, b) => parseInt(b.count) - parseInt(a.count));
let desc = ''; let desc = '';
let count = 0;
for (let i = 0; i < leaderboard.length; i++) {
if (leaderboard[i].count > 0) {
count += leaderboard[i].count;
}
}
desc = desc.concat('__Total: ', count, '__');
for (let i = 0; i < leaderboard.length; i++) { for (let i = 0; i < leaderboard.length; i++) {
if (leaderboard[i].count > 0) { if (leaderboard[i].count > 0) {