add discord integration

This commit is contained in:
2026-03-01 15:53:33 +01:00
parent 6861c6c178
commit 5d25a84172
5 changed files with 147 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import {
} from '$lib/server/db/schema';
import { eq, asc, sql, desc, and, inArray } from 'drizzle-orm';
import { MATCH_STATES, GAME_STATES, type MatchConfig } from './types';
import { notifyMatchCreated, notifyMatchFinished } from '$lib/server/discord/client';
// ── Queue ───────────────────────────────────────────────────────────────
@@ -241,7 +242,9 @@ export async function createMatch(opts: {
}
}
return getMatchFull(created.id);
const full = await getMatchFull(created.id);
notifyMatchCreated(full).catch(() => {});
return full;
}
// ── State Transitions ───────────────────────────────────────────────────
@@ -465,6 +468,9 @@ export async function submitGameScores(
.where(eq(match.id, game.matchId));
await updateElo(participants, matchWinner.id);
const finishedMatch = await getMatchFull(game.matchId);
notifyMatchFinished(finishedMatch).catch(() => {});
} else {
await db
.update(match)