From e9eb062c40939b729dc9735fe6efb2bd813a6b16 Mon Sep 17 00:00:00 2001 From: baz Date: Sun, 11 Feb 2024 20:23:08 +0000 Subject: [PATCH] Update beatGame command --- commands/100-games/beatGame.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/100-games/beatGame.js b/commands/100-games/beatGame.js index b18eec8..3fcb37b 100644 --- a/commands/100-games/beatGame.js +++ b/commands/100-games/beatGame.js @@ -1,6 +1,6 @@ const { SlashCommandBuilder, EmbedBuilder } = require('discord.js'); const { getCoverURL, getGameJson } = require('../../igdbHelperFunctions.js'); -const { checkGameStorage, getUserRegistration, createBeatenGameEntry, getBeatenGameCount } = require('../../databaseHelperFunctions.js'); +const { checkGameStorage, getUserRegistration, createBeatenGameEntry, getBeatenGameCount, getPlanningGameCount, getPlayingGameCount } = require('../../databaseHelperFunctions.js'); module.exports = { data: new SlashCommandBuilder() @@ -46,7 +46,9 @@ module.exports = { if (!(await createBeatenGameEntry(userDatabaseEntry, gameDatabaseEntry))) return interaction.followUp({ content: `${game.name} already beaten.`, ephemeral: true }); - const num = await getBeatenGameCount(userDatabaseEntry); + const beatNum = await getBeatenGameCount(userDatabaseEntry); + const planNum = await getPlanningGameCount(userDatabaseEntry); + const playNum = await getPlayingGameCount(userDatabaseEntry); const coverUrl = await getCoverURL(game.cover); const embed = new EmbedBuilder() @@ -54,13 +56,13 @@ module.exports = { .setAuthor({ name: `${interaction.user.displayName} beat a new game!`, iconURL: interaction.user.avatarURL() }) .setTitle(`${game.name} beaten!`) .setThumbnail(`${coverUrl}`) - .setDescription(`${interaction.user.displayName} has beaten ${num} games, they have ${100 - num} games remaining.`) + .setDescription(`${interaction.user.displayName} has ${planNum} games planned, they are playing ${playNum} games, they have beaten ${beatNum} games, they have ${100 - beatNum} games remaining.`) .setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() }) .setTimestamp(); await interaction.followUp({ embeds: [embed] }); - if (num == 100) { + if (beatNum == 100) { const challengeCompletedEmbed = new EmbedBuilder() .setColor(0xFFD700) .setAuthor({ name: `${interaction.user.displayName} has completed the 100 Game Challenge!`, iconURL: interaction.user.avatarURL() })