diff --git a/commands/games-sp/google-feud.js b/commands/games-sp/google-feud.js index 7e0f883a..4c2c7c64 100644 --- a/commands/games-sp/google-feud.js +++ b/commands/games-sp/google-feud.js @@ -1,6 +1,7 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); const { MessageEmbed } = require('discord.js'); +const { formatNumber } = require('../../util/Util'); const questions = require('../../assets/json/google-feud'); module.exports = class GoogleFeudCommand extends Command { @@ -42,6 +43,7 @@ module.exports = class GoogleFeudCommand extends Command { if (!suggestions) return msg.say('Could not find any results.'); const display = new Array(suggestions.length).fill('???'); let tries = 4; + let score = 0; while (display.includes('???') && tries) { const embed = this.makeEmbed(question, tries, suggestions, display); await msg.embed(embed); @@ -54,13 +56,18 @@ module.exports = class GoogleFeudCommand extends Command { break; } const choice = msgs.first().content.toLowerCase(); - if (suggestions.includes(choice)) display[suggestions.indexOf(choice)] = choice; + if (suggestions.includes(choice)) { + score += 10000 - (suggestions.indexOf(choice) * 1000); + display[suggestions.indexOf(choice)] = choice; + } else --tries; } this.client.games.delete(msg.channel.id); - if (!display.includes('???')) return msg.say('You win! Nice job, master of Google!'); + if (!display.includes('???')) { + return msg.say(`You win! Nice job, master of Google!\n**Final Score: $${formatNumber(score)}**`); + } const final = this.makeEmbed(question, tries, suggestions, suggestions); - return msg.say('Better luck next time!', { embed: final }); + return msg.say(`Better luck next time!\n**Final Score: $${formatNumber(score)}**`, { embed: final }); } catch (err) { this.client.games.delete(msg.channel.id); return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); @@ -86,7 +93,10 @@ module.exports = class GoogleFeudCommand extends Command { .setTitle(`${question}...?`) .setDescription('Type the choice you think is a suggestion _without_ the question.') .setFooter(`${tries} ${tries === 1 ? 'try' : 'tries'} remaining!`); - for (let i = 0; i < suggestions.length; i++) embed.addField(`❯ ${10000 - (i * 1000)}`, display[i], true); + for (let i = 0; i < suggestions.length; i++) { + const num = formatNumber(10000 - (i * 1000)); + embed.addField(`❯ ${num}`, display[i], true); + } return embed; } }; diff --git a/package.json b/package.json index d4b47b7e..37f44654 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.19.12", + "version": "112.19.13", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {