-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathban.ts
43 lines (39 loc) · 995 Bytes
/
ban.ts
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
import * as app from "#app"
export default new app.Command({
name: "ban",
description: "Ban a user from all labs",
channelType: "guild",
middlewares: [app.staffOnly, app.labOnly],
positional: [
{
name: "target",
description: "The target user to ban",
type: "user",
required: true,
},
{
name: "reason",
description: "The reason for the ban",
type: "string",
required: true,
},
],
async run(message) {
const result = await app.globalBan(
message.author,
message.args.target,
message.args.reason,
)
const fails = result.filter((r) => r.status === "rejected")
if (fails.length === result.length) {
return message.reply(
`${app.emote(message, "Cross")} Failed to ban the user from all labs.`,
)
}
return message.reply(
`${app.emote(message, "CheckMark")} Banned the user from **${
result.length - fails.length
}** labs.`,
)
},
})