2.0.0 • Published 5 years ago

lichess-client v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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

Get my profile
lichess.account.account()
Get my email address
lichess.account.email()
Get my preferences
lichess.account.preferences()
Get my kid mode status
lichess.account.kid()
Turn on kid mode

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

lichess.account.kidOn()
Turn off kid mode

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

lichess.account.kidOff()

Users

Get real-time users status
let usernames = ['bestplayerever', 'runnerup']
lichess.users.statusesByUsernames(usernames)
Get user public data
let username = 'bestplayerever'
lichess.users.get(username)
Get user activity
let username = 'bestplayerever'
lichess.users.activityByUsername(username)
Get users by ID
let usernames = ['bestplayerever', 'runnerup']
lichess.users.listByUsernames(usernames)
Get members of a team
let team = 'ateam'
lichess.users.listByTeamId(team)
Get live streamers
lichess.users.listStreams()
Get titled users
let titles = ['GM', 'WCM']
let options = { online: false }
lichess.users.listByTitle(titles, options)

Games

Export one game
let gameId = '123'
let options = { moves: true } // all options specified in API docs
lichess.games.get(gameId, options)
Export games of a user
let username = 'bestplayerever'
let options = { max: 5 } // all options specified in API docs
lichess.games.listByUser(username, options)
Export games by IDs
let ids = ['123', '456']
let options = { moves: true } // all options specified in API docs
lichess.games.listByIds(ids, options)
Get ongoing games
let options = { nb: 15 } // all options specified in API docs
lichess.games.current(options)
Get current TV games
lichess.games.currentTv(options)

Relations

Get users followed by a user
let username = 'bestplayerever'
lichess.relations.following(username)
Get users who follow a user
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
2.0.0

5 years ago

1.0.0

5 years ago