Refactor moderation actions to include channel and source metadata
- Updated moderation action functions to include `channelId` and `source` in the metadata for better tracking of actions. - Introduced an `auditFrom` function to streamline the addition of audit information across various commands. - Removed `prisma/migrations` from .gitignore to ensure migration files are tracked. - Enhanced the `CreateCaseInput` type to accommodate new metadata structure.
This commit is contained in:
@@ -43,7 +43,12 @@ export async function executeBan(
|
||||
moderatorId: interaction.user.id,
|
||||
action: 'BAN',
|
||||
reason: payload.reason,
|
||||
metadata: { confirmed: true }
|
||||
channelId: interaction.channelId ?? undefined,
|
||||
source: 'button_confirmation',
|
||||
metadata: {
|
||||
confirmed: true,
|
||||
duration: payload.duration
|
||||
}
|
||||
});
|
||||
|
||||
if (payload.duration) {
|
||||
@@ -98,11 +103,21 @@ export async function executePurge(
|
||||
moderatorId: interaction.user.id,
|
||||
action: 'PURGE',
|
||||
reason: `Deleted ${deletedCount} messages`,
|
||||
channelId: payload.channelId,
|
||||
source: 'button_confirmation',
|
||||
metadata: {
|
||||
confirmed: true,
|
||||
channelId: payload.channelId,
|
||||
requestedAmount: payload.amount,
|
||||
deletedCount
|
||||
purge: {
|
||||
requestedAmount: payload.amount,
|
||||
deletedCount,
|
||||
filters: {
|
||||
targetUserId: payload.targetUserId,
|
||||
botsOnly: payload.botsOnly,
|
||||
linksOnly: payload.linksOnly,
|
||||
attachmentsOnly: payload.attachmentsOnly,
|
||||
regex: payload.regex
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -147,7 +162,13 @@ export async function executeCaseDelete(
|
||||
moderatorId: interaction.user.id,
|
||||
action: 'CASE_DELETE',
|
||||
reason: `Soft-deleted case #${payload.caseNumber}`,
|
||||
metadata: { confirmed: true, deletedCaseId: existing.id }
|
||||
channelId: interaction.channelId ?? undefined,
|
||||
source: 'button_confirmation',
|
||||
metadata: {
|
||||
confirmed: true,
|
||||
deletedCaseId: existing.id,
|
||||
deletedCaseNumber: payload.caseNumber
|
||||
}
|
||||
});
|
||||
|
||||
await interaction.update({
|
||||
|
||||
Reference in New Issue
Block a user