Implement logging for verification failures and enhance moderation responses

- Introduced a new logging event type `VERIFICATION_FAIL` to capture details of failed verification attempts, including reasons and actions taken.
- Updated moderation commands to include reasons in success messages for actions like ban, kick, and timeout.
- Enhanced the logging of ban and kick actions to include moderator information and reasons fetched from the audit log.
- Improved localization for new logging messages in both English and German.
- Documented changes in the phase tracking documentation to reflect the new logging capabilities and verification failure handling.
This commit is contained in:
TheOnlyMace
2026-07-25 16:14:41 +02:00
parent 1eec10ba80
commit dbee58cd81
11 changed files with 193 additions and 23 deletions

View File

@@ -76,7 +76,10 @@ export async function executeBan(
}
await interaction.editReply({
content: tf(locale, 'moderation.success.case', { caseNumber: modCase.caseNumber }),
content: tf(locale, 'moderation.success.caseWithReason', {
caseNumber: modCase.caseNumber,
reason: payload.reason
}),
components: []
});
}

View File

@@ -54,9 +54,12 @@ async function ensureMod(
async function replySuccessCase(
interaction: ChatInputCommandInteraction,
locale: 'de' | 'en',
caseNumber: number
caseNumber: number,
reason?: string
): Promise<void> {
const content = tf(locale, 'moderation.success.case', { caseNumber });
const content = reason
? tf(locale, 'moderation.success.caseWithReason', { caseNumber, reason })
: tf(locale, 'moderation.success.case', { caseNumber });
if (interaction.deferred || interaction.replied) {
await interaction.editReply({ content });
return;
@@ -117,7 +120,7 @@ const unbanCommand: SlashCommand = {
action: 'UNBAN',
reason
});
await replySuccessCase(interaction, locale, modCase.caseNumber);
await replySuccessCase(interaction, locale, modCase.caseNumber, reason);
}
};
@@ -139,7 +142,7 @@ const kickCommand: SlashCommand = {
action: 'KICK',
reason
});
await replySuccessCase(interaction, locale, modCase.caseNumber);
await replySuccessCase(interaction, locale, modCase.caseNumber, reason);
}
};
@@ -172,7 +175,7 @@ const timeoutCommand: SlashCommand = {
reason,
metadata: { durationMs: duration }
});
await replySuccessCase(interaction, locale, modCase.caseNumber);
await replySuccessCase(interaction, locale, modCase.caseNumber, reason);
}
};
@@ -194,7 +197,7 @@ const untimeoutCommand: SlashCommand = {
action: 'UN_TIMEOUT',
reason
});
await replySuccessCase(interaction, locale, modCase.caseNumber);
await replySuccessCase(interaction, locale, modCase.caseNumber, reason);
}
};