3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-13 13:57:18 +00:00

Allow -r switch to reverse all filtering i.e. only show mutes

This commit is contained in:
Dark 2021-03-19 01:57:29 +01:00
parent a7efa1d728
commit 5528010cc5
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8

View file

@ -20,6 +20,7 @@ import { CaseTypes } from "../../../data/CaseTypes";
const opts = {
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
reverseFilters: ct.switchOption({ shortcut: "r" }),
onlyNotes: ct.switchOption({ shortcut: "n" }),
onlyWarns: ct.switchOption({ shortcut: "w" }),
onlyMutes: ct.switchOption({ shortcut: "m" }),
@ -57,7 +58,12 @@ export const CasesUserCmd = modActionsCmd({
if (args.onyUnmutes) typesToShow.push(CaseTypes.Unmute);
if (args.onlyBans) typesToShow.push(CaseTypes.Ban);
if (args.onyUnbans) typesToShow.push(CaseTypes.Unban);
if (typesToShow.length > 0) cases = cases.filter(c => typesToShow.includes(c.type));
if (typesToShow.length > 0) {
if (args.reverseFilters) cases = cases.filter(c => !typesToShow.includes(c.type));
// Reversed: Hide specified types
else cases = cases.filter(c => typesToShow.includes(c.type)); // Normal: Show only specified types
}
const normalCases = cases.filter(c => !c.is_hidden);
const hiddenCases = cases.filter(c => c.is_hidden);