/lichess-client

node.js lichess API wrapper

Primary LanguageJavaScriptMIT LicenseMIT

lichess-client

♟️ node.js lichess API wrapper ♙

Getting Started

To use, install via npm, include lichess-client in your project, and initialize with your API token:

npm install lichess-client
const Lichess = require('lichess-client')
const lichess = new Lichess('apitoken')

Usage

Account

lichess.account.account()
lichess.account.email()
lichess.account.preferences()
lichess.account.kid()

Note: You will need preference:write permissions for the associated API token

lichess.account.kidOn()

Note: You will need preference:write permissions for the associated API token

lichess.account.kidOff()

Users

let usernames = ['bestplayerever', 'runnerup']
lichess.users.statusesByUsernames(usernames)
let username = 'bestplayerever'
lichess.users.get(username)
let username = 'bestplayerever'
lichess.users.activityByUsername(username)
let usernames = ['bestplayerever', 'runnerup']
lichess.users.listByUsernames(usernames)
let team = 'ateam'
lichess.users.listByTeamId(team)
lichess.users.listStreams()
let titles = ['GM', 'WCM']
let options = { online: false }
lichess.users.listByTitle(titles, options)

Games

let gameId = '123'
let options = { moves: true } // all options specified in API docs
lichess.games.get(gameId, options)
let username = 'bestplayerever'
let options = { max: 5 } // all options specified in API docs
lichess.games.listByUser(username, options)
let ids = ['123', '456']
let options = { moves: true } // all options specified in API docs
lichess.games.listByIds(ids, options)
let options = { nb: 15 } // all options specified in API docs
lichess.games.current(options)
lichess.games.currentTv(options)

Relations

let username = 'bestplayerever'
lichess.relations.following(username)
let username = 'bestplayerever'
lichess.relations.followers(username)

API coverage

Account

  • Get my profile (0.0.4)
  • Get my email address (0.0.4)
  • Get my preferences (0.0.4)
  • Get my kid mode status (0.0.4)
  • Set my kid mode status (0.0.4)

Users

  • Get real-time users status (0.0.6)
  • Get user public data (0.0.6)
  • Get user activity (0.0.6)
  • Get users by ID (0.0.6)
  • Get members of a team (0.0.6)
  • Get live streamers (0.0.6)
  • Get titled users (0.0.6)

Relations

  • Get users followed by a user (0.0.5)
  • Get users who follow a user (0.0.5)

Games

  • Export one game (0.0.2)
  • Export games of a user (0.0.2)
  • Export games by IDs (0.0.3)
  • Stream current games
  • Get ongoing games (0.0.3)
  • Get current TV games (0.0.3)

Teams

  • Get members of a team

Challenges

  • Stream incoming events
  • Create a challenge
  • Accept a challenge
  • Decline a challenge

Chess Bot

  • Upgrade to bot account
  • Stream incoming events
  • Stream game state
  • Make a move
  • Write in the chat
  • Abort a game
  • Resign a game

Tournaments

  • Get current tournaments
  • Create a new tournament
  • Export games of a tournament
  • Get results of a tournament