Mind-Sports-Games / lila

GNU Affero General Public License v3.0
11 stars 12 forks source link

API - inflate gameStart, gameFinish events #916

Closed ddugovic closed 6 days ago

ddugovic commented 1 month ago

In order to create a Twitch bot I needed to perform API calls to get game data, unlike Lichess where these events provide details such as opponent and winner/status: https://github.com/ddugovic/Twitch-Prediction-Lichess/tree/playstrategy

JamesHeppell commented 1 month ago

Thanks for the interest. It's not 100% clear what details you require, and/or if you are suggesting Lichess has made a change that we can also include? More than happy to review a suggested change and/or PR and/or link to Lichess code base etc.

It looks like you are using the game stream call/game export which can be 3 moves behind the game (as it's for streaming rather than playing, same with the general steam events). As the actual user of the game, and wanting to make moves to your game, you should be able to use the board api (similar to bot api) to get up to date info on game status etc, this is at /api/board/game/stream/:id. Maybe this assumption is wrong as you are predicting moves from other games, rather than playing them real time?

ddugovic commented 1 month ago

I'm actually just interested in predicting game outcomes, so I'm content having more gameStart / gameFinish data... predicting moves could be fun, but in most cases lila doesn't provide an adequate API (except for slow games compatible with Board API).

I created a PR for review https://github.com/Mind-Sports-Games/lila/pull/929

JamesHeppell commented 1 month ago

Thanks for the PR. We will look to review and probably release in the coming weeks.

JamesHeppell commented 6 days ago

This has now been release live, we only added the winner (PlayerIndex) which should be sufficient. You can obtain the colours of players independently.