Usage
Challenges

Challenges

Lichess API Docs - Challenges (opens in a new tab)

Create a challenge

lichess.challenge.create(username: string)

Accept a challenge

lichess.challenge.accept(challengeId: string)

Decline a challenge

lichess.challenge.decline(challengeId: string)

Cancel a challenge

lichess.challenge.cancel(challengeId: string)

Challenge the AI

// TODO: specify types
lichess.challenge.ai({
  level,
  clockLimit,
  clockIncrement,
  days,
  color,
  variant,
  fen,
})

Open-ended challenge

// TODO: specify types
lichess.challenge.open({
  rated,
  clockLimit,
  clockIncrement,
  days,
  color,
  variant,
  fen,
  name,
  rules,
  users,
  expiresAt,
})

Start clocks of a game

lichess.challenge.start({ gameId: string, token1: string, token2: string })

Add time to the opponent clock

lichess.challenge.grant({ gameId: string, seconds: number })

Admin challenge tokens

lichess.challenge.admin({ users: string | string[], description: string })