MCPcopy Index your code
hub / github.com/codebymitch/TitanBot / storeModerationCase

Function storeModerationCase

src/utils/moderation.js:111–136  ·  view source on GitHub ↗
({ guildId, caseId, caseData })

Source from the content-addressed store, hash-verified

109}
110
111export async function storeModerationCase({ guildId, caseId, caseData }) {
112 try {
113 const caseKey = `moderation_case_${guildId}_${caseId}`;
114 const caseDataWithTimestamp = {
115 ...caseData,
116 createdAt: new Date().toISOString(),
117 caseId
118 };
119
120 await setInDb(caseKey, caseDataWithTimestamp);
121
122 const caseListKey = `moderation_cases_list_${guildId}`;
123 const caseList = await getFromDb(caseListKey, []);
124 caseList.push(caseDataWithTimestamp);
125
126 if (caseList.length > 1000) {
127 caseList.splice(0, caseList.length - 1000);
128 }
129
130 await setInDb(caseListKey, caseList);
131 return true;
132 } catch (error) {
133 logger.error("Error storing moderation case:", error);
134 return false;
135 }
136}
137
138export async function getModerationCases(guildId, filters = {}) {
139 try {

Callers 1

logModerationActionFunction · 0.85

Calls 2

setInDbFunction · 0.90
getFromDbFunction · 0.90

Tested by

no test coverage detected