Merge pull request #114 from VashSoftware/invites_catch

.catch() for dm in invites.ts
This commit is contained in:
nick
2026-03-13 09:14:43 -04:00
committed by GitHub
2 changed files with 10 additions and 12 deletions

View File

@@ -14,6 +14,8 @@ import { notifyMatchCreated, notifyMatchFinished } from '$lib/server/discord/cli
import { updateElo } from './rating';
import { getExpectedPicker, getMatchOrThrow, assertState, getMatchFull } from './helpers';
export { getMatchFull, getMatchOrThrow };
// ── Create Match ────────────────────────────────────────────────────────
export async function createMatch(opts: {

View File

@@ -68,18 +68,14 @@ export async function createInvite(opts: {
// Send Bancho DMs (best-effort)
for (const member of invitedMembers) {
try {
const u = await db.query.user.findFirst({
where: eq(user.id, member.userId)
});
if (u?.name) {
await sendDM(
u.name,
`Match invite: ${title}. Accept/decline at https://esports.vash.software/matches or reply !accept ${invite.id.slice(0, 8)}`
);
}
} catch {
// DM sending is best-effort
const u = await db.query.user.findFirst({
where: eq(user.id, member.userId)
});
if (u?.name) {
sendDM(
u.name,
`Match invite: ${title}. Accept/decline at https://esports.vash.software/matches or reply !accept ${invite.id.slice(0, 8)}`
).catch(() => {}); // Silent best-effort
}
}