Use the with statement on the game class

This is because the class is a context manager / state machine
This commit is contained in:
2022-10-24 19:55:50 -05:00
parent 7101db5394
commit 1845e42488
3 changed files with 31 additions and 15 deletions

View File

@@ -15,8 +15,8 @@ class GhostBallClient(discord.Client):
def __init__(self, *args, **kwargs):
super(GhostBallClient, self).__init__(*args, **kwargs)
self.game = game.Game()
self.game.discord = self
with game.Game() as self.game:
self.game.discord = self
async def on_ready(self):
print("Logged on as", self.user)