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" }),
|
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
||||||
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
||||||
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
||||||
|
kicks: ct.switchOption({ def: false, shortcut: "k" }),
|
||||||
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
||||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||||
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
||||||
|
@ -38,6 +39,7 @@ export const CasesModMsgCmd = modActionsMsgCmd({
|
||||||
args.warns,
|
args.warns,
|
||||||
args.mutes,
|
args.mutes,
|
||||||
args.unmutes,
|
args.unmutes,
|
||||||
|
args.kicks,
|
||||||
args.bans,
|
args.bans,
|
||||||
args.unbans,
|
args.unbans,
|
||||||
args.reverseFilters,
|
args.reverseFilters,
|
||||||
|
|
|
@ -15,6 +15,7 @@ const opts = [
|
||||||
slashOptions.boolean({ name: "warns", description: "To filter warns", required: false }),
|
slashOptions.boolean({ name: "warns", description: "To filter warns", required: false }),
|
||||||
slashOptions.boolean({ name: "mutes", description: "To filter mutes", 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: "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: "bans", description: "To filter bans", required: false }),
|
||||||
slashOptions.boolean({ name: "unbans", description: "To filter unbans", 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 }),
|
slashOptions.boolean({ name: "show", description: "To make the result visible to everyone", required: false }),
|
||||||
|
@ -39,6 +40,7 @@ export const CasesSlashCmd = {
|
||||||
options.warns,
|
options.warns,
|
||||||
options.mutes,
|
options.mutes,
|
||||||
options.unmutes,
|
options.unmutes,
|
||||||
|
options.kicks,
|
||||||
options.bans,
|
options.bans,
|
||||||
options.unbans,
|
options.unbans,
|
||||||
options["reverse-filters"],
|
options["reverse-filters"],
|
||||||
|
|
|
@ -13,6 +13,7 @@ const opts = {
|
||||||
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
||||||
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
||||||
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
||||||
|
kicks: ct.switchOption({ def: false, shortcut: "k" }),
|
||||||
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
||||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||||
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
show: ct.switchOption({ def: false, shortcut: "sh" }),
|
||||||
|
@ -51,6 +52,7 @@ export const CasesUserMsgCmd = modActionsMsgCmd({
|
||||||
args.warns,
|
args.warns,
|
||||||
args.mutes,
|
args.mutes,
|
||||||
args.unmutes,
|
args.unmutes,
|
||||||
|
args.kicks,
|
||||||
args.bans,
|
args.bans,
|
||||||
args.unbans,
|
args.unbans,
|
||||||
args.reverseFilters,
|
args.reverseFilters,
|
||||||
|
|
|
@ -227,6 +227,7 @@ export async function actualCasesCmd(
|
||||||
warns: boolean | null,
|
warns: boolean | null,
|
||||||
mutes: boolean | null,
|
mutes: boolean | null,
|
||||||
unmutes: boolean | null,
|
unmutes: boolean | null,
|
||||||
|
kicks: boolean | null,
|
||||||
bans: boolean | null,
|
bans: boolean | null,
|
||||||
unbans: boolean | null,
|
unbans: boolean | null,
|
||||||
reverseFilters: boolean | null,
|
reverseFilters: boolean | null,
|
||||||
|
@ -239,27 +240,30 @@ export async function actualCasesCmd(
|
||||||
: null;
|
: null;
|
||||||
const modName = modId ? (mod instanceof UnknownUser ? modId : renderUsername(mod!)) : renderUsername(author);
|
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[] = [];
|
let typesToShow: CaseTypes[] = [];
|
||||||
|
|
||||||
if (notes) typesToShow.push(CaseTypes.Note);
|
if (notes) typesToShow.push(CaseTypes.Note);
|
||||||
if (warns) typesToShow.push(CaseTypes.Warn);
|
if (warns) typesToShow.push(CaseTypes.Warn);
|
||||||
if (mutes) typesToShow.push(CaseTypes.Mute);
|
if (mutes) typesToShow.push(CaseTypes.Mute);
|
||||||
if (unmutes) typesToShow.push(CaseTypes.Unmute);
|
if (unmutes) typesToShow.push(CaseTypes.Unmute);
|
||||||
|
if (kicks) typesToShow.push(CaseTypes.Kick);
|
||||||
if (bans) typesToShow.push(CaseTypes.Ban);
|
if (bans) typesToShow.push(CaseTypes.Ban);
|
||||||
if (unbans) typesToShow.push(CaseTypes.Unban);
|
if (unbans) typesToShow.push(CaseTypes.Unban);
|
||||||
|
|
||||||
if (typesToShow.length === 0) {
|
if (typesToShow.length === 0) {
|
||||||
typesToShow = [CaseTypes.Note, CaseTypes.Warn, CaseTypes.Mute, CaseTypes.Unmute, CaseTypes.Ban, CaseTypes.Unban];
|
typesToShow = allTypes;
|
||||||
} else {
|
} else {
|
||||||
if (reverseFilters) {
|
if (reverseFilters) {
|
||||||
typesToShow = [
|
typesToShow = allTypes.filter((t) => !typesToShow.includes(t));
|
||||||
CaseTypes.Note,
|
|
||||||
CaseTypes.Warn,
|
|
||||||
CaseTypes.Mute,
|
|
||||||
CaseTypes.Unmute,
|
|
||||||
CaseTypes.Ban,
|
|
||||||
CaseTypes.Unban,
|
|
||||||
].filter((t) => !typesToShow.includes(t));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue