summaryrefslogtreecommitdiff
path: root/swiftstory/player.py
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory/player.py')
-rw-r--r--swiftstory/player.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/swiftstory/player.py b/swiftstory/player.py
index 7193b64..011ae51 100644
--- a/swiftstory/player.py
+++ b/swiftstory/player.py
@@ -1,18 +1,19 @@
+import asyncio
import json
+from typing import Any
class Player:
- def __init__(self, client):
+ def __init__(self):
self.cards = {}
self.next_idx = 0
- self.client = client
-
self.score = 0
self.has_played = False
self.name = 'default'
+ self.notifications: asyncio.Queue = asyncio.Queue()
def pop_card(self, card_id):
return self.cards.pop(card_id)
@@ -29,10 +30,7 @@ class Player:
self.next_idx += 1
return self.next_idx - 1
- def register_notification(self, obj):
- if self.client is None:
- return
-
+ def register_notification(self, obj: Any):
message = json.dumps({'type': 'notification', 'content': obj})
- self.client.register_notification(message)
+ self.notifications.put_nowait(message)