Compare commits
No commits in common. "348ae34dd35c2fcf96e39aa0943fc60e7a3c9f9e" and "65192ab2c2527d72618e9e1da564f33c0a401763" have entirely different histories.
348ae34dd3
...
65192ab2c2
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import dateparser
|
|
||||||
|
|
||||||
from .database.models import database, GameModel, GuessModel
|
from .database.models import database, GameModel, GuessModel
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
@ -87,47 +85,20 @@ class Game:
|
|||||||
|
|
||||||
# TODO: Determine differences
|
# TODO: Determine differences
|
||||||
|
|
||||||
await self.message.channel.send("Difference calculation is not currently available")
|
|
||||||
|
|
||||||
# stop and discard game
|
# stop and discard game
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
self.game = None
|
self.game = None
|
||||||
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()
|
||||||
|
|
||||||
value = self.message.content.split()
|
database.close()
|
||||||
try:
|
|
||||||
if len(value) > 1:
|
|
||||||
timestamp = dateparser.parse(value[1])
|
|
||||||
except:
|
|
||||||
return await self.message.channel.send("Invalid timestamp. Try again")
|
|
||||||
|
|
||||||
# database.close()
|
|
||||||
|
|
||||||
return await self.message.channel.send("Sorry, not implemented yet")
|
|
||||||
|
|
||||||
async def help(self):
|
async def help(self):
|
||||||
# TODO: Add help message
|
# TODO: Add help message
|
||||||
|
Loading…
Reference in New Issue
Block a user