0.2.1 • Published 3 years ago

lichessjs v0.2.1

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

LichessJS

A JavaScript library for interacting with the Lichess Bot/Board API

Installation

npm i lichessjs

Example Usage

const Lichess = require("lichessjs");

const client = new Lichess.BotClient();

const currentGames = new Set();

client.on("connected", async () => {
  console.log("Connected to Account - ", client.user.username);
});

client.on("challenge", async (challenge) => {
  const game = await challenge.accept();
  currentGames.add(game);
  game.on("myTurn", () => {
    const possibleMoves = game.possibleMoves;
    const move =
      possibleMoves[Math.floor(Math.random() * possibleMoves.length)];
    game.move(move);
  });
  game.on("end", () => {
    currentGames.delete(game);
  });
});

client.login(process.env.BOT_TOKEN);

Contributing

Feel free to open a new issue/PR to this repo!

License

MIT

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago