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:
parent
450ce5e25e
commit
ce4b65cd35
3 changed files with 8 additions and 5 deletions
|
@ -74,6 +74,9 @@ export class GuildCases extends BaseGuildRepository {
|
||||||
where: {
|
where: {
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
},
|
},
|
||||||
|
order: {
|
||||||
|
created_at: "DESC",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import { caseAbbreviations } from "../caseAbbreviations";
|
||||||
import { CasesPluginType } from "../types";
|
import { CasesPluginType } from "../types";
|
||||||
import { getCaseIcon } from "./getCaseIcon";
|
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 INCLUDE_MORE_NOTES_THRESHOLD = 20;
|
||||||
const UPDATE_STR = "**[Update]**";
|
const UPDATE_STR = "\n**[Update]**";
|
||||||
|
|
||||||
export async function getCaseSummary(
|
export async function getCaseSummary(
|
||||||
pluginData: GuildPluginData<CasesPluginType>,
|
pluginData: GuildPluginData<CasesPluginType>,
|
||||||
|
@ -31,7 +31,7 @@ export async function getCaseSummary(
|
||||||
|
|
||||||
for (let i = 1; i < theCase.notes.length; i++) {
|
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;
|
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--;
|
leftoverNotes--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export async function getCaseSummary(
|
||||||
let caseType = (caseAbbreviations[theCase.type] || String(theCase.type)).toUpperCase();
|
let caseType = (caseAbbreviations[theCase.type] || String(theCase.type)).toUpperCase();
|
||||||
caseType = (caseType + " ").slice(0, 4);
|
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) {
|
if (leftoverNotes > 1) {
|
||||||
line += ` *(+${leftoverNotes} ${leftoverNotes === 1 ? "note" : "notes"})*`;
|
line += ` *(+${leftoverNotes} ${leftoverNotes === 1 ? "note" : "notes"})*`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ const opts = {
|
||||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||||
};
|
};
|
||||||
|
|
||||||
const casesPerPage = 5;
|
const casesPerPage = 6;
|
||||||
|
|
||||||
export const CasesUserCmd = modActionsCmd({
|
export const CasesUserCmd = modActionsCmd({
|
||||||
trigger: ["cases", "modlogs"],
|
trigger: ["cases", "modlogs"],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue