lichess.org
Donate

How to get game state with lichess-bot

Hi everyone!

I've created an engine myself, which supports UCI commands, and I'm trying to implement it in a bot account in lichess. I've tried to do so by using the official lichess-bot client, and everything's worked well. However, my engine needs to know the time it has left in a game to know how much time it can spend calculating the next move. I know I can get that data from the game state, but I don't know how to get the game state. Can anybody help me?

Thanks
I've never used the Lichess API except for downloading games, nor have I used lichess-bot, but this looks like what you want: lichess.org/api#tag/Bot/operation/botGameStream

In lichess-bot, it looks like there is a Game class with a my_remaining_time() method which seems to do what you want. I'm guessing you have access to a Game object for the game, but as I said I've never used lichess-bot.