Implement warning system enhancements with unique identifiers

- Added a `warningNumber` field to the `Warning` model for sequential identification of warnings.
- Updated the `createWarning` function to handle the new `warningNumber` logic and notify users via DM upon receiving a warning.
- Refactored moderation commands to utilize the new warning system, including changes to the warning creation and removal processes.
- Enhanced the WebUI to display warning numbers in the warnings table and updated localization for related messages.
- Documented changes in phase tracking to reflect the new warning system features.
This commit is contained in:
TheOnlyMace
2026-07-25 17:31:28 +02:00
parent 061e287390
commit 2058713e03
14 changed files with 218 additions and 52 deletions

View File

@@ -88,8 +88,8 @@ export const commandLocales = {
en: 'Optional escalation reason'
},
'moderation.warn.options.warning_id': {
de: 'Verwarnungs-ID',
en: 'Warning ID'
de: 'Kurze Verwarnungsnummer (z. B. aus /warn list)',
en: 'Short warning number (e.g. from /warn list)'
},
'moderation.choice.timeout': {
de: 'Timeout',

View File

@@ -101,6 +101,7 @@ export type CaseListQuery = z.infer<typeof CaseListQuerySchema>;
export const WarningDashboardSchema = z.object({
id: z.string(),
warningNumber: z.number().int().positive(),
userId: z.string(),
moderatorId: z.string(),
reason: z.string().nullable(),

View File

@@ -133,10 +133,12 @@ const de: Dictionary = {
'Der Bot kann dieses Mitglied wegen der Rollenhierarchie oder fehlender Rechte nicht moderieren.',
'moderation.hierarchy.notMember': 'Dieses Mitglied ist nicht auf dem Server.',
'moderation.reason.none': 'Kein Grund angegeben',
'moderation.warning.created': 'Verwarnung erstellt: {warningId}',
'moderation.warning.created': 'Verwarnung #{warningNumber} erstellt.',
'moderation.warning.none': 'Keine Verwarnungen vorhanden.',
'moderation.warning.defaultReason': 'Kein Grund',
'moderation.warning.notFound': 'Verwarnung nicht gefunden.',
'moderation.warning.dm':
'Du hast eine Verwarnung auf **{guild}** erhalten.\nGrund: {reason}\nVerwarnungen: {count} (Nr. #{warningNumber})',
'moderation.purge.done': '{deletedCount} Nachrichten gelöscht (Fall #{caseNumber}).',
'moderation.note.none': 'Keine Notizen vorhanden.',
'moderation.case.notFound': 'Fall nicht gefunden.',
@@ -750,10 +752,12 @@ const en: Dictionary = {
'The bot cannot moderate this member due to role hierarchy or missing permissions.',
'moderation.hierarchy.notMember': 'That member is not on this server.',
'moderation.reason.none': 'No reason provided',
'moderation.warning.created': 'Warning created: {warningId}',
'moderation.warning.created': 'Warning #{warningNumber} created.',
'moderation.warning.none': 'No warnings.',
'moderation.warning.defaultReason': 'No reason',
'moderation.warning.notFound': 'Warning not found.',
'moderation.warning.dm':
'You received a warning on **{guild}**.\nReason: {reason}\nWarnings: {count} (No. #{warningNumber})',
'moderation.purge.done': 'Deleted {deletedCount} messages (case #{caseNumber}).',
'moderation.note.none': 'No notes.',
'moderation.case.notFound': 'Case not found.',