xernerx 4.2.1 → 4.3.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/LICENSE +21 -21
- package/dist/build/ContextCommandBuilder.d.ts +14 -13
- package/dist/build/ContextCommandBuilder.js +2 -13
- package/dist/build/EventBuilder.d.ts +7 -7
- package/dist/build/EventBuilder.js +0 -6
- package/dist/build/InhibitorBuilder.d.ts +5 -5
- package/dist/build/InhibitorBuilder.js +0 -4
- package/dist/build/MessageCommandBuilder.d.ts +1 -0
- package/dist/build/MessageCommandBuilder.js +2 -16
- package/dist/build/SlashCommandBuilder.d.ts +13 -12
- package/dist/build/SlashCommandBuilder.js +2 -12
- package/dist/client/XernerxClient.d.ts +2 -2
- package/dist/client/XernerxClient.js +2 -2
- package/dist/handlers/ExtensionHandler.js +3 -1
- package/dist/handlers/WebhookHandler.js +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/types/interfaces.d.ts +3 -2
- package/dist/utils/ClientUtil.d.ts +1 -0
- package/dist/utils/ClientUtil.js +10 -0
- package/package.json +2 -2
- package/dist/cjs/build/ContextCommandBuilder.d.ts +0 -68
- package/dist/cjs/build/ContextCommandBuilder.js +0 -97
- package/dist/cjs/build/EventBuilder.d.ts +0 -21
- package/dist/cjs/build/EventBuilder.js +0 -44
- package/dist/cjs/build/InhibitorBuilder.d.ts +0 -19
- package/dist/cjs/build/InhibitorBuilder.js +0 -37
- package/dist/cjs/build/MessageCommandBuilder.d.ts +0 -59
- package/dist/cjs/build/MessageCommandBuilder.js +0 -100
- package/dist/cjs/build/SlashCommandBuilder.d.ts +0 -64
- package/dist/cjs/build/SlashCommandBuilder.js +0 -168
- package/dist/cjs/client/XernerxClient.d.ts +0 -28
- package/dist/cjs/client/XernerxClient.js +0 -116
- package/dist/cjs/handlers/CommandHandler.d.ts +0 -27
- package/dist/cjs/handlers/CommandHandler.js +0 -45
- package/dist/cjs/handlers/EventHandler.d.ts +0 -13
- package/dist/cjs/handlers/EventHandler.js +0 -19
- package/dist/cjs/handlers/Handler.d.ts +0 -57
- package/dist/cjs/handlers/Handler.js +0 -308
- package/dist/cjs/handlers/InhibitorHandler.d.ts +0 -18
- package/dist/cjs/handlers/InhibitorHandler.js +0 -24
- package/dist/cjs/main.d.ts +0 -44
- package/dist/cjs/main.js +0 -112
- package/dist/cjs/models/CommandArguments.d.ts +0 -17
- package/dist/cjs/models/CommandArguments.js +0 -106
- package/dist/cjs/models/Events.d.ts +0 -24
- package/dist/cjs/models/Events.js +0 -307
- package/dist/cjs/models/Extensions.d.ts +0 -7
- package/dist/cjs/models/Extensions.js +0 -26
- package/dist/cjs/tools/XernerxError.d.ts +0 -5
- package/dist/cjs/tools/XernerxError.js +0 -11
- package/dist/cjs/tools/package.d.ts +0 -49
- package/dist/cjs/tools/package.js +0 -50
- package/dist/cjs/types/enums.d.ts +0 -44
- package/dist/cjs/types/enums.js +0 -38
- package/dist/cjs/types/interfaces.d.ts +0 -25
- package/dist/cjs/types/interfaces.js +0 -2
- package/dist/cjs/types/options.d.ts +0 -241
- package/dist/cjs/types/options.js +0 -2
- package/dist/cjs/types/types.d.ts +0 -61
- package/dist/cjs/types/types.js +0 -2
- package/dist/cjs/utils/ClientUtil.d.ts +0 -25
- package/dist/cjs/utils/ClientUtil.js +0 -211
- package/dist/cjs/utils/CommandUtil.d.ts +0 -58
- package/dist/cjs/utils/CommandUtil.js +0 -247
- package/dist/cjs/validators/CommandValidations.d.ts +0 -12
- package/dist/cjs/validators/CommandValidations.js +0 -169
- package/dist/cjs/validators/InhibitorValidations.d.ts +0 -11
- package/dist/cjs/validators/InhibitorValidations.js +0 -40
- package/dist/mjs/build/ContextCommandBuilder.d.ts +0 -68
- package/dist/mjs/build/ContextCommandBuilder.js +0 -88
- package/dist/mjs/build/EventBuilder.d.ts +0 -21
- package/dist/mjs/build/EventBuilder.js +0 -34
- package/dist/mjs/build/InhibitorBuilder.d.ts +0 -19
- package/dist/mjs/build/InhibitorBuilder.js +0 -27
- package/dist/mjs/build/MessageCommandBuilder.d.ts +0 -59
- package/dist/mjs/build/MessageCommandBuilder.js +0 -90
- package/dist/mjs/build/SlashCommandBuilder.d.ts +0 -64
- package/dist/mjs/build/SlashCommandBuilder.js +0 -121
- package/dist/mjs/client/XernerxClient.d.ts +0 -28
- package/dist/mjs/client/XernerxClient.js +0 -108
- package/dist/mjs/handlers/CommandHandler.d.ts +0 -27
- package/dist/mjs/handlers/CommandHandler.js +0 -42
- package/dist/mjs/handlers/EventHandler.d.ts +0 -13
- package/dist/mjs/handlers/EventHandler.js +0 -16
- package/dist/mjs/handlers/Handler.d.ts +0 -57
- package/dist/mjs/handlers/Handler.js +0 -260
- package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -18
- package/dist/mjs/handlers/InhibitorHandler.js +0 -21
- package/dist/mjs/main.d.ts +0 -44
- package/dist/mjs/main.js +0 -52
- package/dist/mjs/models/CommandArguments.d.ts +0 -17
- package/dist/mjs/models/CommandArguments.js +0 -101
- package/dist/mjs/models/Events.d.ts +0 -24
- package/dist/mjs/models/Events.js +0 -295
- package/dist/mjs/models/Extensions.d.ts +0 -7
- package/dist/mjs/models/Extensions.js +0 -23
- package/dist/mjs/tools/XernerxError.d.ts +0 -5
- package/dist/mjs/tools/XernerxError.js +0 -8
- package/dist/mjs/tools/package.d.ts +0 -49
- package/dist/mjs/tools/package.js +0 -48
- package/dist/mjs/types/enums.d.ts +0 -44
- package/dist/mjs/types/enums.js +0 -35
- package/dist/mjs/types/interfaces.d.ts +0 -25
- package/dist/mjs/types/interfaces.js +0 -1
- package/dist/mjs/types/options.d.ts +0 -241
- package/dist/mjs/types/options.js +0 -1
- package/dist/mjs/types/types.d.ts +0 -61
- package/dist/mjs/types/types.js +0 -1
- package/dist/mjs/utils/ClientUtil.d.ts +0 -25
- package/dist/mjs/utils/ClientUtil.js +0 -202
- package/dist/mjs/utils/CommandUtil.d.ts +0 -58
- package/dist/mjs/utils/CommandUtil.js +0 -232
- package/dist/mjs/validators/CommandValidations.d.ts +0 -12
- package/dist/mjs/validators/CommandValidations.js +0 -166
- package/dist/mjs/validators/InhibitorValidations.d.ts +0 -11
- package/dist/mjs/validators/InhibitorValidations.js +0 -36
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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;
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
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;
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
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,64 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
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_js_1 = __importStar(require('discord.js'));
|
|
47
|
-
const zod_1 = require('zod');
|
|
48
|
-
const XernerxError_js_1 = __importDefault(require('../tools/XernerxError.js'));
|
|
49
|
-
const XernerxClient_js_1 = __importDefault(require('../client/XernerxClient.js'));
|
|
50
|
-
/**
|
|
51
|
-
* @description - The command builder for slash commands.
|
|
52
|
-
* @param {String} id - The unique ID of the command.
|
|
53
|
-
* @param {SlashCommandOptions} options - The command options.
|
|
54
|
-
*/
|
|
55
|
-
class SlashCommandBuilder {
|
|
56
|
-
id;
|
|
57
|
-
data;
|
|
58
|
-
name;
|
|
59
|
-
description;
|
|
60
|
-
info;
|
|
61
|
-
category;
|
|
62
|
-
channelType;
|
|
63
|
-
cooldown;
|
|
64
|
-
ignore;
|
|
65
|
-
strict;
|
|
66
|
-
permissions;
|
|
67
|
-
args;
|
|
68
|
-
subcommands;
|
|
69
|
-
groups;
|
|
70
|
-
defer;
|
|
71
|
-
client;
|
|
72
|
-
constructor(id, options) {
|
|
73
|
-
this.id = id;
|
|
74
|
-
this.data = new discord_js_1.default.SlashCommandBuilder().setName(options.name).setDescription(options.description);
|
|
75
|
-
if (options.args && options?.args?.length > 0) {
|
|
76
|
-
this.addArgs(this.data, options.args);
|
|
77
|
-
}
|
|
78
|
-
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
79
|
-
this.addSubcommands(this.data, options.subcommands);
|
|
80
|
-
}
|
|
81
|
-
if (options.groups && options?.groups?.length > 0) {
|
|
82
|
-
this.addSubcommandGroups(options.groups);
|
|
83
|
-
}
|
|
84
|
-
zod_1.z
|
|
85
|
-
.object({
|
|
86
|
-
description: zod_1.z.string(),
|
|
87
|
-
info: zod_1.z.string(),
|
|
88
|
-
category: zod_1.z.string(),
|
|
89
|
-
channelType: zod_1.z.array(zod_1.z.number()).or(zod_1.z.number()),
|
|
90
|
-
cooldown: zod_1.z.number(),
|
|
91
|
-
ignore: zod_1.z.object({
|
|
92
|
-
owner: zod_1.z.boolean(),
|
|
93
|
-
users: zod_1.z.array(zod_1.z.string()),
|
|
94
|
-
channels: zod_1.z.array(zod_1.z.string()),
|
|
95
|
-
guilds: zod_1.z.array(zod_1.z.string()),
|
|
96
|
-
}),
|
|
97
|
-
strict: zod_1.z.object({
|
|
98
|
-
owner: zod_1.z.boolean(),
|
|
99
|
-
users: zod_1.z.array(zod_1.z.string()),
|
|
100
|
-
channels: zod_1.z.array(zod_1.z.string()),
|
|
101
|
-
guilds: zod_1.z.array(zod_1.z.string()),
|
|
102
|
-
}),
|
|
103
|
-
permissions: zod_1.z.object({
|
|
104
|
-
client: zod_1.z.array(zod_1.z.string()),
|
|
105
|
-
users: zod_1.z.array(zod_1.z.string()),
|
|
106
|
-
dm: zod_1.z.boolean(),
|
|
107
|
-
}),
|
|
108
|
-
defer: zod_1.z.object({
|
|
109
|
-
reply: zod_1.z.boolean(),
|
|
110
|
-
ephemeral: zod_1.z.boolean(),
|
|
111
|
-
fetch: zod_1.z.boolean(),
|
|
112
|
-
}),
|
|
113
|
-
})
|
|
114
|
-
.deepPartial()
|
|
115
|
-
.parse(options);
|
|
116
|
-
this.name = options.name;
|
|
117
|
-
this.description = options.description;
|
|
118
|
-
this.info = options.info;
|
|
119
|
-
this.category = options.category;
|
|
120
|
-
this.channelType = options.channelType;
|
|
121
|
-
this.cooldown = options.cooldown;
|
|
122
|
-
this.ignore = options.ignore;
|
|
123
|
-
this.strict = options.strict;
|
|
124
|
-
this.permissions = options.permissions;
|
|
125
|
-
this.defer = options.defer;
|
|
126
|
-
this.client = XernerxClient_js_1.default;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* TODO - update description
|
|
130
|
-
* @param interaction
|
|
131
|
-
*/
|
|
132
|
-
async conditions(interaction) {}
|
|
133
|
-
/**
|
|
134
|
-
* TODO - update description
|
|
135
|
-
* @param interaction
|
|
136
|
-
*/
|
|
137
|
-
async exec(interaction) {}
|
|
138
|
-
addArgs(command, args) {
|
|
139
|
-
const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
|
|
140
|
-
for (const argument of args) {
|
|
141
|
-
if (!types.includes(argument.type.toLowerCase())) throw new XernerxError_js_1.default(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
|
|
142
|
-
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
143
|
-
command[`add${slashArgumentType}Option`]((option) => {
|
|
144
|
-
option
|
|
145
|
-
.setName(argument.name)
|
|
146
|
-
.setDescription(argument.description)
|
|
147
|
-
.setRequired(argument.required || false);
|
|
148
|
-
if (argument.choices) option.setChoices(...argument?.choices);
|
|
149
|
-
return option;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
addSubcommands(method, subcommands) {
|
|
154
|
-
for (const subcommand of subcommands) {
|
|
155
|
-
let sub = new discord_js_1.SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
156
|
-
if (subcommand.args?.length > 0) this.addArgs(sub, subcommand.args);
|
|
157
|
-
method.addSubcommand(sub);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
addSubcommandGroups(groups) {
|
|
161
|
-
for (const group of groups) {
|
|
162
|
-
let subcommandGroup = new discord_js_1.SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
163
|
-
if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
|
|
164
|
-
this.data.addSubcommandGroup(subcommandGroup);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
exports.default = SlashCommandBuilder;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Client, Collection } from 'discord.js';
|
|
2
|
-
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
3
|
-
import { ClientUtil } from '../utils/ClientUtil.js';
|
|
4
|
-
import { ClientOptions, DiscordOptions, ExtensionOptions, HandlerOptions } from '../types/options.js';
|
|
5
|
-
import { ClientCache, ClientCommands, ClientModules } from '../types/interfaces.js';
|
|
6
|
-
import EventBuilder from '../build/EventBuilder.js';
|
|
7
|
-
import InhibitorBuilder from '../build/InhibitorBuilder.js';
|
|
8
|
-
/**
|
|
9
|
-
* @description - The Client.
|
|
10
|
-
* @param {DiscordOptions} discordOptions - The options for discord.js.
|
|
11
|
-
* @param {ClientOptions} clientOptions - The options for the Xernerx Client.
|
|
12
|
-
* @extends {Client}
|
|
13
|
-
*/
|
|
14
|
-
export default class XernerxClient extends Client {
|
|
15
|
-
settings: ClientOptions;
|
|
16
|
-
commands: ClientCommands;
|
|
17
|
-
cache: ClientCache;
|
|
18
|
-
modules: ClientModules;
|
|
19
|
-
util: ClientUtil;
|
|
20
|
-
handlerOptions: HandlerOptions;
|
|
21
|
-
events: Collection<string, EventBuilder>;
|
|
22
|
-
extensions: Record<string, ExtensionBuilder>;
|
|
23
|
-
inhibitors: Collection<string, InhibitorBuilder>;
|
|
24
|
-
config: object;
|
|
25
|
-
constructor(discordOptions: DiscordOptions, clientOptions: ClientOptions, config?: object);
|
|
26
|
-
register(token: string): void;
|
|
27
|
-
loadAllExtensions(options: ExtensionOptions): Promise<void>;
|
|
28
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
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 dumfunctions_1 = require('dumfunctions');
|
|
11
|
-
const ClientUtil_js_1 = require('../utils/ClientUtil.js');
|
|
12
|
-
const CommandHandler_js_1 = __importDefault(require('../handlers/CommandHandler.js'));
|
|
13
|
-
const EventHandler_js_1 = __importDefault(require('../handlers/EventHandler.js'));
|
|
14
|
-
const InhibitorHandler_js_1 = __importDefault(require('../handlers/InhibitorHandler.js'));
|
|
15
|
-
const Extensions_js_1 = __importDefault(require('../models/Extensions.js'));
|
|
16
|
-
// TODO - Add commandNotFound as an event to the client.
|
|
17
|
-
/**
|
|
18
|
-
* @description - The Client.
|
|
19
|
-
* @param {DiscordOptions} discordOptions - The options for discord.js.
|
|
20
|
-
* @param {ClientOptions} clientOptions - The options for the Xernerx Client.
|
|
21
|
-
* @extends {Client}
|
|
22
|
-
*/
|
|
23
|
-
class XernerxClient extends discord_js_1.Client {
|
|
24
|
-
settings;
|
|
25
|
-
commands;
|
|
26
|
-
cache;
|
|
27
|
-
modules;
|
|
28
|
-
util;
|
|
29
|
-
handlerOptions;
|
|
30
|
-
events;
|
|
31
|
-
extensions;
|
|
32
|
-
inhibitors;
|
|
33
|
-
config;
|
|
34
|
-
constructor(discordOptions, clientOptions, config) {
|
|
35
|
-
super(discordOptions);
|
|
36
|
-
this.settings = zod_1.z
|
|
37
|
-
.object({
|
|
38
|
-
ownerId: zod_1.z.string().or(zod_1.z.array(zod_1.z.string())).default([]),
|
|
39
|
-
permissions: zod_1.z
|
|
40
|
-
.object({
|
|
41
|
-
client: zod_1.z.array(zod_1.z.string()).default([]),
|
|
42
|
-
user: zod_1.z.array(zod_1.z.string()).default([]),
|
|
43
|
-
dm: zod_1.z.boolean().default(false),
|
|
44
|
-
})
|
|
45
|
-
.optional(),
|
|
46
|
-
ignore: zod_1.z
|
|
47
|
-
.object({
|
|
48
|
-
owner: zod_1.z.boolean().default(false),
|
|
49
|
-
users: zod_1.z.array(zod_1.z.string()),
|
|
50
|
-
channels: zod_1.z.array(zod_1.z.string()),
|
|
51
|
-
guilds: zod_1.z.array(zod_1.z.string()),
|
|
52
|
-
})
|
|
53
|
-
.optional(),
|
|
54
|
-
log: zod_1.z
|
|
55
|
-
.object({
|
|
56
|
-
ready: zod_1.z.boolean().default(false),
|
|
57
|
-
error: zod_1.z.boolean().default(false),
|
|
58
|
-
})
|
|
59
|
-
.optional(),
|
|
60
|
-
cooldown: zod_1.z
|
|
61
|
-
.object({
|
|
62
|
-
command: zod_1.z.number().default(0),
|
|
63
|
-
cache: zod_1.z.number().default(0),
|
|
64
|
-
})
|
|
65
|
-
.optional(),
|
|
66
|
-
})
|
|
67
|
-
.parse(clientOptions);
|
|
68
|
-
this.config = config || {};
|
|
69
|
-
this.commands = {
|
|
70
|
-
message: new discord_js_1.Collection(),
|
|
71
|
-
slash: new discord_js_1.Collection(),
|
|
72
|
-
context: new discord_js_1.Collection(),
|
|
73
|
-
};
|
|
74
|
-
this.events = new discord_js_1.Collection();
|
|
75
|
-
this.inhibitors = new discord_js_1.Collection();
|
|
76
|
-
this.cache = {
|
|
77
|
-
messages: new discord_js_1.Collection(),
|
|
78
|
-
cooldowns: new discord_js_1.Collection(),
|
|
79
|
-
messageCommands: new discord_js_1.Collection(),
|
|
80
|
-
slashCommands: new discord_js_1.Collection(),
|
|
81
|
-
contextCommands: new discord_js_1.Collection(),
|
|
82
|
-
commands: new discord_js_1.Collection(),
|
|
83
|
-
};
|
|
84
|
-
this.modules = {
|
|
85
|
-
commandHandler: new CommandHandler_js_1.default(this),
|
|
86
|
-
eventHandler: new EventHandler_js_1.default(this),
|
|
87
|
-
inhibitorHandler: new InhibitorHandler_js_1.default(this),
|
|
88
|
-
};
|
|
89
|
-
this.extensions = {};
|
|
90
|
-
this.util = new ClientUtil_js_1.ClientUtil(this);
|
|
91
|
-
this.handlerOptions = {};
|
|
92
|
-
if (this.settings?.log?.ready) {
|
|
93
|
-
this.once('ready', async (client) => {
|
|
94
|
-
const size = (await client.guilds.fetch()).size;
|
|
95
|
-
console.info(
|
|
96
|
-
dumfunctions_1.Style.log(
|
|
97
|
-
`Xernerx | ${client.user.tag} signed in watching ${size} server${size > 1 ? 's' : ''}. ${
|
|
98
|
-
(this.handlerOptions.slash || this.handlerOptions.context)?.guildId
|
|
99
|
-
? `Using ${(await this.guilds.fetch((this.handlerOptions.slash || this.handlerOptions.context)?.guildId || '0')).name} as local guild.`
|
|
100
|
-
: ''
|
|
101
|
-
}`,
|
|
102
|
-
{ color: dumfunctions_1.Style.TextColor.Purple }
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
register(token) {
|
|
109
|
-
this.login(token);
|
|
110
|
-
}
|
|
111
|
-
loadAllExtensions(options) {
|
|
112
|
-
const extensions = new Extensions_js_1.default(this);
|
|
113
|
-
return extensions.load(options.extensions, options.logging || false);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.default = XernerxClient;
|