Files
jolb/src/handlers/callbacks/restart-game.ts
T
2026-06-26 20:42:38 -04:00

11 lines
352 B
TypeScript

import { getContextPlayerOrThrow, getGameOrThrow } from "data";
import { HandlerFn } from "types";
export const restartGameHandler: HandlerFn = async (ctx) => {
const player = getContextPlayerOrThrow(ctx);
const isHost = player.isHost();
if (!isHost) return;
const game = getGameOrThrow(player.gameId);
await game.restart(ctx);
};