xernerx 3.4.2 → 3.5.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/README.md +10 -10
- package/dist/build/ContextCommandBuilder.js +93 -88
- package/dist/build/EventBuilder.js +34 -35
- package/dist/build/InhibitorBuilder.js +27 -28
- package/dist/build/MessageCommandBuilder.js +90 -80
- package/dist/build/SlashCommandBuilder.js +125 -118
- package/dist/client/XernerxClient.js +101 -81
- package/dist/handlers/CommandHandler.js +42 -42
- package/dist/handlers/EventHandler.js +16 -16
- package/dist/handlers/Handler.js +250 -250
- package/dist/handlers/InhibitorHandler.js +21 -21
- package/dist/main.cjs +2012 -0
- package/dist/main.js +42 -42
- package/dist/models/CommandArguments.js +121 -123
- package/dist/models/Events.js +294 -304
- package/dist/models/Extensions.js +23 -23
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/package.js +37 -41
- package/dist/types/enums.js +35 -35
- package/dist/types/interfaces.js +1 -1
- package/dist/types/options.js +1 -1
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.js +222 -218
- package/dist/utils/CommandUtil.js +248 -260
- package/dist/validators/CommandValidations.js +183 -185
- package/dist/validators/InhibitorValidations.js +42 -42
- package/dist/validators/Shapes.js +1 -0
- package/package.json +54 -39
- package/types/build/ContextCommandBuilder.d.ts +68 -0
- package/{dist → types}/build/EventBuilder.d.ts +21 -17
- package/{dist → types}/build/InhibitorBuilder.d.ts +19 -20
- package/types/build/MessageCommandBuilder.d.ts +59 -0
- package/types/build/SlashCommandBuilder.d.ts +64 -0
- package/{dist → types}/client/XernerxClient.d.ts +28 -28
- package/{dist → types}/handlers/CommandHandler.d.ts +27 -26
- package/{dist → types}/handlers/EventHandler.d.ts +13 -12
- package/{dist → types}/handlers/Handler.d.ts +57 -57
- package/{dist → types}/handlers/InhibitorHandler.d.ts +18 -17
- package/{dist → types}/main.d.ts +44 -30
- package/{dist → types}/models/CommandArguments.d.ts +17 -17
- package/{dist → types}/models/Events.d.ts +24 -24
- package/{dist → types}/models/Extensions.d.ts +7 -7
- package/{dist → types}/tools/XernerxError.d.ts +5 -5
- package/{dist → types}/tools/package.d.ts +38 -38
- package/types/types/enums.d.ts +44 -0
- package/{dist → types}/types/interfaces.d.ts +25 -25
- package/{dist → types}/types/options.d.ts +241 -206
- package/{dist → types}/types/types.d.ts +61 -32
- package/{dist → types}/utils/ClientUtil.d.ts +25 -25
- package/{dist → types}/utils/CommandUtil.d.ts +58 -56
- package/{dist → types}/validators/CommandValidations.d.ts +12 -7
- package/{dist → types}/validators/InhibitorValidations.d.ts +11 -11
- package/types/validators/Shapes.d.ts +1 -0
- package/dist/build/ContextCommandBuilder.d.ts +0 -42
- package/dist/build/MessageCommandBuilder.d.ts +0 -42
- package/dist/build/SlashCommandBuilder.d.ts +0 -40
- package/dist/build/XContextCommandBuilder.d.ts +0 -40
- package/dist/build/XContextCommandBuilder.js +0 -84
- package/dist/build/XEventBuilder.d.ts +0 -17
- package/dist/build/XEventBuilder.js +0 -35
- package/dist/build/XInhibitorBuilder.d.ts +0 -20
- package/dist/build/XInhibitorBuilder.js +0 -28
- package/dist/build/XMessageCommandBuilder.d.ts +0 -42
- package/dist/build/XMessageCommandBuilder.js +0 -80
- package/dist/build/XSlashCommandBuilder.d.ts +0 -36
- package/dist/build/XSlashCommandBuilder.js +0 -114
- package/dist/models/CommandValidations.d.ts +0 -4
- package/dist/models/CommandValidations.js +0 -183
- package/dist/models/InhibitorValidations.d.ts +0 -12
- package/dist/models/InhibitorValidations.js +0 -42
- package/dist/types/enums.d.ts +0 -35
|
@@ -1,118 +1,125 @@
|
|
|
1
|
-
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder
|
|
2
|
-
import {
|
|
3
|
-
import XernerxError from '../tools/XernerxError.js';
|
|
4
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
5
|
-
/**
|
|
6
|
-
* @description - The command builder for slash commands.
|
|
7
|
-
* @param {String} id - The unique ID of the command.
|
|
8
|
-
* @param {SlashCommandOptions} options - The command options.
|
|
9
|
-
*/
|
|
10
|
-
export default class SlashCommandBuilder {
|
|
11
|
-
id;
|
|
12
|
-
data;
|
|
13
|
-
name;
|
|
14
|
-
description;
|
|
15
|
-
info;
|
|
16
|
-
category;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
this.
|
|
76
|
-
this.
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
1
|
+
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from 'discord.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import XernerxError from '../tools/XernerxError.js';
|
|
4
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
5
|
+
/**
|
|
6
|
+
* @description - The command builder for slash commands.
|
|
7
|
+
* @param {String} id - The unique ID of the command.
|
|
8
|
+
* @param {SlashCommandOptions} options - The command options.
|
|
9
|
+
*/
|
|
10
|
+
export default class SlashCommandBuilder {
|
|
11
|
+
id;
|
|
12
|
+
data;
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
15
|
+
info;
|
|
16
|
+
category;
|
|
17
|
+
channelType;
|
|
18
|
+
cooldown;
|
|
19
|
+
ignore;
|
|
20
|
+
strict;
|
|
21
|
+
permissions;
|
|
22
|
+
args;
|
|
23
|
+
subcommands;
|
|
24
|
+
groups;
|
|
25
|
+
defer;
|
|
26
|
+
client;
|
|
27
|
+
constructor(id, options) {
|
|
28
|
+
this.id = id;
|
|
29
|
+
this.data = new Discord.SlashCommandBuilder().setName(options.name).setDescription(options.description);
|
|
30
|
+
if (options.args && options?.args?.length > 0) {
|
|
31
|
+
this.addArgs(this.data, options.args);
|
|
32
|
+
}
|
|
33
|
+
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
34
|
+
this.addSubcommands(this.data, options.subcommands);
|
|
35
|
+
}
|
|
36
|
+
if (options.groups && options?.groups?.length > 0) {
|
|
37
|
+
this.addSubcommandGroups(options.groups);
|
|
38
|
+
}
|
|
39
|
+
z.object({
|
|
40
|
+
description: z.string(),
|
|
41
|
+
info: z.string(),
|
|
42
|
+
category: z.string(),
|
|
43
|
+
channelType: z.array(z.number()).or(z.number()),
|
|
44
|
+
cooldown: z.number(),
|
|
45
|
+
ignore: z.object({
|
|
46
|
+
owner: z.boolean(),
|
|
47
|
+
users: z.array(z.string()),
|
|
48
|
+
channels: z.array(z.string()),
|
|
49
|
+
guilds: z.array(z.string()),
|
|
50
|
+
}),
|
|
51
|
+
strict: z.object({
|
|
52
|
+
owner: z.boolean(),
|
|
53
|
+
users: z.array(z.string()),
|
|
54
|
+
channels: z.array(z.string()),
|
|
55
|
+
guilds: z.array(z.string()),
|
|
56
|
+
}),
|
|
57
|
+
permissions: z.object({
|
|
58
|
+
client: z.array(z.string()),
|
|
59
|
+
users: z.array(z.string()),
|
|
60
|
+
dm: z.boolean(),
|
|
61
|
+
}),
|
|
62
|
+
defer: z.object({
|
|
63
|
+
reply: z.boolean(),
|
|
64
|
+
ephemeral: z.boolean(),
|
|
65
|
+
fetch: z.boolean(),
|
|
66
|
+
}),
|
|
67
|
+
})
|
|
68
|
+
.deepPartial()
|
|
69
|
+
.parse(options);
|
|
70
|
+
this.name = options.name;
|
|
71
|
+
this.description = options.description;
|
|
72
|
+
this.info = options.info;
|
|
73
|
+
this.category = options.category;
|
|
74
|
+
this.channelType = options.channelType;
|
|
75
|
+
this.cooldown = options.cooldown;
|
|
76
|
+
this.ignore = options.ignore;
|
|
77
|
+
this.strict = options.strict;
|
|
78
|
+
this.permissions = options.permissions;
|
|
79
|
+
this.defer = options.defer;
|
|
80
|
+
this.client = XernerxClient;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* TODO - update description
|
|
84
|
+
* @param interaction
|
|
85
|
+
*/
|
|
86
|
+
async conditions(interaction) { }
|
|
87
|
+
/**
|
|
88
|
+
* TODO - update description
|
|
89
|
+
* @param interaction
|
|
90
|
+
*/
|
|
91
|
+
async exec(interaction) { }
|
|
92
|
+
addArgs(command, args) {
|
|
93
|
+
const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
|
|
94
|
+
for (const argument of args) {
|
|
95
|
+
if (!types.includes(argument.type.toLowerCase()))
|
|
96
|
+
throw new XernerxError(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
|
|
97
|
+
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
98
|
+
command[`add${slashArgumentType}Option`]((option) => {
|
|
99
|
+
option
|
|
100
|
+
.setName(argument.name)
|
|
101
|
+
.setDescription(argument.description)
|
|
102
|
+
.setRequired(argument.required || false);
|
|
103
|
+
if (argument.choices)
|
|
104
|
+
option.setChoices(...argument?.choices);
|
|
105
|
+
return option;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
addSubcommands(method, subcommands) {
|
|
110
|
+
for (const subcommand of subcommands) {
|
|
111
|
+
let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
112
|
+
if (subcommand.args?.length > 0)
|
|
113
|
+
this.addArgs(sub, subcommand.args);
|
|
114
|
+
method.addSubcommand(sub);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
addSubcommandGroups(groups) {
|
|
118
|
+
for (const group of groups) {
|
|
119
|
+
let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
120
|
+
if (group.subcommands?.length > 0)
|
|
121
|
+
this.addSubcommands(subcommandGroup, group.subcommands);
|
|
122
|
+
this.data.addSubcommandGroup(subcommandGroup);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -1,81 +1,101 @@
|
|
|
1
|
-
import { Client, Collection } from 'discord.js';
|
|
2
|
-
import {
|
|
3
|
-
import { Style } from 'dumfunctions';
|
|
4
|
-
import { ClientUtil } from '../utils/ClientUtil.js';
|
|
5
|
-
import CommandHandler from '../handlers/CommandHandler.js';
|
|
6
|
-
import EventHandler from '../handlers/EventHandler.js';
|
|
7
|
-
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
8
|
-
import Extensions from '../models/Extensions.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @
|
|
12
|
-
* @param {
|
|
13
|
-
* @
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
1
|
+
import { Client, Collection } from 'discord.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Style } from 'dumfunctions';
|
|
4
|
+
import { ClientUtil } from '../utils/ClientUtil.js';
|
|
5
|
+
import CommandHandler from '../handlers/CommandHandler.js';
|
|
6
|
+
import EventHandler from '../handlers/EventHandler.js';
|
|
7
|
+
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
8
|
+
import Extensions from '../models/Extensions.js';
|
|
9
|
+
// TODO - Add commandNotFound as an event to the client.
|
|
10
|
+
/**
|
|
11
|
+
* @description - The Client.
|
|
12
|
+
* @param {DiscordOptions} discordOptions - The options for discord.js.
|
|
13
|
+
* @param {ClientOptions} clientOptions - The options for the Xernerx Client.
|
|
14
|
+
* @extends {Client}
|
|
15
|
+
*/
|
|
16
|
+
export default class XernerxClient extends Client {
|
|
17
|
+
settings;
|
|
18
|
+
commands;
|
|
19
|
+
cache;
|
|
20
|
+
modules;
|
|
21
|
+
util;
|
|
22
|
+
handlerOptions;
|
|
23
|
+
events;
|
|
24
|
+
extensions;
|
|
25
|
+
inhibitors;
|
|
26
|
+
config;
|
|
27
|
+
constructor(discordOptions, clientOptions, config) {
|
|
28
|
+
super(discordOptions);
|
|
29
|
+
this.settings = z
|
|
30
|
+
.object({
|
|
31
|
+
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
32
|
+
permissions: z
|
|
33
|
+
.object({
|
|
34
|
+
client: z.array(z.string()).default([]),
|
|
35
|
+
user: z.array(z.string()).default([]),
|
|
36
|
+
dm: z.boolean().default(false),
|
|
37
|
+
})
|
|
38
|
+
.optional(),
|
|
39
|
+
ignore: z
|
|
40
|
+
.object({
|
|
41
|
+
owner: z.boolean().default(false),
|
|
42
|
+
users: z.array(z.string()),
|
|
43
|
+
channels: z.array(z.string()),
|
|
44
|
+
guilds: z.array(z.string()),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
47
|
+
log: z
|
|
48
|
+
.object({
|
|
49
|
+
ready: z.boolean().default(false),
|
|
50
|
+
error: z.boolean().default(false),
|
|
51
|
+
})
|
|
52
|
+
.optional(),
|
|
53
|
+
cooldown: z
|
|
54
|
+
.object({
|
|
55
|
+
command: z.number().default(0),
|
|
56
|
+
cache: z.number().default(0),
|
|
57
|
+
})
|
|
58
|
+
.optional(),
|
|
59
|
+
})
|
|
60
|
+
.parse(clientOptions);
|
|
61
|
+
this.config = config || {};
|
|
62
|
+
this.commands = {
|
|
63
|
+
message: new Collection(),
|
|
64
|
+
slash: new Collection(),
|
|
65
|
+
context: new Collection(),
|
|
66
|
+
};
|
|
67
|
+
this.events = new Collection();
|
|
68
|
+
this.inhibitors = new Collection();
|
|
69
|
+
this.cache = {
|
|
70
|
+
messages: new Collection(),
|
|
71
|
+
cooldowns: new Collection(),
|
|
72
|
+
messageCommands: new Collection(),
|
|
73
|
+
slashCommands: new Collection(),
|
|
74
|
+
contextCommands: new Collection(),
|
|
75
|
+
commands: new Collection(),
|
|
76
|
+
};
|
|
77
|
+
this.modules = {
|
|
78
|
+
commandHandler: new CommandHandler(this),
|
|
79
|
+
eventHandler: new EventHandler(this),
|
|
80
|
+
inhibitorHandler: new InhibitorHandler(this),
|
|
81
|
+
};
|
|
82
|
+
this.extensions = {};
|
|
83
|
+
this.util = new ClientUtil(this);
|
|
84
|
+
this.handlerOptions = {};
|
|
85
|
+
if (this.settings?.log?.ready) {
|
|
86
|
+
this.once('ready', async (client) => {
|
|
87
|
+
const size = (await client.guilds.fetch()).size;
|
|
88
|
+
console.info(Style.log(`Xernerx | ${client.user.tag} signed in watching ${size} server${size > 1 ? 's' : ''}. ${(this.handlerOptions.slash || this.handlerOptions.context)?.guildId
|
|
89
|
+
? `Using ${(await this.guilds.fetch((this.handlerOptions.slash || this.handlerOptions.context)?.guildId || '0')).name} as local guild.`
|
|
90
|
+
: ''}`, { color: Style.TextColor.Purple }));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
register(token) {
|
|
95
|
+
this.login(token);
|
|
96
|
+
}
|
|
97
|
+
loadAllExtensions(options) {
|
|
98
|
+
const extensions = new Extensions(this);
|
|
99
|
+
return extensions.load(options.extensions, options.logging || false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Handler } from './Handler.js';
|
|
2
|
-
import { CommandsDeploy, ContextCommandEvents, MessageCommandEvents, SlashCommandEvents } from '../models/Events.js';
|
|
3
|
-
/**
|
|
4
|
-
* @description - The command handler.
|
|
5
|
-
* @param {XernerxClient} client - The XernerxClient.
|
|
6
|
-
*/
|
|
7
|
-
export default class CommandHandler {
|
|
8
|
-
client;
|
|
9
|
-
handler;
|
|
10
|
-
constructor(client) {
|
|
11
|
-
this.client = client;
|
|
12
|
-
this.handler = new Handler(client);
|
|
13
|
-
new CommandsDeploy(this.client).deploy();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @description - The message command loader.
|
|
17
|
-
* @param {MessageCommandOptions} options - message command loader options.
|
|
18
|
-
*/
|
|
19
|
-
loadAllMessageCommands(options) {
|
|
20
|
-
this.handler.loadAllMessageCommands(options);
|
|
21
|
-
const events = new MessageCommandEvents(this.client);
|
|
22
|
-
events.messageCreate();
|
|
23
|
-
events.messageUpdate();
|
|
24
|
-
events.messageDelete();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @description - The slash command loader.
|
|
28
|
-
* @param {SlashCommandOptions} options - slash command loader options.
|
|
29
|
-
*/
|
|
30
|
-
loadAllSlashCommands(options) {
|
|
31
|
-
this.handler.loadAllSlashCommands(options);
|
|
32
|
-
new SlashCommandEvents(this.client).slashCreate();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @description - The context command loader.
|
|
36
|
-
* @param {ContextCommandOptions} options - context command loader options.
|
|
37
|
-
*/
|
|
38
|
-
loadAllContextCommands(options) {
|
|
39
|
-
this.handler.loadAllContextCommands(options);
|
|
40
|
-
new ContextCommandEvents(this.client).contextCreate();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
import { Handler } from './Handler.js';
|
|
2
|
+
import { CommandsDeploy, ContextCommandEvents, MessageCommandEvents, SlashCommandEvents } from '../models/Events.js';
|
|
3
|
+
/**
|
|
4
|
+
* @description - The command handler.
|
|
5
|
+
* @param {XernerxClient} client - The XernerxClient.
|
|
6
|
+
*/
|
|
7
|
+
export default class CommandHandler {
|
|
8
|
+
client;
|
|
9
|
+
handler;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
this.handler = new Handler(client);
|
|
13
|
+
new CommandsDeploy(this.client).deploy();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @description - The message command loader.
|
|
17
|
+
* @param {MessageCommandOptions} options - message command loader options.
|
|
18
|
+
*/
|
|
19
|
+
loadAllMessageCommands(options) {
|
|
20
|
+
this.handler.loadAllMessageCommands(options);
|
|
21
|
+
const events = new MessageCommandEvents(this.client);
|
|
22
|
+
events.messageCreate();
|
|
23
|
+
events.messageUpdate();
|
|
24
|
+
events.messageDelete();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description - The slash command loader.
|
|
28
|
+
* @param {SlashCommandOptions} options - slash command loader options.
|
|
29
|
+
*/
|
|
30
|
+
loadAllSlashCommands(options) {
|
|
31
|
+
this.handler.loadAllSlashCommands(options);
|
|
32
|
+
new SlashCommandEvents(this.client).slashCreate();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @description - The context command loader.
|
|
36
|
+
* @param {ContextCommandOptions} options - context command loader options.
|
|
37
|
+
*/
|
|
38
|
+
loadAllContextCommands(options) {
|
|
39
|
+
this.handler.loadAllContextCommands(options);
|
|
40
|
+
new ContextCommandEvents(this.client).contextCreate();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Handler } from './Handler.js';
|
|
2
|
-
export default class EventHandler {
|
|
3
|
-
client;
|
|
4
|
-
handler;
|
|
5
|
-
constructor(client) {
|
|
6
|
-
this.client = client;
|
|
7
|
-
this.handler = new Handler(client);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description - The event loader
|
|
11
|
-
* @param {EventLoadOptions} options - message command options
|
|
12
|
-
*/
|
|
13
|
-
loadAllEvents(options) {
|
|
14
|
-
return this.handler.loadAllEvents(options);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { Handler } from './Handler.js';
|
|
2
|
+
export default class EventHandler {
|
|
3
|
+
client;
|
|
4
|
+
handler;
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.handler = new Handler(client);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @description - The event loader
|
|
11
|
+
* @param {EventLoadOptions} options - message command options
|
|
12
|
+
*/
|
|
13
|
+
loadAllEvents(options) {
|
|
14
|
+
return this.handler.loadAllEvents(options);
|
|
15
|
+
}
|
|
16
|
+
}
|