Change guess update logic

This commit is contained in:
c0de 2022-10-25 19:23:54 -05:00
parent f4bd33b4d5
commit 3dfbb247da

View File

@ -152,8 +152,6 @@ class Game:
"Invalid value. It must be between 1 and 1000 inclusive" "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( player_guess, created = GuessModel.get_or_create(
game_id=self.game.game_id, game_id=self.game.game_id,
player_id=self.message.author.id, player_id=self.message.author.id,
@ -161,13 +159,13 @@ class Game:
) )
player_guess.update(guess=value) player_guess.update(guess=value)
if not created: # They updated their guess if created:
await self.message.channel.send( 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" f"<@{ str(self.message.author.id) }> your guess has been updated"
) )
return await self.message.add_reaction(emoji="\N{THUMBS UP SIGN}")
async def points(self): async def points(self):
""" """
Points command - returns a table ordered from highest to lowest Points command - returns a table ordered from highest to lowest