rhgrant10 / berserk

Python client for the lichess API
https://berserk.readthedocs.io
Other
142 stars 36 forks source link

How know the type of color on a challenge Random Color? #28

Closed 9acca9 closed 3 years ago

9acca9 commented 3 years ago
berserk version: 0.10.0
Python version: 3.9.2
Operating System: Manjaro Linux (last version)

Hello. How do I know what kind of color is going to play in this kind of situation. I mean a "challenge" with a random color. I accept the challenge, and in the indications of the "challenge" I only see that it is random. How can I find out what kind of color I got after accepting the challenge?


board = berserk.clients.Board(session)
reto = berserk.clients.Challenges(session) 

for event in board.stream_incoming_events():
        print (event) 
        if event['type'] == "challenge":
            reto.accept(event['challenge']['id'])

{'type': 'challenge', 'challenge': {'id': 'bbbbbbb', 'url': 'https://lichess.org/bbbbbbbb', 'status': 'created', 'challenger': {'id': 'xxxxxxxx', 'name': 'xxxxxx', 'title': None, 'rating': 1500, 'provisional': True, 'online': True}, 'destUser': {'id': 'bbbbbbbb', 'name': 'bbbbbbb', 'title': None, 'rating': 1404, 'provisional': True, 'online': True}, 'variant': {'key': 'standard', 'name': 'Standard', 'short': 'Std'}, 'rated': False, 'speed': 'correspondence', 'timeControl': {'type': 'unlimited'}, 'color': 'random', 'perf': {'icon': ';', 'name': 'Correspondence'}}}

9acca9 commented 3 years ago

HI. I already solve this. Thanks. I dont know how to delete this, sorry.