mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
Fixed case type filters
This commit is contained in:
parent
174e5cc23b
commit
2874a0cf83
4 changed files with 19 additions and 9 deletions
|
@ -11,6 +11,7 @@ const opts = {
|
|||
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
||||
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
||||
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
||||
kicks: ct.switchOption({ def: false, shortcut: "k" }),
|
||||
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
||||
|
@ -38,6 +39,7 @@ export const CasesModMsgCmd = modActionsMsgCmd({
|
|||
args.warns,
|
||||
args.mutes,
|
||||
args.unmutes,
|
||||
args.kicks,
|
||||
args.bans,
|
||||
args.unbans,
|
||||
args.reverseFilters,
|
||||
|
|
|
@ -15,6 +15,7 @@ const opts = [
|
|||
slashOptions.boolean({ name: "warns", description: "To filter warns", required: false }),
|
||||
slashOptions.boolean({ name: "mutes", description: "To filter mutes", required: false }),
|
||||
slashOptions.boolean({ name: "unmutes", description: "To filter unmutes", required: false }),
|
||||
slashOptions.boolean({ name: "kicks", description: "To filter kicks", required: false }),
|
||||
slashOptions.boolean({ name: "bans", description: "To filter bans", required: false }),
|
||||
slashOptions.boolean({ name: "unbans", description: "To filter unbans", required: false }),
|
||||
slashOptions.boolean({ name: "show", description: "To make the result visible to everyone", required: false }),
|
||||
|
@ -39,6 +40,7 @@ export const CasesSlashCmd = {
|
|||
options.warns,
|
||||
options.mutes,
|
||||
options.unmutes,
|
||||
options.kicks,
|
||||
options.bans,
|
||||
options.unbans,
|
||||
options["reverse-filters"],
|
||||
|
|
|
@ -13,6 +13,7 @@ const opts = {
|
|||
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
||||
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
||||
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
||||
kicks: ct.switchOption({ def: false, shortcut: "k" }),
|
||||
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
||||
|
@ -51,6 +52,7 @@ export const CasesUserMsgCmd = modActionsMsgCmd({
|
|||
args.warns,
|
||||
args.mutes,
|
||||
args.unmutes,
|
||||
args.kicks,
|
||||
args.bans,
|
||||
args.unbans,
|
||||
args.reverseFilters,
|
||||
|
|
|
@ -227,6 +227,7 @@ export async function actualCasesCmd(
|
|||
warns: boolean | null,
|
||||
mutes: boolean | null,
|
||||
unmutes: boolean | null,
|
||||
kicks: boolean | null,
|
||||
bans: boolean | null,
|
||||
unbans: boolean | null,
|
||||
reverseFilters: boolean | null,
|
||||
|
@ -239,27 +240,30 @@ export async function actualCasesCmd(
|
|||
: null;
|
||||
const modName = modId ? (mod instanceof UnknownUser ? modId : renderUsername(mod!)) : renderUsername(author);
|
||||
|
||||
const allTypes = [
|
||||
CaseTypes.Note,
|
||||
CaseTypes.Warn,
|
||||
CaseTypes.Mute,
|
||||
CaseTypes.Unmute,
|
||||
CaseTypes.Kick,
|
||||
CaseTypes.Ban,
|
||||
CaseTypes.Unban,
|
||||
];
|
||||
let typesToShow: CaseTypes[] = [];
|
||||
|
||||
if (notes) typesToShow.push(CaseTypes.Note);
|
||||
if (warns) typesToShow.push(CaseTypes.Warn);
|
||||
if (mutes) typesToShow.push(CaseTypes.Mute);
|
||||
if (unmutes) typesToShow.push(CaseTypes.Unmute);
|
||||
if (kicks) typesToShow.push(CaseTypes.Kick);
|
||||
if (bans) typesToShow.push(CaseTypes.Ban);
|
||||
if (unbans) typesToShow.push(CaseTypes.Unban);
|
||||
|
||||
if (typesToShow.length === 0) {
|
||||
typesToShow = [CaseTypes.Note, CaseTypes.Warn, CaseTypes.Mute, CaseTypes.Unmute, CaseTypes.Ban, CaseTypes.Unban];
|
||||
typesToShow = allTypes;
|
||||
} else {
|
||||
if (reverseFilters) {
|
||||
typesToShow = [
|
||||
CaseTypes.Note,
|
||||
CaseTypes.Warn,
|
||||
CaseTypes.Mute,
|
||||
CaseTypes.Unmute,
|
||||
CaseTypes.Ban,
|
||||
CaseTypes.Unban,
|
||||
].filter((t) => !typesToShow.includes(t));
|
||||
typesToShow = allTypes.filter((t) => !typesToShow.includes(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue