xernerx 3.5.1 → 3.6.0
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 → cjs/build}/ContextCommandBuilder.d.ts +31 -28
- package/dist/cjs/build/ContextCommandBuilder.js +97 -0
- package/dist/cjs/build/EventBuilder.js +44 -0
- package/dist/{build → cjs/build}/InhibitorBuilder.d.ts +1 -1
- package/dist/cjs/build/InhibitorBuilder.js +37 -0
- package/dist/{build → cjs/build}/MessageCommandBuilder.d.ts +23 -17
- package/dist/cjs/build/MessageCommandBuilder.js +100 -0
- package/dist/{build → cjs/build}/SlashCommandBuilder.d.ts +25 -18
- package/dist/cjs/build/SlashCommandBuilder.js +169 -0
- package/dist/{client → cjs/client}/XernerxClient.d.ts +1 -0
- package/dist/cjs/client/XernerxClient.js +120 -0
- package/dist/{handlers → cjs/handlers}/CommandHandler.js +11 -8
- package/dist/{handlers → cjs/handlers}/EventHandler.js +6 -3
- package/dist/cjs/handlers/Handler.js +308 -0
- package/dist/{handlers → cjs/handlers}/InhibitorHandler.js +6 -3
- package/dist/cjs/handlers/WebhookHandler.d.ts +7 -0
- package/dist/cjs/handlers/WebhookHandler.js +23 -0
- package/dist/{main.d.ts → cjs/main.d.ts} +15 -1
- package/dist/cjs/main.js +112 -0
- package/dist/{models → cjs/models}/CommandArguments.d.ts +1 -1
- package/dist/{models → cjs/models}/CommandArguments.js +37 -52
- package/dist/cjs/models/Events.js +309 -0
- package/dist/cjs/models/Extensions.js +26 -0
- package/dist/cjs/models/XernerxUser.d.ts +2 -0
- package/dist/cjs/models/XernerxUser.js +12 -0
- package/dist/{tools → cjs/tools}/XernerxError.js +4 -1
- package/dist/{tools → cjs/tools}/package.d.ts +4 -9
- package/dist/{tools → cjs/tools}/package.js +14 -17
- package/dist/cjs/types/enums.d.ts +44 -0
- package/dist/cjs/types/enums.js +38 -0
- package/dist/{types → cjs/types}/interfaces.d.ts +2 -0
- package/dist/cjs/types/interfaces.js +2 -0
- package/dist/{types → cjs/types}/options.d.ts +13 -0
- package/dist/cjs/types/options.js +2 -0
- package/dist/{types → cjs/types}/types.d.ts +38 -10
- package/dist/cjs/types/types.js +2 -0
- package/dist/{utils → cjs/utils}/ClientUtil.d.ts +1 -0
- package/dist/{utils → cjs/utils}/ClientUtil.js +73 -84
- package/dist/{utils → cjs/utils}/CommandUtil.d.ts +4 -2
- package/dist/{utils → cjs/utils}/CommandUtil.js +102 -103
- package/dist/{validators → cjs/validators}/CommandValidations.d.ts +6 -1
- package/dist/{validators → cjs/validators}/CommandValidations.js +36 -50
- package/dist/{validators → cjs/validators}/InhibitorValidations.js +12 -14
- package/dist/mjs/build/ContextCommandBuilder.d.ts +63 -0
- package/dist/mjs/build/ContextCommandBuilder.js +97 -0
- package/dist/mjs/build/EventBuilder.d.ts +21 -0
- package/dist/mjs/build/EventBuilder.js +44 -0
- package/dist/mjs/build/InhibitorBuilder.d.ts +19 -0
- package/dist/mjs/build/InhibitorBuilder.js +37 -0
- package/dist/mjs/build/MessageCommandBuilder.d.ts +59 -0
- package/dist/mjs/build/MessageCommandBuilder.js +100 -0
- package/dist/mjs/build/SlashCommandBuilder.d.ts +65 -0
- package/dist/mjs/build/SlashCommandBuilder.js +169 -0
- package/dist/mjs/client/XernerxClient.d.ts +29 -0
- package/dist/mjs/client/XernerxClient.js +120 -0
- package/dist/mjs/handlers/CommandHandler.d.ts +27 -0
- package/dist/mjs/handlers/CommandHandler.js +45 -0
- package/dist/mjs/handlers/EventHandler.d.ts +13 -0
- package/dist/mjs/handlers/EventHandler.js +19 -0
- package/dist/mjs/handlers/Handler.d.ts +57 -0
- package/dist/mjs/handlers/Handler.js +308 -0
- package/dist/mjs/handlers/InhibitorHandler.d.ts +18 -0
- package/dist/mjs/handlers/InhibitorHandler.js +24 -0
- package/dist/mjs/handlers/WebhookHandler.d.ts +7 -0
- package/dist/mjs/handlers/WebhookHandler.js +23 -0
- package/dist/{main.js → mjs/main.d.ts} +20 -18
- package/dist/mjs/main.js +112 -0
- package/dist/mjs/models/CommandArguments.d.ts +17 -0
- package/dist/mjs/models/CommandArguments.js +106 -0
- package/dist/mjs/models/Events.d.ts +24 -0
- package/dist/mjs/models/Events.js +309 -0
- package/dist/mjs/models/Extensions.d.ts +7 -0
- package/dist/mjs/models/Extensions.js +26 -0
- package/dist/mjs/models/XernerxUser.d.ts +2 -0
- package/dist/mjs/models/XernerxUser.js +12 -0
- package/dist/mjs/tools/XernerxError.d.ts +5 -0
- package/dist/mjs/tools/XernerxError.js +11 -0
- package/dist/mjs/tools/package.d.ts +44 -0
- package/dist/mjs/tools/package.js +45 -0
- package/dist/mjs/types/enums.d.ts +44 -0
- package/dist/mjs/types/enums.js +38 -0
- package/dist/mjs/types/interfaces.d.ts +27 -0
- package/dist/mjs/types/interfaces.js +2 -0
- package/dist/mjs/types/options.d.ts +254 -0
- package/dist/mjs/types/options.js +2 -0
- package/dist/mjs/types/types.d.ts +62 -0
- package/dist/mjs/types/types.js +2 -0
- package/dist/mjs/utils/ClientUtil.d.ts +26 -0
- package/dist/mjs/utils/ClientUtil.js +211 -0
- package/dist/mjs/utils/CommandUtil.d.ts +58 -0
- package/dist/mjs/utils/CommandUtil.js +247 -0
- package/dist/mjs/validators/CommandValidations.d.ts +12 -0
- package/dist/mjs/validators/CommandValidations.js +169 -0
- package/dist/mjs/validators/InhibitorValidations.d.ts +11 -0
- package/dist/mjs/validators/InhibitorValidations.js +40 -0
- package/package.json +11 -15
- package/dist/build/ContextCommandBuilder.js +0 -93
- package/dist/build/EventBuilder.js +0 -34
- package/dist/build/InhibitorBuilder.js +0 -27
- package/dist/build/MessageCommandBuilder.js +0 -90
- package/dist/build/SlashCommandBuilder.js +0 -125
- package/dist/client/XernerxClient.js +0 -101
- package/dist/handlers/Handler.js +0 -250
- package/dist/main.cjs +0 -2023
- package/dist/models/Events.js +0 -294
- package/dist/models/Extensions.js +0 -23
- package/dist/types/enums.d.ts +0 -35
- package/dist/types/enums.js +0 -35
- package/dist/types/interfaces.js +0 -1
- package/dist/types/options.js +0 -1
- package/dist/types/types.js +0 -1
- package/dist/validators/Shapes.js +0 -1
- /package/dist/{build → cjs/build}/EventBuilder.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/CommandHandler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/EventHandler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/Handler.d.ts +0 -0
- /package/dist/{handlers → cjs/handlers}/InhibitorHandler.d.ts +0 -0
- /package/dist/{models → cjs/models}/Events.d.ts +0 -0
- /package/dist/{models → cjs/models}/Extensions.d.ts +0 -0
- /package/dist/{tools → cjs/tools}/XernerxError.d.ts +0 -0
- /package/dist/{validators → cjs/validators}/InhibitorValidations.d.ts +0 -0
|
@@ -10,39 +10,42 @@ export default class ContextCommandBuilder {
|
|
|
10
10
|
id: string;
|
|
11
11
|
data: ContextMenuCommandBuilder;
|
|
12
12
|
name: string;
|
|
13
|
-
type: import(
|
|
13
|
+
type: import('@discordjs/builders').ContextMenuCommandType;
|
|
14
14
|
description: string | undefined;
|
|
15
15
|
info: string | undefined;
|
|
16
16
|
category: string | undefined;
|
|
17
17
|
channelType: number | number[] | undefined;
|
|
18
18
|
cooldown: number | undefined;
|
|
19
|
-
ignore:
|
|
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
|
-
|
|
19
|
+
ignore:
|
|
20
|
+
| {
|
|
21
|
+
owner?: boolean | undefined;
|
|
22
|
+
users?: string[] | undefined;
|
|
23
|
+
channels?: string[] | undefined;
|
|
24
|
+
guilds?: string[] | undefined;
|
|
25
|
+
}
|
|
26
|
+
| undefined;
|
|
27
|
+
strict:
|
|
28
|
+
| {
|
|
29
|
+
owner?: boolean | undefined;
|
|
30
|
+
users?: string[] | undefined;
|
|
31
|
+
channels?: string[] | undefined;
|
|
32
|
+
guilds?: string[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
| undefined;
|
|
35
|
+
permissions:
|
|
36
|
+
| {
|
|
37
|
+
client?: string[] | undefined;
|
|
38
|
+
users?: string[] | undefined;
|
|
39
|
+
dm?: boolean | undefined;
|
|
40
|
+
}
|
|
41
|
+
| undefined;
|
|
42
|
+
defer:
|
|
43
|
+
| {
|
|
44
|
+
reply?: boolean | undefined;
|
|
45
|
+
ephemeral?: boolean | undefined;
|
|
46
|
+
fetch?: boolean | undefined;
|
|
47
|
+
}
|
|
48
|
+
| undefined;
|
|
46
49
|
client: typeof XernerxClient;
|
|
47
50
|
constructor(id: string, options: ContextCommandOptions);
|
|
48
51
|
/**
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8
|
+
const discord_js_1 = require('discord.js');
|
|
9
|
+
const zod_1 = require('zod');
|
|
10
|
+
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
11
|
+
/**
|
|
12
|
+
* @description The command builder for context commands.
|
|
13
|
+
* @param {String} id - The unique ID of the command.
|
|
14
|
+
* @param {ContextCommandOptions} options - The command options.
|
|
15
|
+
*/
|
|
16
|
+
class ContextCommandBuilder {
|
|
17
|
+
id;
|
|
18
|
+
data;
|
|
19
|
+
name;
|
|
20
|
+
type;
|
|
21
|
+
description;
|
|
22
|
+
info;
|
|
23
|
+
category;
|
|
24
|
+
channelType;
|
|
25
|
+
cooldown;
|
|
26
|
+
ignore;
|
|
27
|
+
strict;
|
|
28
|
+
permissions;
|
|
29
|
+
defer;
|
|
30
|
+
client;
|
|
31
|
+
constructor(id, options) {
|
|
32
|
+
this.id = id;
|
|
33
|
+
this.data = new discord_js_1.ContextMenuCommandBuilder();
|
|
34
|
+
if (options.name) this.data.setName(options.name);
|
|
35
|
+
if (options.type) this.data.setType(options.type);
|
|
36
|
+
if (options.permissions?.users) this.data.setDefaultMemberPermissions(options.permissions?.users);
|
|
37
|
+
if (options.permissions?.dm === false) this.data.setDMPermission(options.permissions?.dm);
|
|
38
|
+
if (options.nameLocalizations) this.data.setNameLocalizations(options.nameLocalizations);
|
|
39
|
+
zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
description: zod_1.z.string(),
|
|
42
|
+
info: zod_1.z.string(),
|
|
43
|
+
category: zod_1.z.string(),
|
|
44
|
+
channelType: zod_1.z.array(zod_1.z.number()).or(zod_1.z.number()),
|
|
45
|
+
cooldown: zod_1.z.number(),
|
|
46
|
+
ignore: zod_1.z.object({
|
|
47
|
+
owner: zod_1.z.boolean(),
|
|
48
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
49
|
+
channels: zod_1.z.array(zod_1.z.string()),
|
|
50
|
+
guilds: zod_1.z.array(zod_1.z.string()),
|
|
51
|
+
}),
|
|
52
|
+
strict: zod_1.z.object({
|
|
53
|
+
owner: zod_1.z.boolean(),
|
|
54
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
55
|
+
channels: zod_1.z.array(zod_1.z.string()),
|
|
56
|
+
guilds: zod_1.z.array(zod_1.z.string()),
|
|
57
|
+
}),
|
|
58
|
+
permissions: zod_1.z.object({
|
|
59
|
+
client: zod_1.z.array(zod_1.z.string()),
|
|
60
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
61
|
+
dm: zod_1.z.boolean(),
|
|
62
|
+
}),
|
|
63
|
+
defer: zod_1.z.object({
|
|
64
|
+
reply: zod_1.z.boolean(),
|
|
65
|
+
ephemeral: zod_1.z.boolean(),
|
|
66
|
+
fetch: zod_1.z.boolean(),
|
|
67
|
+
}),
|
|
68
|
+
})
|
|
69
|
+
.deepPartial()
|
|
70
|
+
.parse(options);
|
|
71
|
+
this.name = options.name;
|
|
72
|
+
this.type = options.type;
|
|
73
|
+
this.description = options.description;
|
|
74
|
+
this.info = options.info;
|
|
75
|
+
this.category = options.category;
|
|
76
|
+
this.channelType = options.channelType;
|
|
77
|
+
this.cooldown = options.cooldown;
|
|
78
|
+
this.ignore = options.ignore;
|
|
79
|
+
this.strict = options.strict;
|
|
80
|
+
this.permissions = options.permissions;
|
|
81
|
+
this.defer = options.defer;
|
|
82
|
+
this.client = XernerxClient_js_1.default;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
86
|
+
* @description make any preconditions here.
|
|
87
|
+
* TODO - update description
|
|
88
|
+
*/
|
|
89
|
+
async conditions(interaction, args) {}
|
|
90
|
+
/**
|
|
91
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
92
|
+
* @description Make your custom command here.
|
|
93
|
+
* TODO - update description
|
|
94
|
+
*/
|
|
95
|
+
async exec(interaction, args) {}
|
|
96
|
+
}
|
|
97
|
+
exports.default = ContextCommandBuilder;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8
|
+
const zod_1 = require('zod');
|
|
9
|
+
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
10
|
+
/**
|
|
11
|
+
* @description - The event builder for events.
|
|
12
|
+
* @param {String} id - The unique ID of the event.
|
|
13
|
+
* @param {EventOptions} options - The event options.
|
|
14
|
+
*/
|
|
15
|
+
class EventBuilder {
|
|
16
|
+
id;
|
|
17
|
+
name;
|
|
18
|
+
emitter;
|
|
19
|
+
type;
|
|
20
|
+
once;
|
|
21
|
+
client;
|
|
22
|
+
constructor(id, options) {
|
|
23
|
+
this.id = id;
|
|
24
|
+
zod_1.z
|
|
25
|
+
.object({
|
|
26
|
+
name: zod_1.z.string(),
|
|
27
|
+
emitter: zod_1.z.string().optional(),
|
|
28
|
+
type: zod_1.z.string().optional(),
|
|
29
|
+
once: zod_1.z.boolean().optional(),
|
|
30
|
+
})
|
|
31
|
+
.parse(options);
|
|
32
|
+
this.name = options.name;
|
|
33
|
+
this.emitter = options.emitter || 'client';
|
|
34
|
+
this.type = options.type || 'discord';
|
|
35
|
+
this.once = options.once || false;
|
|
36
|
+
this.client = XernerxClient_js_1.default;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @description run your custom event here.
|
|
40
|
+
* TODO - update description
|
|
41
|
+
*/
|
|
42
|
+
async run() {}
|
|
43
|
+
}
|
|
44
|
+
exports.default = EventBuilder;
|
|
@@ -9,7 +9,7 @@ import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
|
9
9
|
export default class InhibitorBuilder {
|
|
10
10
|
id: string;
|
|
11
11
|
name: string;
|
|
12
|
-
type: import(
|
|
12
|
+
type: import('../main.js').InhibitorType;
|
|
13
13
|
client: typeof XernerxClient;
|
|
14
14
|
constructor(id: string, options: InhibitorOptions);
|
|
15
15
|
/**
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8
|
+
const zod_1 = require('zod');
|
|
9
|
+
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
10
|
+
/**
|
|
11
|
+
* @description - The inhibitor builder for inhibitors.
|
|
12
|
+
* @param {String} id - The unique ID of the inhibitor.
|
|
13
|
+
* @param {InhibitorOptions} options - The inhibitor options.
|
|
14
|
+
*/
|
|
15
|
+
class InhibitorBuilder {
|
|
16
|
+
id;
|
|
17
|
+
name;
|
|
18
|
+
type;
|
|
19
|
+
client;
|
|
20
|
+
constructor(id, options) {
|
|
21
|
+
this.id = id;
|
|
22
|
+
zod_1.z
|
|
23
|
+
.object({
|
|
24
|
+
name: zod_1.z.string(),
|
|
25
|
+
type: zod_1.z.string(),
|
|
26
|
+
})
|
|
27
|
+
.parse(options);
|
|
28
|
+
this.name = options.name;
|
|
29
|
+
this.type = options.type;
|
|
30
|
+
this.client = XernerxClient_js_1.default;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* TODO - update description
|
|
34
|
+
*/
|
|
35
|
+
async check(interaction, args) {}
|
|
36
|
+
}
|
|
37
|
+
exports.default = InhibitorBuilder;
|
|
@@ -17,23 +17,29 @@ export default class MessageCommandBuilder {
|
|
|
17
17
|
prefix: string[];
|
|
18
18
|
regex: string | undefined;
|
|
19
19
|
channelType: number[] | undefined;
|
|
20
|
-
ignore:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
ignore:
|
|
21
|
+
| {
|
|
22
|
+
owner?: boolean | undefined;
|
|
23
|
+
users?: string[] | undefined;
|
|
24
|
+
channels?: string[] | undefined;
|
|
25
|
+
guilds?: string[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
| undefined;
|
|
28
|
+
strict:
|
|
29
|
+
| {
|
|
30
|
+
owner?: boolean | undefined;
|
|
31
|
+
users?: string[] | undefined;
|
|
32
|
+
channels?: string[] | undefined;
|
|
33
|
+
guilds?: string[] | undefined;
|
|
34
|
+
}
|
|
35
|
+
| undefined;
|
|
36
|
+
permissions:
|
|
37
|
+
| {
|
|
38
|
+
client?: string[] | undefined;
|
|
39
|
+
user?: string[] | undefined;
|
|
40
|
+
dm?: boolean | undefined;
|
|
41
|
+
}
|
|
42
|
+
| undefined;
|
|
37
43
|
cooldown: number;
|
|
38
44
|
args: MessageArgumentOptions[];
|
|
39
45
|
client: typeof XernerxClient;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8
|
+
const zod_1 = require('zod');
|
|
9
|
+
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
10
|
+
/**
|
|
11
|
+
* @description - The command builder for message commands.
|
|
12
|
+
* @param {String} id - The unique ID of the command.
|
|
13
|
+
* @param {MessageCommandOptions} options - The command options.
|
|
14
|
+
*/
|
|
15
|
+
class MessageCommandBuilder {
|
|
16
|
+
id;
|
|
17
|
+
name;
|
|
18
|
+
aliases;
|
|
19
|
+
separator;
|
|
20
|
+
description;
|
|
21
|
+
info;
|
|
22
|
+
category;
|
|
23
|
+
prefix;
|
|
24
|
+
regex;
|
|
25
|
+
channelType;
|
|
26
|
+
ignore;
|
|
27
|
+
strict;
|
|
28
|
+
permissions;
|
|
29
|
+
cooldown;
|
|
30
|
+
args;
|
|
31
|
+
client;
|
|
32
|
+
constructor(id, options) {
|
|
33
|
+
this.id = id;
|
|
34
|
+
zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
name: zod_1.z.string(),
|
|
37
|
+
aliases: zod_1.z.array(zod_1.z.string()).optional(),
|
|
38
|
+
separator: zod_1.z.string().min(1).max(1).optional(),
|
|
39
|
+
description: zod_1.z.string().optional(),
|
|
40
|
+
info: zod_1.z.string().optional(),
|
|
41
|
+
category: zod_1.z.string().optional(),
|
|
42
|
+
prefix: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
43
|
+
regex: zod_1.z.unknown(),
|
|
44
|
+
channelType: zod_1.z.array(zod_1.z.number()).or(zod_1.z.number()).optional(),
|
|
45
|
+
cooldown: zod_1.z.number().optional(),
|
|
46
|
+
ignore: zod_1.z
|
|
47
|
+
.object({
|
|
48
|
+
owners: zod_1.z.boolean().optional(),
|
|
49
|
+
users: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
50
|
+
channels: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
51
|
+
guilds: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
52
|
+
})
|
|
53
|
+
.optional(),
|
|
54
|
+
strict: zod_1.z
|
|
55
|
+
.object({
|
|
56
|
+
owners: zod_1.z.boolean().optional(),
|
|
57
|
+
users: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
58
|
+
channels: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
59
|
+
guilds: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).optional(),
|
|
60
|
+
})
|
|
61
|
+
.optional(),
|
|
62
|
+
permissions: zod_1.z
|
|
63
|
+
.object({
|
|
64
|
+
client: zod_1.z.array(zod_1.z.string()).optional(),
|
|
65
|
+
users: zod_1.z.array(zod_1.z.string()).optional(),
|
|
66
|
+
dm: zod_1.z.boolean().optional(),
|
|
67
|
+
})
|
|
68
|
+
.optional(),
|
|
69
|
+
})
|
|
70
|
+
.parse(options);
|
|
71
|
+
this.name = options.name;
|
|
72
|
+
this.aliases = options.aliases;
|
|
73
|
+
this.separator = options.separator || ' ';
|
|
74
|
+
this.description = options.description;
|
|
75
|
+
this.info = options.info;
|
|
76
|
+
this.category = options.category;
|
|
77
|
+
this.prefix = options.prefix ? (Array.isArray(options.prefix) ? options.prefix : [options.prefix]) : [];
|
|
78
|
+
this.regex = options.regex;
|
|
79
|
+
this.channelType = options.channelType;
|
|
80
|
+
this.ignore = options.ignore;
|
|
81
|
+
this.strict = options.strict;
|
|
82
|
+
this.permissions = options.permissions;
|
|
83
|
+
this.cooldown = options.cooldown || 0;
|
|
84
|
+
this.args = options.args || [];
|
|
85
|
+
this.client = XernerxClient_js_1.default;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {Message} message - The Discord message event data.
|
|
89
|
+
* @param {object} args - The arguments you created.
|
|
90
|
+
* @description make any preconditions here.
|
|
91
|
+
*/
|
|
92
|
+
async conditions(message, args) {}
|
|
93
|
+
/**
|
|
94
|
+
* @param {Message} message - The Discord message event data.
|
|
95
|
+
* @param {object} args - The arguments you created.
|
|
96
|
+
* @description Make your custom command here.
|
|
97
|
+
*/
|
|
98
|
+
async exec(message, args) {}
|
|
99
|
+
}
|
|
100
|
+
exports.default = MessageCommandBuilder;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Discord from 'discord.js';
|
|
2
|
+
import { Interaction } from 'discord.js';
|
|
2
3
|
import { SlashCommandOptions } from '../types/options.js';
|
|
3
4
|
import XernerxClient from '../client/XernerxClient.js';
|
|
4
5
|
/**
|
|
@@ -15,18 +16,22 @@ export default class SlashCommandBuilder {
|
|
|
15
16
|
category: string | undefined;
|
|
16
17
|
channelType: Discord.ChannelType | undefined;
|
|
17
18
|
cooldown: number | undefined;
|
|
18
|
-
ignore:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
ignore:
|
|
20
|
+
| {
|
|
21
|
+
owner?: boolean | undefined;
|
|
22
|
+
users?: string[] | undefined;
|
|
23
|
+
channels?: string[] | undefined;
|
|
24
|
+
guilds?: string[] | undefined;
|
|
25
|
+
}
|
|
26
|
+
| undefined;
|
|
27
|
+
strict:
|
|
28
|
+
| {
|
|
29
|
+
owner?: boolean | undefined;
|
|
30
|
+
users?: string[] | undefined;
|
|
31
|
+
channels?: string[] | undefined;
|
|
32
|
+
guilds?: string[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
| undefined;
|
|
30
35
|
permissions: {
|
|
31
36
|
client?: string[] | undefined;
|
|
32
37
|
users?: string[] | undefined;
|
|
@@ -35,11 +40,13 @@ export default class SlashCommandBuilder {
|
|
|
35
40
|
args?: object[];
|
|
36
41
|
subcommands?: object[];
|
|
37
42
|
groups?: object[];
|
|
38
|
-
defer:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
defer:
|
|
44
|
+
| {
|
|
45
|
+
reply?: boolean | undefined;
|
|
46
|
+
ephemeral?: boolean | undefined;
|
|
47
|
+
fetchReply?: boolean | undefined;
|
|
48
|
+
}
|
|
49
|
+
| undefined;
|
|
43
50
|
client: typeof XernerxClient;
|
|
44
51
|
constructor(id: string, options: SlashCommandOptions);
|
|
45
52
|
/**
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return m[k];
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}
|
|
18
|
+
: function (o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
});
|
|
22
|
+
var __setModuleDefault =
|
|
23
|
+
(this && this.__setModuleDefault) ||
|
|
24
|
+
(Object.create
|
|
25
|
+
? function (o, v) {
|
|
26
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
27
|
+
}
|
|
28
|
+
: function (o, v) {
|
|
29
|
+
o['default'] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar =
|
|
32
|
+
(this && this.__importStar) ||
|
|
33
|
+
function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
var __importDefault =
|
|
41
|
+
(this && this.__importDefault) ||
|
|
42
|
+
function (mod) {
|
|
43
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
46
|
+
const Discord = __importStar(require('discord.js'));
|
|
47
|
+
const discord_js_1 = require('discord.js');
|
|
48
|
+
const zod_1 = require('zod');
|
|
49
|
+
const XernerxError_js_1 = __importDefault(require('../tools/XernerxError.js'));
|
|
50
|
+
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
51
|
+
/**
|
|
52
|
+
* @description - The command builder for slash commands.
|
|
53
|
+
* @param {String} id - The unique ID of the command.
|
|
54
|
+
* @param {SlashCommandOptions} options - The command options.
|
|
55
|
+
*/
|
|
56
|
+
class SlashCommandBuilder {
|
|
57
|
+
id;
|
|
58
|
+
data;
|
|
59
|
+
name;
|
|
60
|
+
description;
|
|
61
|
+
info;
|
|
62
|
+
category;
|
|
63
|
+
channelType;
|
|
64
|
+
cooldown;
|
|
65
|
+
ignore;
|
|
66
|
+
strict;
|
|
67
|
+
permissions;
|
|
68
|
+
args;
|
|
69
|
+
subcommands;
|
|
70
|
+
groups;
|
|
71
|
+
defer;
|
|
72
|
+
client;
|
|
73
|
+
constructor(id, options) {
|
|
74
|
+
this.id = id;
|
|
75
|
+
this.data = new Discord.SlashCommandBuilder().setName(options.name).setDescription(options.description);
|
|
76
|
+
if (options.args && options?.args?.length > 0) {
|
|
77
|
+
this.addArgs(this.data, options.args);
|
|
78
|
+
}
|
|
79
|
+
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
80
|
+
this.addSubcommands(this.data, options.subcommands);
|
|
81
|
+
}
|
|
82
|
+
if (options.groups && options?.groups?.length > 0) {
|
|
83
|
+
this.addSubcommandGroups(options.groups);
|
|
84
|
+
}
|
|
85
|
+
zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
description: zod_1.z.string(),
|
|
88
|
+
info: zod_1.z.string(),
|
|
89
|
+
category: zod_1.z.string(),
|
|
90
|
+
channelType: zod_1.z.array(zod_1.z.number()).or(zod_1.z.number()),
|
|
91
|
+
cooldown: zod_1.z.number(),
|
|
92
|
+
ignore: zod_1.z.object({
|
|
93
|
+
owner: zod_1.z.boolean(),
|
|
94
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
95
|
+
channels: zod_1.z.array(zod_1.z.string()),
|
|
96
|
+
guilds: zod_1.z.array(zod_1.z.string()),
|
|
97
|
+
}),
|
|
98
|
+
strict: zod_1.z.object({
|
|
99
|
+
owner: zod_1.z.boolean(),
|
|
100
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
101
|
+
channels: zod_1.z.array(zod_1.z.string()),
|
|
102
|
+
guilds: zod_1.z.array(zod_1.z.string()),
|
|
103
|
+
}),
|
|
104
|
+
permissions: zod_1.z.object({
|
|
105
|
+
client: zod_1.z.array(zod_1.z.string()),
|
|
106
|
+
users: zod_1.z.array(zod_1.z.string()),
|
|
107
|
+
dm: zod_1.z.boolean(),
|
|
108
|
+
}),
|
|
109
|
+
defer: zod_1.z.object({
|
|
110
|
+
reply: zod_1.z.boolean(),
|
|
111
|
+
ephemeral: zod_1.z.boolean(),
|
|
112
|
+
fetch: zod_1.z.boolean(),
|
|
113
|
+
}),
|
|
114
|
+
})
|
|
115
|
+
.deepPartial()
|
|
116
|
+
.parse(options);
|
|
117
|
+
this.name = options.name;
|
|
118
|
+
this.description = options.description;
|
|
119
|
+
this.info = options.info;
|
|
120
|
+
this.category = options.category;
|
|
121
|
+
this.channelType = options.channelType;
|
|
122
|
+
this.cooldown = options.cooldown;
|
|
123
|
+
this.ignore = options.ignore;
|
|
124
|
+
this.strict = options.strict;
|
|
125
|
+
this.permissions = options.permissions;
|
|
126
|
+
this.defer = options.defer;
|
|
127
|
+
this.client = XernerxClient_js_1.default;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* TODO - update description
|
|
131
|
+
* @param interaction
|
|
132
|
+
*/
|
|
133
|
+
async conditions(interaction) {}
|
|
134
|
+
/**
|
|
135
|
+
* TODO - update description
|
|
136
|
+
* @param interaction
|
|
137
|
+
*/
|
|
138
|
+
async exec(interaction) {}
|
|
139
|
+
addArgs(command, args) {
|
|
140
|
+
const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
|
|
141
|
+
for (const argument of args) {
|
|
142
|
+
if (!types.includes(argument.type.toLowerCase())) throw new XernerxError_js_1.default(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
|
|
143
|
+
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
144
|
+
command[`add${slashArgumentType}Option`]((option) => {
|
|
145
|
+
option
|
|
146
|
+
.setName(argument.name)
|
|
147
|
+
.setDescription(argument.description)
|
|
148
|
+
.setRequired(argument.required || false);
|
|
149
|
+
if (argument.choices) option.setChoices(...argument?.choices);
|
|
150
|
+
return option;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
addSubcommands(method, subcommands) {
|
|
155
|
+
for (const subcommand of subcommands) {
|
|
156
|
+
let sub = new discord_js_1.SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
157
|
+
if (subcommand.args?.length > 0) this.addArgs(sub, subcommand.args);
|
|
158
|
+
method.addSubcommand(sub);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
addSubcommandGroups(groups) {
|
|
162
|
+
for (const group of groups) {
|
|
163
|
+
let subcommandGroup = new discord_js_1.SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
164
|
+
if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
|
|
165
|
+
this.data.addSubcommandGroup(subcommandGroup);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.default = SlashCommandBuilder;
|
|
@@ -19,6 +19,7 @@ export default class XernerxClient extends Client {
|
|
|
19
19
|
util: ClientUtil;
|
|
20
20
|
handlerOptions: HandlerOptions;
|
|
21
21
|
events: Collection<string, EventBuilder>;
|
|
22
|
+
stats: object;
|
|
22
23
|
extensions: Record<string, ExtensionBuilder>;
|
|
23
24
|
inhibitors: Collection<string, InhibitorBuilder>;
|
|
24
25
|
config: object;
|