Public
Script
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Gets the ascii representation of the top-rated game on Lichess TV for a given game type.

@jdan.topLichess("Blitz");
   +------------------------+
 8 | .  .  .  ♜  .  ♚  .  . |
 7 | .  ♟  .  .  .  ♟  .  ♟ |
 6 | .  .  ♟  .  .  .  ♟  . |
 5 | .  .  .  ♗  .  .  ♙  . |   ♙ mircica (2662)
 4 | .  ♙  .  ♙  ♖  .  .  ♙ |   ♟ Prul1979 (2640)
 3 | .  .  ♙  .  .  .  .  . |
 2 | .  .  .  ♔  .  .  .  . |
 1 | .  .  .  .  .  .  .  . |
   +------------------------+
     a  b  c  d  e  f  g  h

Note the supported game types are:

  • Bot
  • UltraBullet
  • Bullet
  • Computer
  • Rapid
  • Top Rated
  • Blitz
  • Classical
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { lichessGameAscii } from "https://esm.town/v/jdan/lichessGameAscii";
import { lichessTVGames } from "https://esm.town/v/jdan/lichessTVGames";
type GameType =
| "Bot"
| "UltraBullet"
| "Bullet"
| "Computer"
| "Rapid"
| "Top Rated"
| "Blitz"
| "Classical";
export const topLichess = async (gameType: GameType) => {
const games = await lichessTVGames();
return await lichessGameAscii(games[gameType].gameId);
};
October 23, 2023