xernerx 4.4.4 → 4.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/ContextCommandBuilder.d.ts +26 -33
- package/dist/build/ContextCommandBuilder.js +38 -38
- package/dist/build/EventBuilder.d.ts +3 -1
- package/dist/build/EventBuilder.js +1 -1
- package/dist/build/InhibitorBuilder.d.ts +5 -3
- package/dist/build/InhibitorBuilder.js +1 -1
- package/dist/build/MessageCommandBuilder.d.ts +24 -28
- package/dist/build/MessageCommandBuilder.js +33 -33
- package/dist/build/SlashCommandBuilder.d.ts +29 -34
- package/dist/build/SlashCommandBuilder.js +47 -47
- package/dist/client/XernerxClient.d.ts +21 -29
- package/dist/client/XernerxClient.js +32 -32
- package/dist/client/XernerxShardClient.js +3 -5
- package/dist/functions/deploy.js +15 -12
- package/dist/functions/load.js +2 -1
- package/dist/functions/reload.js +11 -8
- package/dist/functions/sendWebhook.js +2 -1
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +10 -11
- package/dist/handlers/CommandHandler.js +104 -81
- package/dist/handlers/EventHandler.js +2 -2
- package/dist/handlers/ExtensionHandler.js +4 -2
- package/dist/handlers/Handler.js +15 -5
- package/dist/handlers/InhibitorHandler.js +2 -2
- package/dist/handlers/WebhookHandler.d.ts +3 -1
- package/dist/handlers/WebhookHandler.js +5 -8
- package/dist/main.d.ts +21 -28
- package/dist/main.js +21 -28
- package/dist/models/Arguments.d.ts +1 -8
- package/dist/models/Arguments.js +72 -51
- package/dist/tools/XernerxLog.js +1 -6
- package/dist/types/extenders.d.ts +8 -4
- package/dist/types/interfaces.d.ts +6 -12
- package/dist/types/types.d.ts +5 -173
- package/dist/utils/ClientUtil.d.ts +3 -3
- package/dist/utils/ClientUtil.js +13 -7
- package/dist/utils/InteractionUtil.d.ts +1 -1
- package/dist/utils/MessageUtil.d.ts +1 -1
- package/dist/utils/MessageUtil.js +8 -4
- package/dist/validators/commandValidation.js +28 -18
- package/dist/validators/inhibitorValidations.d.ts +1 -14
- package/package.json +1 -1
|
@@ -1,48 +1,41 @@
|
|
|
1
1
|
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
import { XernerxMessageContextInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
3
|
import { ContextCommandOptions } from '../types/interfaces.js';
|
|
5
4
|
export default class ContextCommandBuilder {
|
|
6
5
|
readonly id: string;
|
|
7
6
|
readonly data: ContextMenuCommandBuilder;
|
|
8
7
|
readonly name: string;
|
|
9
|
-
readonly type: '
|
|
8
|
+
readonly type: 'user' | 'message';
|
|
10
9
|
readonly description: string | null | undefined;
|
|
11
10
|
readonly usage: string | null | undefined;
|
|
12
11
|
readonly info: string | null | undefined;
|
|
13
12
|
readonly category: string | null | undefined;
|
|
14
13
|
readonly cooldown: number | null | undefined;
|
|
15
|
-
readonly ignore:
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
| undefined;
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
| undefined;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
readonly
|
|
39
|
-
| {
|
|
40
|
-
reply?: boolean | undefined;
|
|
41
|
-
ephemeral?: boolean | undefined;
|
|
42
|
-
fetchReply?: boolean | undefined;
|
|
43
|
-
}
|
|
44
|
-
| undefined;
|
|
14
|
+
readonly ignore: {
|
|
15
|
+
owner?: boolean | undefined;
|
|
16
|
+
users?: string[] | undefined;
|
|
17
|
+
channels?: string[] | undefined;
|
|
18
|
+
guilds?: string[] | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
readonly strict: {
|
|
21
|
+
owner?: boolean | undefined;
|
|
22
|
+
users?: string[] | undefined;
|
|
23
|
+
channels?: string[] | undefined;
|
|
24
|
+
guilds?: string[] | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
readonly permissions: {
|
|
27
|
+
user?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
28
|
+
client?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
29
|
+
dm?: boolean | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
readonly defer: {
|
|
32
|
+
reply?: boolean | undefined;
|
|
33
|
+
ephemeral?: boolean | undefined;
|
|
34
|
+
fetchReply?: boolean | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
readonly fileType: 'ContextCommand';
|
|
37
|
+
readonly filePath: string;
|
|
45
38
|
readonly client: typeof XernerxClient;
|
|
46
39
|
constructor(id: string, options: ContextCommandOptions);
|
|
47
|
-
exec(
|
|
40
|
+
exec(): Promise<void>;
|
|
48
41
|
}
|
|
@@ -11,44 +11,44 @@ export default class ContextCommandBuilder {
|
|
|
11
11
|
this.data.setDMPermission(options.permissions?.dm || null);
|
|
12
12
|
options = z
|
|
13
13
|
.object({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
.default({}),
|
|
29
|
-
strict: z
|
|
30
|
-
.object({
|
|
31
|
-
owner: z.boolean().default(false),
|
|
32
|
-
users: z.array(z.string()).default([]),
|
|
33
|
-
channels: z.array(z.string()).default([]),
|
|
34
|
-
guilds: z.array(z.string()).default([]),
|
|
35
|
-
})
|
|
36
|
-
.default({}),
|
|
37
|
-
permissions: z
|
|
38
|
-
.object({
|
|
39
|
-
user: z.array(z.string()).default([]),
|
|
40
|
-
client: z.array(z.string()).default([]),
|
|
41
|
-
dm: z.boolean().default(true),
|
|
42
|
-
})
|
|
43
|
-
.default({}),
|
|
44
|
-
defer: z
|
|
45
|
-
.object({
|
|
46
|
-
reply: z.boolean().default(false),
|
|
47
|
-
ephemeral: z.boolean().default(false),
|
|
48
|
-
fetch: z.boolean().default(false),
|
|
49
|
-
})
|
|
50
|
-
.default({}),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
type: z.enum(['user', 'message']),
|
|
16
|
+
description: z.string().or(z.null()).default(null),
|
|
17
|
+
usage: z.string().or(z.null()).default(null),
|
|
18
|
+
info: z.string().or(z.null()).default(null),
|
|
19
|
+
category: z.string().or(z.null()).default(null),
|
|
20
|
+
cooldown: z.number().or(z.null()).default(null),
|
|
21
|
+
ignore: z
|
|
22
|
+
.object({
|
|
23
|
+
owner: z.boolean().default(false),
|
|
24
|
+
users: z.array(z.string()).default([]),
|
|
25
|
+
channels: z.array(z.string()).default([]),
|
|
26
|
+
guilds: z.array(z.string()).default([]),
|
|
51
27
|
})
|
|
28
|
+
.default({}),
|
|
29
|
+
strict: z
|
|
30
|
+
.object({
|
|
31
|
+
owner: z.boolean().default(false),
|
|
32
|
+
users: z.array(z.string()).default([]),
|
|
33
|
+
channels: z.array(z.string()).default([]),
|
|
34
|
+
guilds: z.array(z.string()).default([]),
|
|
35
|
+
})
|
|
36
|
+
.default({}),
|
|
37
|
+
permissions: z
|
|
38
|
+
.object({
|
|
39
|
+
user: z.array(z.string()).default([]),
|
|
40
|
+
client: z.array(z.string()).default([]),
|
|
41
|
+
dm: z.boolean().default(true),
|
|
42
|
+
})
|
|
43
|
+
.default({}),
|
|
44
|
+
defer: z
|
|
45
|
+
.object({
|
|
46
|
+
reply: z.boolean().default(false),
|
|
47
|
+
ephemeral: z.boolean().default(false),
|
|
48
|
+
fetch: z.boolean().default(false),
|
|
49
|
+
})
|
|
50
|
+
.default({}),
|
|
51
|
+
})
|
|
52
52
|
.parse(options);
|
|
53
53
|
this.name = options.name;
|
|
54
54
|
this.type = options.type;
|
|
@@ -63,5 +63,5 @@ export default class ContextCommandBuilder {
|
|
|
63
63
|
this.defer = options.defer;
|
|
64
64
|
this.client = XernerxClient;
|
|
65
65
|
}
|
|
66
|
-
async exec(
|
|
66
|
+
async exec() { }
|
|
67
67
|
}
|
|
@@ -12,11 +12,13 @@ export default class EventBuilder {
|
|
|
12
12
|
readonly emitter?: 'client' | 'process' | string;
|
|
13
13
|
readonly type?: 'discord' | string;
|
|
14
14
|
readonly once?: boolean;
|
|
15
|
+
readonly fileType: 'Event';
|
|
16
|
+
readonly filePath: string;
|
|
15
17
|
readonly client: typeof XernerxClient;
|
|
16
18
|
constructor(id: string, options: EventBuilderOptions);
|
|
17
19
|
/**
|
|
18
20
|
* @description run your custom event here.
|
|
19
21
|
* TODO - update description
|
|
20
22
|
*/
|
|
21
|
-
run
|
|
23
|
+
run(): Promise<void>;
|
|
22
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { InhibitorBuilderOptions } from '../types/interfaces.js';
|
|
3
|
-
import { InhibitorType
|
|
4
|
-
import { XernerxMessage } from '../types/extenders.js';
|
|
3
|
+
import { InhibitorType } from '../types/types.js';
|
|
4
|
+
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
5
5
|
/**
|
|
6
6
|
* @description - The inhibitor builder for inhibitors.
|
|
7
7
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -11,7 +11,9 @@ export default class InhibitorBuilder {
|
|
|
11
11
|
readonly id: string;
|
|
12
12
|
readonly name: string;
|
|
13
13
|
readonly type: InhibitorType;
|
|
14
|
+
readonly fileType: 'Inhibitor';
|
|
15
|
+
readonly filePath: string;
|
|
14
16
|
readonly client: typeof XernerxClient;
|
|
15
17
|
constructor(id: string, options: InhibitorBuilderOptions);
|
|
16
|
-
check
|
|
18
|
+
check(interaction: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction, args: any): Promise<void>;
|
|
17
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxMessage } from '../types/extenders.js';
|
|
3
|
-
import {
|
|
3
|
+
import { MessageCommandOptions } from '../types/interfaces.js';
|
|
4
4
|
export default class MessageCommandBuilder {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly name: string;
|
|
@@ -11,35 +11,31 @@ export default class MessageCommandBuilder {
|
|
|
11
11
|
readonly usage: string | null | undefined;
|
|
12
12
|
readonly info: string | null | undefined;
|
|
13
13
|
readonly separator: string | undefined;
|
|
14
|
-
readonly args: import(
|
|
15
|
-
readonly flags: import(
|
|
14
|
+
readonly args: import("../types/interfaces.js").MessageCommandArgumentOptions[] | undefined;
|
|
15
|
+
readonly flags: import("../types/interfaces.js").MessageCommandFlagOptions[] | undefined;
|
|
16
16
|
readonly category: string | null | undefined;
|
|
17
17
|
readonly cooldown: number | null | undefined;
|
|
18
|
-
readonly ignore:
|
|
19
|
-
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| undefined;
|
|
26
|
-
|
|
27
|
-
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| undefined;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
38
|
-
dm?: boolean | undefined;
|
|
39
|
-
}
|
|
40
|
-
| undefined;
|
|
18
|
+
readonly ignore: {
|
|
19
|
+
owner?: boolean | undefined;
|
|
20
|
+
users?: string[] | undefined;
|
|
21
|
+
channels?: string[] | undefined;
|
|
22
|
+
guilds?: string[] | undefined;
|
|
23
|
+
} | undefined;
|
|
24
|
+
readonly strict: {
|
|
25
|
+
owner?: boolean | undefined;
|
|
26
|
+
users?: string[] | undefined;
|
|
27
|
+
channels?: string[] | undefined;
|
|
28
|
+
guilds?: string[] | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
readonly permissions: {
|
|
31
|
+
user?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
32
|
+
client?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
33
|
+
dm?: boolean | undefined;
|
|
34
|
+
} | undefined;
|
|
35
|
+
readonly fileType: 'MessageCommand';
|
|
36
|
+
readonly filePath: string;
|
|
41
37
|
readonly client: typeof XernerxClient;
|
|
42
38
|
constructor(id: string, options: MessageCommandOptions);
|
|
43
|
-
conditions(message: XernerxMessage, args:
|
|
44
|
-
exec(message: XernerxMessage, args:
|
|
39
|
+
conditions(message: XernerxMessage, { args, flags }: any): Promise<void>;
|
|
40
|
+
exec(message: XernerxMessage, { args, flags }: any): Promise<void>;
|
|
45
41
|
}
|
|
@@ -8,38 +8,38 @@ export default class MessageCommandBuilder {
|
|
|
8
8
|
this.flags = options.flags;
|
|
9
9
|
options = z
|
|
10
10
|
.object({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
.default({}),
|
|
27
|
-
strict: z
|
|
28
|
-
.object({
|
|
29
|
-
owner: z.boolean().default(false),
|
|
30
|
-
users: z.array(z.string()).default([]),
|
|
31
|
-
channels: z.array(z.string()).default([]),
|
|
32
|
-
guilds: z.array(z.string()).default([]),
|
|
33
|
-
})
|
|
34
|
-
.default({}),
|
|
35
|
-
permissions: z
|
|
36
|
-
.object({
|
|
37
|
-
user: z.array(z.string()).default([]),
|
|
38
|
-
client: z.array(z.string()).default([]),
|
|
39
|
-
dm: z.boolean().default(true),
|
|
40
|
-
})
|
|
41
|
-
.default({}),
|
|
11
|
+
name: z.string(),
|
|
12
|
+
aliases: z.array(z.string()).default([]),
|
|
13
|
+
description: z.string().or(z.null()).default(null),
|
|
14
|
+
usage: z.string().or(z.null()).default(null),
|
|
15
|
+
info: z.string().or(z.null()).default(null),
|
|
16
|
+
category: z.string().or(z.null()).default(null),
|
|
17
|
+
cooldown: z.number().or(z.null()).default(null),
|
|
18
|
+
prefix: z.array(z.string()).or(z.string()).default([]),
|
|
19
|
+
ignore: z
|
|
20
|
+
.object({
|
|
21
|
+
owner: z.boolean().default(false),
|
|
22
|
+
users: z.array(z.string()).default([]),
|
|
23
|
+
channels: z.array(z.string()).default([]),
|
|
24
|
+
guilds: z.array(z.string()).default([]),
|
|
42
25
|
})
|
|
26
|
+
.default({}),
|
|
27
|
+
strict: z
|
|
28
|
+
.object({
|
|
29
|
+
owner: z.boolean().default(false),
|
|
30
|
+
users: z.array(z.string()).default([]),
|
|
31
|
+
channels: z.array(z.string()).default([]),
|
|
32
|
+
guilds: z.array(z.string()).default([]),
|
|
33
|
+
})
|
|
34
|
+
.default({}),
|
|
35
|
+
permissions: z
|
|
36
|
+
.object({
|
|
37
|
+
user: z.array(z.string()).default([]),
|
|
38
|
+
client: z.array(z.string()).default([]),
|
|
39
|
+
dm: z.boolean().default(true),
|
|
40
|
+
})
|
|
41
|
+
.default({}),
|
|
42
|
+
})
|
|
43
43
|
.parse(options);
|
|
44
44
|
this.name = options.name;
|
|
45
45
|
this.aliases = options.aliases;
|
|
@@ -55,6 +55,6 @@ export default class MessageCommandBuilder {
|
|
|
55
55
|
this.permissions = options.permissions;
|
|
56
56
|
this.client = XernerxClient;
|
|
57
57
|
}
|
|
58
|
-
async conditions(message, args) {}
|
|
59
|
-
async exec(message, args) {}
|
|
58
|
+
async conditions(message, { args, flags }) { }
|
|
59
|
+
async exec(message, { args, flags }) { }
|
|
60
60
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Discord from 'discord.js';
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
import { XernerxSlashInteraction } from '../types/extenders.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SlashCommandOptions } from '../types/interfaces.js';
|
|
5
|
+
import { XernerxInteraction } from '../types/types.js';
|
|
5
6
|
export default class SlashCommandBuilder {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly data: Discord.SlashCommandBuilder;
|
|
@@ -11,41 +12,35 @@ export default class SlashCommandBuilder {
|
|
|
11
12
|
readonly info: string | null | undefined;
|
|
12
13
|
readonly category: string | null | undefined;
|
|
13
14
|
readonly cooldown: number | null | undefined;
|
|
14
|
-
readonly ignore:
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| undefined;
|
|
22
|
-
|
|
23
|
-
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
| undefined;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readonly
|
|
38
|
-
| {
|
|
39
|
-
reply?: boolean | undefined;
|
|
40
|
-
ephemeral?: boolean | undefined;
|
|
41
|
-
fetchReply?: boolean | undefined;
|
|
42
|
-
}
|
|
43
|
-
| undefined;
|
|
15
|
+
readonly ignore: {
|
|
16
|
+
owner?: boolean | undefined;
|
|
17
|
+
users?: string[] | undefined;
|
|
18
|
+
channels?: string[] | undefined;
|
|
19
|
+
guilds?: string[] | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
readonly strict: {
|
|
22
|
+
owner?: boolean | undefined;
|
|
23
|
+
users?: string[] | undefined;
|
|
24
|
+
channels?: string[] | undefined;
|
|
25
|
+
guilds?: string[] | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
readonly permissions: {
|
|
28
|
+
user?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
29
|
+
client?: string[] | import("../types/types.js").PermissionNames[] | undefined;
|
|
30
|
+
dm?: boolean | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
readonly defer: {
|
|
33
|
+
reply?: boolean | undefined;
|
|
34
|
+
ephemeral?: boolean | undefined;
|
|
35
|
+
fetchReply?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
readonly fileType: 'SlashCommand';
|
|
38
|
+
readonly filePath: string;
|
|
44
39
|
readonly client: typeof XernerxClient;
|
|
45
40
|
constructor(id: string, options: SlashCommandOptions);
|
|
46
|
-
autocomplete<T>(interaction:
|
|
47
|
-
conditions(interaction: XernerxSlashInteraction, args:
|
|
48
|
-
exec(interaction: XernerxSlashInteraction, args:
|
|
41
|
+
autocomplete<T>(interaction: XernerxInteraction, focused: T, options: T[]): Promise<void>;
|
|
42
|
+
conditions(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
|
|
43
|
+
exec(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
|
|
49
44
|
private addArguments;
|
|
50
45
|
private addSubcommands;
|
|
51
46
|
private addSubcommandGroups;
|
|
@@ -21,44 +21,44 @@ export default class SlashCommandBuilder {
|
|
|
21
21
|
}
|
|
22
22
|
options = z
|
|
23
23
|
.object({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
.default({}),
|
|
39
|
-
strict: z
|
|
40
|
-
.object({
|
|
41
|
-
owner: z.boolean().default(false),
|
|
42
|
-
users: z.array(z.string()).default([]),
|
|
43
|
-
channels: z.array(z.string()).default([]),
|
|
44
|
-
guilds: z.array(z.string()).default([]),
|
|
45
|
-
})
|
|
46
|
-
.default({}),
|
|
47
|
-
permissions: z
|
|
48
|
-
.object({
|
|
49
|
-
user: z.array(z.string()).default([]),
|
|
50
|
-
client: z.array(z.string()).default([]),
|
|
51
|
-
dm: z.boolean().default(true),
|
|
52
|
-
})
|
|
53
|
-
.default({}),
|
|
54
|
-
defer: z
|
|
55
|
-
.object({
|
|
56
|
-
reply: z.boolean().default(false),
|
|
57
|
-
ephemeral: z.boolean().default(false),
|
|
58
|
-
fetch: z.boolean().default(false),
|
|
59
|
-
})
|
|
60
|
-
.default({}),
|
|
24
|
+
name: z.string(),
|
|
25
|
+
description: z.string(),
|
|
26
|
+
usage: z.string().or(z.null()).default(null),
|
|
27
|
+
info: z.string().or(z.null()).default(null),
|
|
28
|
+
category: z.string().or(z.null()).default(null),
|
|
29
|
+
number: z.number().or(z.null()).default(null),
|
|
30
|
+
channelType: z.array(z.number()).or(z.null()).default(null),
|
|
31
|
+
ignore: z
|
|
32
|
+
.object({
|
|
33
|
+
owner: z.boolean().default(false),
|
|
34
|
+
users: z.array(z.string()).default([]),
|
|
35
|
+
channels: z.array(z.string()).default([]),
|
|
36
|
+
guilds: z.array(z.string()).default([]),
|
|
61
37
|
})
|
|
38
|
+
.default({}),
|
|
39
|
+
strict: z
|
|
40
|
+
.object({
|
|
41
|
+
owner: z.boolean().default(false),
|
|
42
|
+
users: z.array(z.string()).default([]),
|
|
43
|
+
channels: z.array(z.string()).default([]),
|
|
44
|
+
guilds: z.array(z.string()).default([]),
|
|
45
|
+
})
|
|
46
|
+
.default({}),
|
|
47
|
+
permissions: z
|
|
48
|
+
.object({
|
|
49
|
+
user: z.array(z.string()).default([]),
|
|
50
|
+
client: z.array(z.string()).default([]),
|
|
51
|
+
dm: z.boolean().default(true),
|
|
52
|
+
})
|
|
53
|
+
.default({}),
|
|
54
|
+
defer: z
|
|
55
|
+
.object({
|
|
56
|
+
reply: z.boolean().default(false),
|
|
57
|
+
ephemeral: z.boolean().default(false),
|
|
58
|
+
fetch: z.boolean().default(false),
|
|
59
|
+
})
|
|
60
|
+
.default({}),
|
|
61
|
+
})
|
|
62
62
|
.parse(options);
|
|
63
63
|
this.name = options.name;
|
|
64
64
|
this.description = options.description;
|
|
@@ -72,9 +72,9 @@ export default class SlashCommandBuilder {
|
|
|
72
72
|
this.defer = options.defer;
|
|
73
73
|
this.client = XernerxClient;
|
|
74
74
|
}
|
|
75
|
-
async autocomplete(interaction, focused, options) {}
|
|
76
|
-
async conditions(interaction, args) {}
|
|
77
|
-
async exec(interaction, args) {}
|
|
75
|
+
async autocomplete(interaction, focused, options) { }
|
|
76
|
+
async conditions(interaction, { args, subcommand, group }) { }
|
|
77
|
+
async exec(interaction, { args, subcommand, group }) { }
|
|
78
78
|
addArguments(command, args) {
|
|
79
79
|
for (const argument of args) {
|
|
80
80
|
let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
@@ -85,11 +85,9 @@ export default class SlashCommandBuilder {
|
|
|
85
85
|
.setRequired(argument.required || false);
|
|
86
86
|
if (slashCommandArgumentType === 'String') {
|
|
87
87
|
if (argument.choices)
|
|
88
|
-
option.setChoices(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
);
|
|
88
|
+
option.setChoices(...argument.choices.map((choices) => {
|
|
89
|
+
return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
|
|
90
|
+
}));
|
|
93
91
|
option.setAutocomplete(argument.autocomplete || false);
|
|
94
92
|
}
|
|
95
93
|
return option;
|
|
@@ -99,14 +97,16 @@ export default class SlashCommandBuilder {
|
|
|
99
97
|
addSubcommands(method, subcommands) {
|
|
100
98
|
for (const subcommand of subcommands) {
|
|
101
99
|
let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
102
|
-
if (subcommand.args && subcommand?.args?.length > 0)
|
|
100
|
+
if (subcommand.args && subcommand?.args?.length > 0)
|
|
101
|
+
this.addArguments(sub, subcommand.args);
|
|
103
102
|
method.addSubcommand(sub);
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
addSubcommandGroups(groups) {
|
|
107
106
|
for (const group of groups) {
|
|
108
107
|
let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
109
|
-
if (group.subcommands?.length > 0)
|
|
108
|
+
if (group.subcommands?.length > 0)
|
|
109
|
+
this.addSubcommands(subcommandGroup, group.subcommands);
|
|
110
110
|
this.data.addSubcommandGroup(subcommandGroup);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -7,35 +7,27 @@ export default class XernerxClient extends Client {
|
|
|
7
7
|
ownerId: (string | string[]) & (string | string[] | undefined);
|
|
8
8
|
global: boolean;
|
|
9
9
|
local?: string | undefined;
|
|
10
|
-
permissions?:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
| undefined;
|
|
33
|
-
cooldown?:
|
|
34
|
-
| {
|
|
35
|
-
command: number;
|
|
36
|
-
cache: number;
|
|
37
|
-
}
|
|
38
|
-
| undefined;
|
|
10
|
+
permissions?: {
|
|
11
|
+
client: string[];
|
|
12
|
+
user: string[];
|
|
13
|
+
dm: boolean;
|
|
14
|
+
} | undefined;
|
|
15
|
+
ignore?: {
|
|
16
|
+
owner: boolean;
|
|
17
|
+
users: string[];
|
|
18
|
+
channels: string[];
|
|
19
|
+
guilds: string[];
|
|
20
|
+
} | undefined;
|
|
21
|
+
log?: {
|
|
22
|
+
ready: boolean;
|
|
23
|
+
error: boolean;
|
|
24
|
+
info: boolean;
|
|
25
|
+
table: string[] | null;
|
|
26
|
+
} | undefined;
|
|
27
|
+
cooldown?: {
|
|
28
|
+
command: number;
|
|
29
|
+
cache: number;
|
|
30
|
+
} | undefined;
|
|
39
31
|
};
|
|
40
32
|
readonly config: Record<string, unknown> | null;
|
|
41
33
|
readonly commands: XernerxCommands;
|