forked from c0de/BaseballBot
Add !guess command
This commit is contained in:
parent
65192ab2c2
commit
305dda222f
@ -91,10 +91,26 @@ class Game:
|
|||||||
database.close()
|
database.close()
|
||||||
|
|
||||||
async def guess(self):
|
async def guess(self):
|
||||||
|
if not self.is_running:
|
||||||
|
return await self.message.channel.send("There is no game running to add guesses to")
|
||||||
|
|
||||||
|
value = int(self.message.content.split()[1])
|
||||||
|
if value < 1 or value > 1000:
|
||||||
|
return await self.message.channel.send(f"Invalid value. It must be between 1 and 1000 inclusive")
|
||||||
|
|
||||||
database.connect()
|
database.connect()
|
||||||
|
|
||||||
|
GuessModel.create(
|
||||||
|
game_id = self.game.game_id,
|
||||||
|
player_id = self.message.author.id,
|
||||||
|
player_name = self.message.author.name,
|
||||||
|
guess = value
|
||||||
|
)
|
||||||
|
|
||||||
database.close()
|
database.close()
|
||||||
|
|
||||||
|
return await self.message.add_reaction(emoji="\N{THUMBS UP SIGN}")
|
||||||
|
|
||||||
async def points(self):
|
async def points(self):
|
||||||
database.connect()
|
database.connect()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user