BaseballBot/game/new_game.py
Zed 3525ea42e1 Jack's Changes (#1)
First merge after adding branch

Co-authored-by: c0de <c0de@c0de.dev>
Reviewed-on: c0de/BaseballBot#1
Co-authored-by: Zed <benolken5@gmail.com>
Co-committed-by: Zed <benolken5@gmail.com>
2024-04-23 22:19:20 +00:00

32 lines
970 B
Python

#!/usr/bin/env python3
# Copyright 2022 - c0de <c0de@c0de.dev>
# Licensed under the MIT License (https://opensource.org/licenses/MIT)
# pylint: disable=missing-module-docstring,too-few-public-methods
from database.models import GameModel as Game
from game.base import BaseGameManager
class NewGameManager(BaseGameManager):
"""Commands that run at the start of a new game"""
def __init__(self):
super().__init__()
self.commands.append(("bb", self.start))
async def start(self):
"""
Start command - Starts a new game if there isn't already one running
"""
if self.is_running:
return await self.message.channel.send("A game is already running")
self.is_running = True
# game.pitch_value is unknown at the start of the game
self.game = Game.create(server_id=self.message.channel.id)
await self.message.channel.send("Send me your guesses with !guess <number>")