-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathCasesUserMsgCmd.ts
More file actions
68 lines (60 loc) · 2.08 KB
/
CasesUserMsgCmd.ts
File metadata and controls
68 lines (60 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { commandTypeHelpers as ct } from "../../../../commandTypes.js";
import { resolveMessageMember } from "../../../../pluginUtils.js";
import { resolveMember, resolveUser, UnknownUser } from "../../../../utils.js";
import { modActionsMsgCmd } from "../../types.js";
import { actualCasesCmd } from "./actualCasesCmd.js";
const opts = {
mod: ct.userId({ option: true }),
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
reverseFilters: ct.switchOption({ def: false, shortcut: "rf" }),
reason: ct.string({ option: true, shortcut: "r" }),
notes: ct.switchOption({ def: false, shortcut: "n" }),
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" }),
};
export const CasesUserMsgCmd = modActionsMsgCmd({
trigger: ["cases", "modlogs", "infractions"],
permission: "can_view",
description: "Show a list of cases the specified user has",
signature: [
{
user: ct.string(),
...opts,
},
],
async run({ pluginData, message: msg, args }) {
const user =
(await resolveMember(pluginData.client, pluginData.guild, args.user)) ||
(await resolveUser(pluginData.client, args.user, "ModActions:CasesUserMsgCmd"));
if (user instanceof UnknownUser) {
pluginData.state.common.sendErrorMessage(msg, `User not found`);
return;
}
const member = await resolveMessageMember(msg);
return actualCasesCmd(
pluginData,
msg,
args.mod,
user,
member,
args.notes,
args.warns,
args.mutes,
args.unmutes,
args.kicks,
args.bans,
args.unbans,
args.reverseFilters,
args.reason ?? null,
args.hidden,
args.expand,
args.show,
);
},
});