3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-16 22:55:03 +00:00

Case display changes

This commit is contained in:
iamshoXy 2024-04-19 19:24:14 +02:00
parent 450ce5e25e
commit ce4b65cd35
3 changed files with 8 additions and 5 deletions

View file

@ -74,6 +74,9 @@ export class GuildCases extends BaseGuildRepository {
where: {
user_id: userId,
},
order: {
created_at: "DESC",
},
});
}

View file

@ -8,9 +8,9 @@ import { caseAbbreviations } from "../caseAbbreviations";
import { CasesPluginType } from "../types";
import { getCaseIcon } from "./getCaseIcon";
const CASE_SUMMARY_REASON_MAX_LENGTH = 300;
const CASE_SUMMARY_REASON_MAX_LENGTH = 682;
const INCLUDE_MORE_NOTES_THRESHOLD = 20;
const UPDATE_STR = "**[Update]**";
const UPDATE_STR = "\n**[Update]**";
export async function getCaseSummary(
pluginData: GuildPluginData<CasesPluginType>,
@ -31,7 +31,7 @@ export async function getCaseSummary(
for (let i = 1; i < theCase.notes.length; i++) {
if (reason.length >= CASE_SUMMARY_REASON_MAX_LENGTH - UPDATE_STR.length - INCLUDE_MORE_NOTES_THRESHOLD) break;
reason += ` ${UPDATE_STR} ${theCase.notes[i].body}`;
reason += ` ${UPDATE_STR} ${theCase.notes[i].body}\n`;
leftoverNotes--;
}
@ -67,7 +67,7 @@ export async function getCaseSummary(
let caseType = (caseAbbreviations[theCase.type] || String(theCase.type)).toUpperCase();
caseType = (caseType + " ").slice(0, 4);
let line = `${icon} **\`${caseType}\`** \`[${prettyTimestamp}]\` ${caseTitle} **Mod:** ${theCase.mod_name}\n${reason}`;
let line = `${icon} **\`${caseType}\`** \`[${prettyTimestamp}]\` ${caseTitle} **Moderator:** ${theCase.mod_name}\n${reason}`;
if (leftoverNotes > 1) {
line += ` *(+${leftoverNotes} ${leftoverNotes === 1 ? "note" : "notes"})*`;
}

View file

@ -21,7 +21,7 @@ const opts = {
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
};
const casesPerPage = 5;
const casesPerPage = 6;
export const CasesUserCmd = modActionsCmd({
trigger: ["cases", "modlogs"],