Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Int-CI-Moderation: Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
RadiatedExodus committed Feb 25, 2024
1 parent 17960ee commit 9cea3d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/interactions/commands/moderation/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export const Command: MeteoriumChatCommand = {
);
if (!embed) return await interaction.editReply("The case you specified doesn't exist.");

// Logging
await client.dbUtils.sendGuildLog(interaction.guildId, {
content: `Case #${caseId} viewed.`,
embeds: [embed],
});

return await interaction.editReply({ embeds: [embed] });
},
};
13 changes: 12 additions & 1 deletion src/interactions/commands/moderation/editCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,22 @@ export const Command: MeteoriumChatCommand = {
});

// Edit the reply
const editCount = await client.db.moderationCaseHistory.count({ where: { GlobalCaseId: caseId } });
await interaction.editReply({
content: `Case #${caseId} edited. (Edit #${await client.db.moderationCaseHistory.count({ where: { GlobalCaseId: caseId } })})`,
content: `Case #${caseId} edited. (Edit #${editCount})`,
embeds: [newDataEmbed],
components: [],
});

// Logging
await client.dbUtils.sendGuildLog(interaction.guildId, {
content: `Case #${caseId} edited. (Edit #${editCount}) (new top, previous bottom)`,
embeds: [
await client.dbUtils.generateCaseEmbedFromData(newCaseData, interaction.user, true, true),
await client.dbUtils.generateCaseEmbedFromData(caseData, interaction.user, true, true),
],
});

break;
}
case "no": {
Expand Down
8 changes: 8 additions & 0 deletions src/interactions/commands/moderation/removeCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ export const Command: MeteoriumChatCommand = {
// Edit interaction reply
await interaction.editReply({ content: replyContent, embeds: [], components: [] });

// Logging
await client.dbUtils.sendGuildLog(interaction.guildId, {
content: `Case #${caseId} removed.`,
embeds: [
await client.dbUtils.generateCaseEmbedFromData(caseData, interaction.user, true, true),
],
});

break;
}
case "no": {
Expand Down

0 comments on commit 9cea3d6

Please sign in to comment.