From bf3b4444fabd9fb899f8651de2f772f148042426 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 13 Dec 2020 09:54:22 -0500 Subject: [PATCH] Fix --- commands/games-mp/typing-race.js | 4 ++-- commands/games-sp/reaction-time.js | 4 ++-- commands/games-sp/typing-test.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/games-mp/typing-race.js b/commands/games-mp/typing-race.js index 0ea85729..975189f2 100644 --- a/commands/games-mp/typing-race.js +++ b/commands/games-mp/typing-race.js @@ -48,12 +48,12 @@ module.exports = class TypingRaceCommand extends Command { const newScore = Date.now() - now; const highScoreGet = await this.client.redis.get('typing-test'); const highScore = highScoreGet ? Number.parseInt(highScoreGet, 10) : null; - if (!highScore || highScore < newScore) await this.client.redis.set('typing-test', newScore); + if (!highScore || highScore > newScore) await this.client.redis.set('typing-test', newScore); this.client.games.delete(msg.channel.id); if (!winner.size) return msg.say('Oh... No one won.'); return msg.say(stripIndents` The winner is ${winner.first().author}! (Took ${newScore / 1000} seconds) - ${!highScore || highScore < newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} + ${!highScore || highScore > newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} `); } catch (err) { this.client.games.delete(msg.channel.id); diff --git a/commands/games-sp/reaction-time.js b/commands/games-sp/reaction-time.js index d2cd7e72..c3db211f 100644 --- a/commands/games-sp/reaction-time.js +++ b/commands/games-sp/reaction-time.js @@ -32,12 +32,12 @@ module.exports = class ReactionTimeCommand extends Command { const newScore = Date.now() - now; const highScoreGet = await this.client.redis.get('reaction-time'); const highScore = highScoreGet ? Number.parseInt(highScoreGet, 10) : null; - if (!highScore || highScore < newScore) await this.client.redis.set('reaction-time', newScore); + if (!highScore || highScore > newScore) await this.client.redis.set('reaction-time', newScore); this.client.games.delete(msg.channel.id); if (!msgs.size) return msg.say('Failed to answer within 30 seconds.'); return msg.say(stripIndents` Nice one! (Took ${newScore / 1000} seconds) - ${!highScore || highScore < newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} + ${!highScore || highScore > newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} `); } catch (err) { this.client.games.delete(msg.channel.id); diff --git a/commands/games-sp/typing-test.js b/commands/games-sp/typing-test.js index cdcadaa9..f4144c6f 100644 --- a/commands/games-sp/typing-test.js +++ b/commands/games-sp/typing-test.js @@ -47,12 +47,12 @@ module.exports = class TypingTestCommand extends Command { const newScore = Date.now() - now; const highScoreGet = await this.client.redis.get('typing-test'); const highScore = highScoreGet ? Number.parseInt(highScoreGet, 10) : null; - if (!highScore || highScore < newScore) await this.client.redis.set('typing-test', newScore); + if (!highScore || highScore > newScore) await this.client.redis.set('typing-test', newScore); if (!msgs.size) return msg.reply('Sorry! You lose!'); if (msgs.first().content !== sentence) return msg.reply('Sorry! You made a typo, so you lose!'); return msg.reply(stripIndents` Nice job! 10/10! You deserve some cake! (Took ${newScore / 1000} seconds) - ${!highScore || highScore < newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} + ${!highScore || highScore > newScore ? `**New High Score!** Old:` : `High Score:`} ${highScore / 1000} `); } };