From 3dfbb247da586cedabb25e6e1f6bb36e2df30e62 Mon Sep 17 00:00:00 2001 From: c0de Date: Tue, 25 Oct 2022 19:23:54 -0500 Subject: [PATCH] Change guess update logic --- GhostBallBot/game.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/GhostBallBot/game.py b/GhostBallBot/game.py index 64427d9..d38833e 100644 --- a/GhostBallBot/game.py +++ b/GhostBallBot/game.py @@ -152,8 +152,6 @@ class Game: "Invalid value. It must be between 1 and 1000 inclusive" ) - # TODO: Check if the user tried to vote before, update their vote if so - player_guess, created = GuessModel.get_or_create( game_id=self.game.game_id, player_id=self.message.author.id, @@ -161,12 +159,12 @@ class Game: ) player_guess.update(guess=value) - if not created: # They updated their guess - await self.message.channel.send( - f"<@{ str(self.message.author.id) }> your guess has been updated" - ) + if created: + return await self.message.add_reaction(emoji="\N{THUMBS UP SIGN}") - return await self.message.add_reaction(emoji="\N{THUMBS UP SIGN}") + return await self.message.channel.send( + f"<@{ str(self.message.author.id) }> your guess has been updated" + ) async def points(self): """