-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathfetchUserAuditLog.js
More file actions
64 lines (64 loc) · 2.05 KB
/
fetchUserAuditLog.js
File metadata and controls
64 lines (64 loc) · 2.05 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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
const structures_1 = require("../../structures");
const audit_1 = require("../../properties/audit");
exports.default = new structures_1.NativeFunction({
name: "$fetchUserAuditLog",
version: "1.4.0",
description: "Fetches an audit log from a user using the type of it",
brackets: true,
unwrap: true,
output: structures_1.ArgType.Unknown,
args: [
{
name: "guild ID",
description: "The guild to get audit log from",
rest: false,
required: true,
type: structures_1.ArgType.Guild
},
{
name: "user",
rest: false,
description: "The user to filter by",
type: structures_1.ArgType.User
},
{
name: "type",
description: "The event type of the log",
rest: false,
required: true,
type: structures_1.ArgType.Enum,
enum: discord_js_1.AuditLogEvent
},
{
name: "property",
description: "The property to pull from the audit log",
rest: false,
required: true,
type: structures_1.ArgType.Enum,
enum: audit_1.AuditProperty
},
{
name: "index",
description: "The index of the entry to use",
rest: false,
type: structures_1.ArgType.Number
},
{
name: "separator",
description: "The separator to use in case of array output",
type: structures_1.ArgType.String,
rest: false
}
],
async execute(ctx, [g, user, type, prop, index, sep]) {
const logs = await g.fetchAuditLogs({
type,
user: user ?? undefined
}).catch(ctx.noop);
return this.success(logs ? audit_1.AuditProperties[prop](logs.entries.at(index ?? 0), sep) : null);
},
});
//# sourceMappingURL=fetchUserAuditLog.js.map