import { fetch } from "https://esm.town/v/std/fetch";
type GameType =
| "Bot"
| "UltraBullet"
| "Bullet"
| "Antichess"
| "Computer"
| "Horde"
| "Rapid"
| "Atomic"
| "Crazyhouse"
| "Chess960"
| "King of the Hill"
| "Top Rated"
| "Blitz"
| "Racing Kings"
| "Classical"
| "Three-check";
interface User {
name: string;
title?: string;
id: string;
}
interface Entry {
user: User;
rating: number;
gameId: string;
}
type Games = Record<GameType, Entry>;
export async function lichessTVGames(): Promise<Games> {
const channels = await fetch("https://lichess.org/api/tv/channels");
return await channels.json();
}