The code template to make a Lichess Bot and deploy it to heroku server easily. This is the code of @hyper-stockfish and similar heroku run bots in lichess.org
Engine communication code taken from https://github.com/ShailChoksi/lichess-bot by ShailChoksi
Container
(allowing a maximum hash size of 512 mb)
- Fork this repository.
- Install Heroku CLI and create a new app in Heroku.
Do note that in certain operating systems Heroku CLI doesn't get added to path automatically. If that's the case you'll have to add heroku to your path manually. - Run this command in cmd or powershell
heroku stack:set container -a appname
, whereappname
is replaced with your Heroku app's name.- Create a new heroku app. - Open the
Settings
tab on heroku and insert your API access token withbot:play
scopes enabled in theConfig vars
field in the formatLICHESS_BOT_TOKEN:API-ACCESS-TOKEN
, where you replaceAPI-ACCESS-TOKEN
with your API Access token. - Go to the
Deploy
tab and clickConnect to GitHub
. - Click on
search
and then select your fork of this repository. - Then
Enable Automatic Deploys
and then select themain
branch (which is already done by default usually) and ClickDeploy
. - Once it has been deployed, go to
Resources
tab on heroku and enable dynos. (Do note that if you don't see any dynos in theResources
tab, then you must wait for about 5 minutes and then refresh your heroku page.) - NOTE if your bot stopped playing but online go to heroku and click on more > restart all dynos
You're now connected to lichess and awaiting challenges! Your bot is up and ready!
this repo has 3 chess engines if you want to change engine you have to change Dockerfile default is multifish.sh multifish is multivariant stockfish but if you want fairy stockfish change it to fairyfish.sh or you want to add orginal stockfish change it to realsf.sh and deploy your bot in heroku again