xernerx 3.5.1 → 3.5.2
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 +36 -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/cjs/client/XernerxClient.js +116 -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/{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 +307 -0
- package/dist/cjs/models/Extensions.js +26 -0
- package/dist/{tools → cjs/tools}/XernerxError.js +4 -1
- package/dist/{tools → cjs/tools}/package.js +8 -6
- package/dist/cjs/types/enums.d.ts +44 -0
- package/dist/cjs/types/enums.js +38 -0
- package/dist/cjs/types/interfaces.js +2 -0
- package/dist/cjs/types/options.js +2 -0
- package/dist/{types → cjs/types}/types.d.ts +36 -9
- package/dist/cjs/types/types.js +2 -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 +68 -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 +28 -0
- package/dist/mjs/client/XernerxClient.js +116 -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/{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 +307 -0
- package/dist/mjs/models/Extensions.d.ts +7 -0
- package/dist/mjs/models/Extensions.js +26 -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 +49 -0
- package/dist/mjs/tools/package.js +50 -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 +25 -0
- package/dist/mjs/types/interfaces.js +2 -0
- package/dist/mjs/types/options.d.ts +241 -0
- package/dist/mjs/types/options.js +2 -0
- package/dist/mjs/types/types.d.ts +61 -0
- package/dist/mjs/types/types.js +2 -0
- package/dist/mjs/utils/ClientUtil.d.ts +25 -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 +10 -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/{client → cjs/client}/XernerxClient.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/{tools → cjs/tools}/package.d.ts +0 -0
- /package/dist/{types → cjs/types}/interfaces.d.ts +0 -0
- /package/dist/{types → cjs/types}/options.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/ClientUtil.d.ts +0 -0
- /package/dist/{validators → cjs/validators}/InhibitorValidations.d.ts +0 -0
|
@@ -1,43 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
const discord_js_1 = require('discord.js');
|
|
4
|
+
const enums_js_1 = require('../types/enums.js');
|
|
3
5
|
function getUser(from) {
|
|
4
|
-
if (from instanceof Message)
|
|
5
|
-
|
|
6
|
-
else
|
|
7
|
-
return from.user;
|
|
6
|
+
if (from instanceof discord_js_1.Message) return from.author;
|
|
7
|
+
else return from.user;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
function commandValidation(action, command, client, res = false) {
|
|
10
10
|
let user = getUser(action);
|
|
11
|
-
if ((command.ignoreOwner || client.settings.ignore?.owner) && client.util.isOwner(user.id))
|
|
12
|
-
|
|
13
|
-
else if (inCooldown(user, client, command, action))
|
|
14
|
-
return true;
|
|
11
|
+
if ((command.ignoreOwner || client.settings.ignore?.owner) && client.util.isOwner(user.id)) return res;
|
|
12
|
+
else if (inCooldown(user, client, command, action)) return true;
|
|
15
13
|
else if (command.owner && !client.util.isOwner(user.id)) {
|
|
16
14
|
res = true;
|
|
17
15
|
emit(client, action, command, 'Not an owner', client.settings.ownerId);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (!Array.isArray(command.channelType))
|
|
21
|
-
command.channelType = [command.channelType];
|
|
16
|
+
} else if (command.channelType?.length > 0 || command.channelType) {
|
|
17
|
+
if (!Array.isArray(command.channelType)) command.channelType = [command.channelType];
|
|
22
18
|
if (!command?.channelType?.includes(action.channel?.type)) {
|
|
23
19
|
res = true;
|
|
24
20
|
emit(client, action, command, 'Not the correct channel', command.channelType);
|
|
25
21
|
}
|
|
26
|
-
}
|
|
27
|
-
else if (command.channels?.length > 0 && !command.channels.includes(action.channel?.id)) {
|
|
22
|
+
} else if (command.channels?.length > 0 && !command.channels.includes(action.channel?.id)) {
|
|
28
23
|
res = true;
|
|
29
24
|
emit(client, action, command, 'Not a whitelisted channel', command.channels);
|
|
30
|
-
}
|
|
31
|
-
else if (command.guilds?.length > 0 && !command.guilds.includes(action.guild?.id)) {
|
|
25
|
+
} else if (command.guilds?.length > 0 && !command.guilds.includes(action.guild?.id)) {
|
|
32
26
|
res = true;
|
|
33
27
|
emit(client, action, command, 'Not a whitelisted guild', command.guilds);
|
|
34
|
-
}
|
|
35
|
-
else if (command.channelType && command.channelType !== action.channel?.type) {
|
|
28
|
+
} else if (command.channelType && command.channelType !== action.channel?.type) {
|
|
36
29
|
res = true;
|
|
37
30
|
emit(client, action, command, 'Not the correct type of channel', command.channelType);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
} else if (action?.guild && (command.permissions?.user || client.settings.permissions?.user)) {
|
|
32
|
+
const permissions = command.permissions?.user || client?.settings?.permissions?.user?.push(...handlerPermissions(client, command.commandType, 'user')),
|
|
33
|
+
missing = [];
|
|
41
34
|
if (Array.isArray(permissions))
|
|
42
35
|
permissions.map((permission) => {
|
|
43
36
|
if (!(action.member?.permissions).has(permission)) {
|
|
@@ -48,9 +41,9 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
48
41
|
res = true;
|
|
49
42
|
emit(client, action, command, 'Missing User Permissions', missing);
|
|
50
43
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
} else if (action?.guild && (command.permissions?.client || client.settings.permissions?.client)) {
|
|
45
|
+
const permissions = command.permissions?.client || client?.settings?.permissions?.client?.push(...handlerPermissions(client, command.commandType, 'client')),
|
|
46
|
+
missing = [];
|
|
54
47
|
if (Array.isArray(permissions))
|
|
55
48
|
permissions.map((permission) => {
|
|
56
49
|
if (!(action.member?.permissions).has(permission)) {
|
|
@@ -64,13 +57,15 @@ export default function commandValidation(action, command, client, res = false)
|
|
|
64
57
|
}
|
|
65
58
|
return res;
|
|
66
59
|
}
|
|
60
|
+
exports.default = commandValidation;
|
|
67
61
|
function emit(client, action, command, reason, extra) {
|
|
68
62
|
return client.emit('commandBlock', action, command, reason, extra);
|
|
69
63
|
}
|
|
70
64
|
function inCooldown(user, client, command, action) {
|
|
71
|
-
let res = false,
|
|
65
|
+
let res = false,
|
|
66
|
+
downs = {};
|
|
72
67
|
const { cooldowns, messageCommands, slashCommands, contextCommands, commands } = client.cache;
|
|
73
|
-
if (command.commandType === CommandType.MessageCommand && client.handlerOptions.message.cooldown) {
|
|
68
|
+
if (command.commandType === enums_js_1.CommandType.MessageCommand && client.handlerOptions.message.cooldown) {
|
|
74
69
|
if (messageCommands.has(user.id)) {
|
|
75
70
|
const usr = messageCommands.get(user.id);
|
|
76
71
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -84,7 +79,7 @@ function inCooldown(user, client, command, action) {
|
|
|
84
79
|
}, client.handlerOptions.message.cooldown);
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
|
-
if (command.commandType === CommandType.SlashCommand && client.handlerOptions.slash.cooldown) {
|
|
82
|
+
if (command.commandType === enums_js_1.CommandType.SlashCommand && client.handlerOptions.slash.cooldown) {
|
|
88
83
|
if (slashCommands.has(user.id)) {
|
|
89
84
|
const usr = slashCommands.get(user.id);
|
|
90
85
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -98,7 +93,7 @@ function inCooldown(user, client, command, action) {
|
|
|
98
93
|
}, client.handlerOptions.slash.cooldown);
|
|
99
94
|
}
|
|
100
95
|
}
|
|
101
|
-
if (command.commandType === CommandType.ContextCommand && client.handlerOptions.context.cooldown) {
|
|
96
|
+
if (command.commandType === enums_js_1.CommandType.ContextCommand && client.handlerOptions.context.cooldown) {
|
|
102
97
|
if (contextCommands.has(user.id)) {
|
|
103
98
|
const usr = contextCommands.get(user.id);
|
|
104
99
|
usr.timeRemaining = usr.endsAt - Date.now();
|
|
@@ -141,8 +136,7 @@ function inCooldown(user, client, command, action) {
|
|
|
141
136
|
}, command.cooldown);
|
|
142
137
|
}
|
|
143
138
|
}
|
|
144
|
-
if (Object.keys(downs).length > 0)
|
|
145
|
-
client.emit('commandCooldown', action, command, downs);
|
|
139
|
+
if (Object.keys(downs).length > 0) client.emit('commandCooldown', action, command, downs);
|
|
146
140
|
return res;
|
|
147
141
|
}
|
|
148
142
|
function toCooldown(action, command, cooldown, name) {
|
|
@@ -161,23 +155,15 @@ function toCooldown(action, command, cooldown, name) {
|
|
|
161
155
|
}
|
|
162
156
|
function handlerPermissions(client, commandType, type) {
|
|
163
157
|
let permissions = [];
|
|
164
|
-
if (commandType === CommandType.MessageCommand) {
|
|
165
|
-
if (type === 'user')
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
else if (commandType === CommandType.
|
|
171
|
-
if (type === 'user')
|
|
172
|
-
|
|
173
|
-
else if (type === 'client')
|
|
174
|
-
permissions = client.handlerOptions.slash?.clientPermissions || [];
|
|
175
|
-
}
|
|
176
|
-
else if (commandType === CommandType.ContextCommand) {
|
|
177
|
-
if (type === 'user')
|
|
178
|
-
permissions = client.handlerOptions.context?.userPermissions || [];
|
|
179
|
-
else if (type === 'client')
|
|
180
|
-
permissions = client.handlerOptions.context?.clientPermissions || [];
|
|
158
|
+
if (commandType === enums_js_1.CommandType.MessageCommand) {
|
|
159
|
+
if (type === 'user') permissions = client.handlerOptions.message?.userPermissions || [];
|
|
160
|
+
else if (type === 'client') permissions = client.handlerOptions.message?.clientPermissions || [];
|
|
161
|
+
} else if (commandType === enums_js_1.CommandType.SlashCommand) {
|
|
162
|
+
if (type === 'user') permissions = client.handlerOptions.slash?.userPermissions || [];
|
|
163
|
+
else if (type === 'client') permissions = client.handlerOptions.slash?.clientPermissions || [];
|
|
164
|
+
} else if (commandType === enums_js_1.CommandType.ContextCommand) {
|
|
165
|
+
if (type === 'user') permissions = client.handlerOptions.context?.userPermissions || [];
|
|
166
|
+
else if (type === 'client') permissions = client.handlerOptions.context?.clientPermissions || [];
|
|
181
167
|
}
|
|
182
168
|
return permissions;
|
|
183
169
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.InhibitorValidation = void 0;
|
|
4
|
+
const enums_js_1 = require('../types/enums.js');
|
|
5
|
+
class InhibitorValidation {
|
|
3
6
|
client;
|
|
4
7
|
action;
|
|
5
8
|
command;
|
|
@@ -13,23 +16,17 @@ export class InhibitorValidation {
|
|
|
13
16
|
async inhibit() {
|
|
14
17
|
for (const inhibitor of this.client.inhibitors) {
|
|
15
18
|
const inhibit = inhibitor[1];
|
|
16
|
-
if (inhibit)
|
|
17
|
-
this.inhibited[inhibit.name] = await inhibit.check(this.action, this.args(this.action, inhibit.type));
|
|
19
|
+
if (inhibit) this.inhibited[inhibit.name] = await inhibit.check(this.action, this.args(this.action, inhibit.type));
|
|
18
20
|
}
|
|
19
21
|
for (const inhibit of Object.values(this.inhibited)) {
|
|
20
|
-
if (inhibit)
|
|
21
|
-
return this.inhibited;
|
|
22
|
+
if (inhibit) return this.inhibited;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
args(action, type) {
|
|
25
|
-
if (type === InhibitorType.Channel)
|
|
26
|
-
|
|
27
|
-
if (type === InhibitorType.
|
|
28
|
-
|
|
29
|
-
if (type === InhibitorType.Guild)
|
|
30
|
-
return action.guild;
|
|
31
|
-
if (type === InhibitorType.Member)
|
|
32
|
-
return action.member;
|
|
26
|
+
if (type === enums_js_1.InhibitorType.Channel) return action.channel;
|
|
27
|
+
if (type === enums_js_1.InhibitorType.User) return action.author || action.user;
|
|
28
|
+
if (type === enums_js_1.InhibitorType.Guild) return action.guild;
|
|
29
|
+
if (type === enums_js_1.InhibitorType.Member) return action.member;
|
|
33
30
|
// if (type === InhibitorType.Command)
|
|
34
31
|
// return this.client.util.getAllCommands().filter(this.command.name);
|
|
35
32
|
// if (type === InhibitorType.MessageCommand)
|
|
@@ -40,3 +37,4 @@ export class InhibitorValidation {
|
|
|
40
37
|
// return this.client.util.getAllContextCommands().find(this.command.name);
|
|
41
38
|
}
|
|
42
39
|
}
|
|
40
|
+
exports.InhibitorValidation = InhibitorValidation;
|
|
@@ -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;
|