xernerx 4.2.0 → 4.2.1
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/LICENSE +21 -21
- package/dist/cjs/build/ContextCommandBuilder.d.ts +68 -0
- package/dist/cjs/build/ContextCommandBuilder.js +97 -0
- package/dist/cjs/build/EventBuilder.d.ts +21 -0
- package/dist/cjs/build/EventBuilder.js +44 -0
- package/dist/cjs/build/InhibitorBuilder.d.ts +19 -0
- package/dist/cjs/build/InhibitorBuilder.js +37 -0
- package/dist/cjs/build/MessageCommandBuilder.d.ts +59 -0
- package/dist/cjs/build/MessageCommandBuilder.js +100 -0
- package/dist/cjs/build/SlashCommandBuilder.d.ts +64 -0
- package/dist/cjs/build/SlashCommandBuilder.js +168 -0
- package/dist/cjs/client/XernerxClient.d.ts +28 -0
- package/dist/cjs/client/XernerxClient.js +116 -0
- package/dist/cjs/handlers/CommandHandler.d.ts +27 -0
- package/dist/cjs/handlers/CommandHandler.js +45 -0
- package/dist/cjs/handlers/EventHandler.d.ts +13 -0
- package/dist/cjs/handlers/EventHandler.js +19 -0
- package/dist/cjs/handlers/Handler.d.ts +57 -0
- package/dist/cjs/handlers/Handler.js +308 -0
- package/dist/cjs/handlers/InhibitorHandler.d.ts +18 -0
- package/dist/cjs/handlers/InhibitorHandler.js +24 -0
- package/dist/cjs/main.d.ts +44 -0
- package/dist/cjs/main.js +112 -0
- package/dist/cjs/models/CommandArguments.d.ts +17 -0
- package/dist/cjs/models/CommandArguments.js +106 -0
- package/dist/cjs/models/Events.d.ts +24 -0
- package/dist/cjs/models/Events.js +307 -0
- package/dist/cjs/models/Extensions.d.ts +7 -0
- package/dist/cjs/models/Extensions.js +26 -0
- package/dist/cjs/tools/XernerxError.d.ts +5 -0
- package/dist/cjs/tools/XernerxError.js +11 -0
- package/dist/cjs/tools/package.d.ts +49 -0
- package/dist/cjs/tools/package.js +50 -0
- package/dist/cjs/types/enums.d.ts +44 -0
- package/dist/cjs/types/enums.js +38 -0
- package/dist/cjs/types/interfaces.d.ts +25 -0
- package/dist/cjs/types/interfaces.js +2 -0
- package/dist/cjs/types/options.d.ts +241 -0
- package/dist/cjs/types/options.js +2 -0
- package/dist/cjs/types/types.d.ts +61 -0
- package/dist/cjs/types/types.js +2 -0
- package/dist/cjs/utils/ClientUtil.d.ts +25 -0
- package/dist/cjs/utils/ClientUtil.js +211 -0
- package/dist/cjs/utils/CommandUtil.d.ts +58 -0
- package/dist/cjs/utils/CommandUtil.js +247 -0
- package/dist/cjs/validators/CommandValidations.d.ts +12 -0
- package/dist/cjs/validators/CommandValidations.js +169 -0
- package/dist/cjs/validators/InhibitorValidations.d.ts +11 -0
- package/dist/cjs/validators/InhibitorValidations.js +40 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/mjs/build/ContextCommandBuilder.d.ts +68 -0
- package/dist/mjs/build/ContextCommandBuilder.js +88 -0
- package/dist/mjs/build/EventBuilder.d.ts +21 -0
- package/dist/mjs/build/EventBuilder.js +34 -0
- package/dist/mjs/build/InhibitorBuilder.d.ts +19 -0
- package/dist/mjs/build/InhibitorBuilder.js +27 -0
- package/dist/mjs/build/MessageCommandBuilder.d.ts +59 -0
- package/dist/mjs/build/MessageCommandBuilder.js +90 -0
- package/dist/mjs/build/SlashCommandBuilder.d.ts +64 -0
- package/dist/mjs/build/SlashCommandBuilder.js +121 -0
- package/dist/mjs/client/XernerxClient.d.ts +28 -0
- package/dist/mjs/client/XernerxClient.js +108 -0
- package/dist/mjs/handlers/CommandHandler.d.ts +27 -0
- package/dist/mjs/handlers/CommandHandler.js +42 -0
- package/dist/mjs/handlers/EventHandler.d.ts +13 -0
- package/dist/mjs/handlers/EventHandler.js +16 -0
- package/dist/mjs/handlers/Handler.d.ts +57 -0
- package/dist/mjs/handlers/Handler.js +260 -0
- package/dist/mjs/handlers/InhibitorHandler.d.ts +18 -0
- package/dist/mjs/handlers/InhibitorHandler.js +21 -0
- package/dist/mjs/main.d.ts +44 -0
- package/dist/mjs/main.js +52 -0
- package/dist/mjs/models/CommandArguments.d.ts +17 -0
- package/dist/mjs/models/CommandArguments.js +101 -0
- package/dist/mjs/models/Events.d.ts +24 -0
- package/dist/mjs/models/Events.js +295 -0
- package/dist/mjs/models/Extensions.d.ts +7 -0
- package/dist/mjs/models/Extensions.js +23 -0
- package/dist/mjs/tools/XernerxError.d.ts +5 -0
- package/dist/mjs/tools/XernerxError.js +8 -0
- package/dist/mjs/tools/package.d.ts +49 -0
- package/dist/mjs/tools/package.js +48 -0
- package/dist/mjs/types/enums.d.ts +44 -0
- package/dist/mjs/types/enums.js +35 -0
- package/dist/mjs/types/interfaces.d.ts +25 -0
- package/dist/mjs/types/interfaces.js +1 -0
- package/dist/mjs/types/options.d.ts +241 -0
- package/dist/mjs/types/options.js +1 -0
- package/dist/mjs/types/types.d.ts +61 -0
- package/dist/mjs/types/types.js +1 -0
- package/dist/mjs/utils/ClientUtil.d.ts +25 -0
- package/dist/mjs/utils/ClientUtil.js +202 -0
- package/dist/mjs/utils/CommandUtil.d.ts +58 -0
- package/dist/mjs/utils/CommandUtil.js +232 -0
- package/dist/mjs/validators/CommandValidations.d.ts +12 -0
- package/dist/mjs/validators/CommandValidations.js +166 -0
- package/dist/mjs/validators/InhibitorValidations.d.ts +11 -0
- package/dist/mjs/validators/InhibitorValidations.js +36 -0
- package/dist/tools/XernerxLog.js +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Dummi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Dummi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
+
import { ContextCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description The command builder for context commands.
|
|
6
|
+
* @param {String} id - The unique ID of the command.
|
|
7
|
+
* @param {ContextCommandOptions} options - The command options.
|
|
8
|
+
*/
|
|
9
|
+
export default class ContextCommandBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
data: ContextMenuCommandBuilder;
|
|
12
|
+
name: string;
|
|
13
|
+
type: import('@discordjs/builders').ContextMenuCommandType;
|
|
14
|
+
description: string | undefined;
|
|
15
|
+
info: string | undefined;
|
|
16
|
+
category: string | undefined;
|
|
17
|
+
channelType: number | number[] | undefined;
|
|
18
|
+
cooldown: number | undefined;
|
|
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
|
+
/**
|
|
45
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
46
|
+
* @description Make your custom command here.
|
|
47
|
+
* TODO - update description
|
|
48
|
+
*/
|
|
49
|
+
reply?: boolean | undefined;
|
|
50
|
+
ephemeral?: boolean | undefined;
|
|
51
|
+
fetch?: boolean | undefined;
|
|
52
|
+
}
|
|
53
|
+
| undefined;
|
|
54
|
+
client: typeof XernerxClient;
|
|
55
|
+
constructor(id: string, options: ContextCommandOptions);
|
|
56
|
+
/**
|
|
57
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
58
|
+
* @description make any preconditions here.
|
|
59
|
+
* TODO - update description
|
|
60
|
+
*/
|
|
61
|
+
conditions(interaction: Interaction, args: any): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
64
|
+
* @description Make your custom command here.
|
|
65
|
+
* TODO - update description
|
|
66
|
+
*/
|
|
67
|
+
exec(interaction: Interaction, args: any): Promise<void>;
|
|
68
|
+
}
|
|
@@ -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,21 @@
|
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { EventOptions } from '../types/options.js';
|
|
3
|
+
/**
|
|
4
|
+
* @description - The event builder for events.
|
|
5
|
+
* @param {String} id - The unique ID of the event.
|
|
6
|
+
* @param {EventOptions} options - The event options.
|
|
7
|
+
*/
|
|
8
|
+
export default class EventBuilder {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
emitter: string;
|
|
12
|
+
type: string;
|
|
13
|
+
once: boolean;
|
|
14
|
+
client: typeof XernerxClient;
|
|
15
|
+
constructor(id: string, options: EventOptions);
|
|
16
|
+
/**
|
|
17
|
+
* @description run your custom event here.
|
|
18
|
+
* TODO - update description
|
|
19
|
+
*/
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { InhibitorOptions, MessageArgumentOptions, SlashArgumentOptions } from '../types/options.js';
|
|
3
|
+
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description - The inhibitor builder for inhibitors.
|
|
6
|
+
* @param {String} id - The unique ID of the inhibitor.
|
|
7
|
+
* @param {InhibitorOptions} options - The inhibitor options.
|
|
8
|
+
*/
|
|
9
|
+
export default class InhibitorBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: import('../main.js').InhibitorType;
|
|
13
|
+
client: typeof XernerxClient;
|
|
14
|
+
constructor(id: string, options: InhibitorOptions);
|
|
15
|
+
/**
|
|
16
|
+
* TODO - update description
|
|
17
|
+
*/
|
|
18
|
+
check(interaction: XernerxInteraction | XernerxMessage, args: SlashArgumentOptions | MessageArgumentOptions): Promise<void>;
|
|
19
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { MessageArgumentOptions, MessageCommandOptions } from '../types/options.js';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
+
import { XernerxMessage } from '../types/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description - The command builder for message commands.
|
|
6
|
+
* @param {String} id - The unique ID of the command.
|
|
7
|
+
* @param {MessageCommandOptions} options - The command options.
|
|
8
|
+
*/
|
|
9
|
+
export default class MessageCommandBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
aliases: string[] | undefined;
|
|
13
|
+
separator: string;
|
|
14
|
+
description: string | undefined;
|
|
15
|
+
info: string | undefined;
|
|
16
|
+
category: string | undefined;
|
|
17
|
+
prefix: string[];
|
|
18
|
+
regex: string | undefined;
|
|
19
|
+
channelType: number[] | undefined;
|
|
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;
|
|
43
|
+
cooldown: number;
|
|
44
|
+
args: MessageArgumentOptions[];
|
|
45
|
+
client: typeof XernerxClient;
|
|
46
|
+
constructor(id: string, options: MessageCommandOptions);
|
|
47
|
+
/**
|
|
48
|
+
* @param {Message} message - The Discord message event data.
|
|
49
|
+
* @param {object} args - The arguments you created.
|
|
50
|
+
* @description make any preconditions here.
|
|
51
|
+
*/
|
|
52
|
+
conditions(message: XernerxMessage, args: MessageArgumentOptions): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* @param {Message} message - The Discord message event data.
|
|
55
|
+
* @param {object} args - The arguments you created.
|
|
56
|
+
* @description Make your custom command here.
|
|
57
|
+
*/
|
|
58
|
+
exec(message: XernerxMessage, args: MessageArgumentOptions): Promise<void>;
|
|
59
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Discord, { Interaction } from 'discord.js';
|
|
2
|
+
import { SlashCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description - The command builder for slash commands.
|
|
6
|
+
* @param {String} id - The unique ID of the command.
|
|
7
|
+
* @param {SlashCommandOptions} options - The command options.
|
|
8
|
+
*/
|
|
9
|
+
export default class SlashCommandBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
data: Discord.SlashCommandBuilder;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
info: string | undefined;
|
|
15
|
+
category: string | undefined;
|
|
16
|
+
channelType: Discord.ChannelType | undefined;
|
|
17
|
+
cooldown: number | undefined;
|
|
18
|
+
ignore:
|
|
19
|
+
| {
|
|
20
|
+
owner?: boolean | undefined;
|
|
21
|
+
users?: string[] | undefined;
|
|
22
|
+
channels?: string[] | undefined;
|
|
23
|
+
guilds?: string[] | undefined;
|
|
24
|
+
}
|
|
25
|
+
| undefined;
|
|
26
|
+
strict:
|
|
27
|
+
| {
|
|
28
|
+
owner?: boolean | undefined;
|
|
29
|
+
users?: string[] | undefined;
|
|
30
|
+
channels?: string[] | undefined;
|
|
31
|
+
guilds?: string[] | undefined;
|
|
32
|
+
}
|
|
33
|
+
| undefined;
|
|
34
|
+
permissions: {
|
|
35
|
+
client?: string[] | undefined;
|
|
36
|
+
users?: string[] | undefined;
|
|
37
|
+
dm?: boolean | undefined;
|
|
38
|
+
};
|
|
39
|
+
args?: object[];
|
|
40
|
+
subcommands?: object[];
|
|
41
|
+
groups?: object[];
|
|
42
|
+
defer:
|
|
43
|
+
| {
|
|
44
|
+
reply?: boolean | undefined;
|
|
45
|
+
ephemeral?: boolean | undefined;
|
|
46
|
+
fetchReply?: boolean | undefined;
|
|
47
|
+
}
|
|
48
|
+
| undefined;
|
|
49
|
+
client: typeof XernerxClient;
|
|
50
|
+
constructor(id: string, options: SlashCommandOptions);
|
|
51
|
+
/**
|
|
52
|
+
* TODO - update description
|
|
53
|
+
* @param interaction
|
|
54
|
+
*/
|
|
55
|
+
conditions(interaction: Interaction): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* TODO - update description
|
|
58
|
+
* @param interaction
|
|
59
|
+
*/
|
|
60
|
+
exec(interaction: Interaction): Promise<void>;
|
|
61
|
+
private addArgs;
|
|
62
|
+
private addSubcommands;
|
|
63
|
+
private addSubcommandGroups;
|
|
64
|
+
}
|