- Implemented AutoMod capabilities including spam filtering, anti-raid, and anti-nuke actions. - Added Logging module to track moderation actions and events across the bot. - Introduced Welcome module for customizable welcome messages and autoroles. - Developed Verification system with captcha and role assignment features. - Updated Prisma schema to include new models for AutoMod, Logging, Welcome, and Verification. - Enhanced command localization for new features in both German and English. - Improved health server to handle captcha verification requests. - Added new environment variable for public base URL to support captcha links.
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const CaseAuditSourceSchema = z.enum([
|
|
'slash_command',
|
|
'button_confirmation',
|
|
'escalation',
|
|
'job',
|
|
'automod'
|
|
]);
|
|
|
|
export type CaseAuditSource = z.infer<typeof CaseAuditSourceSchema>;
|
|
|
|
export const PurgeAuditFiltersSchema = z.object({
|
|
targetUserId: z.string().nullable().optional(),
|
|
botsOnly: z.boolean().optional(),
|
|
linksOnly: z.boolean().optional(),
|
|
attachmentsOnly: z.boolean().optional(),
|
|
regex: z.string().nullable().optional()
|
|
});
|
|
|
|
export const CaseAuditMetadataSchema = z
|
|
.object({
|
|
source: CaseAuditSourceSchema,
|
|
recordedAt: z.string().datetime(),
|
|
channelId: z.string().optional(),
|
|
confirmed: z.boolean().optional(),
|
|
escalation: z.boolean().optional(),
|
|
warningCount: z.number().int().positive().optional(),
|
|
durationMs: z.number().int().positive().optional(),
|
|
deletedCaseId: z.string().optional(),
|
|
deletedCaseNumber: z.number().int().positive().optional(),
|
|
purge: z
|
|
.object({
|
|
requestedAmount: z.number().int().positive(),
|
|
deletedCount: z.number().int().nonnegative(),
|
|
filters: PurgeAuditFiltersSchema.optional()
|
|
})
|
|
.optional()
|
|
})
|
|
.passthrough();
|
|
|
|
export type CaseAuditMetadata = z.infer<typeof CaseAuditMetadataSchema>;
|
|
|
|
type BuildCaseMetadataInput = {
|
|
source: CaseAuditSource;
|
|
channelId?: string;
|
|
extras?: Record<string, unknown>;
|
|
};
|
|
|
|
export function buildCaseMetadata(input: BuildCaseMetadataInput): CaseAuditMetadata {
|
|
return CaseAuditMetadataSchema.parse({
|
|
source: input.source,
|
|
recordedAt: new Date().toISOString(),
|
|
channelId: input.channelId,
|
|
...input.extras
|
|
});
|
|
}
|