Update ESLint rules, enhance environment schema with new metrics and health port, and refactor Redis import. Change TypeScript definitions path in package.json.

This commit is contained in:
smueller
2026-07-22 11:11:39 +02:00
parent c2271485a5
commit bc97d1d74c
15 changed files with 801 additions and 6 deletions

View File

@@ -0,0 +1,47 @@
import { moderationQueue } from '../../jobs.js';
import type { BotContext } from '../../types.js';
type CreateCaseInput = {
guildId: string;
targetUserId: string;
moderatorId: string;
action: string;
reason?: string;
metadata?: Record<string, unknown>;
};
export async function createCase(context: BotContext, input: CreateCaseInput) {
const lastCase = await context.prisma.case.findFirst({
where: { guildId: input.guildId },
orderBy: { caseNumber: 'desc' }
});
return context.prisma.case.create({
data: {
guildId: input.guildId,
caseNumber: (lastCase?.caseNumber ?? 0) + 1,
targetUserId: input.targetUserId,
moderatorId: input.moderatorId,
action: input.action,
reason: input.reason,
metadata: input.metadata
}
});
}
export async function scheduleTempBanExpire(
guildId: string,
userId: string,
durationMs: number,
reason?: string
) {
await moderationQueue.add(
'tempBanExpire',
{ guildId, userId, reason: reason ?? null },
{
delay: durationMs,
removeOnComplete: 1000,
removeOnFail: 500
}
);
}