xernerx 4.15.0 → 4.15.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/{cjs/utils → utils}/InteractionUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/InteractionUtil.js +4 -3
- package/dist/{cjs/utils → utils}/MessageUtil.d.ts +1 -1
- package/dist/{mjs/utils → utils}/MessageUtil.js +4 -3
- package/package.json +3 -4
- package/dist/cjs/build/XernerxContextCommand.js +0 -124
- package/dist/cjs/build/XernerxEvent.js +0 -34
- package/dist/cjs/build/XernerxInhibitor.js +0 -30
- package/dist/cjs/build/XernerxMessageCommand.js +0 -122
- package/dist/cjs/build/XernerxSlashCommand.js +0 -180
- package/dist/cjs/client/XernerxClient.js +0 -105
- package/dist/cjs/client/XernerxShardClient.js +0 -56
- package/dist/cjs/functions/deploy.js +0 -66
- package/dist/cjs/functions/load.js +0 -38
- package/dist/cjs/functions/reload.js +0 -33
- package/dist/cjs/functions/setPresence.js +0 -24
- package/dist/cjs/functions/xernerxUser.js +0 -15
- package/dist/cjs/handlers/CommandHandler.js +0 -342
- package/dist/cjs/handlers/EventHandler.js +0 -32
- package/dist/cjs/handlers/ExtensionHandler.js +0 -32
- package/dist/cjs/handlers/Handler.js +0 -48
- package/dist/cjs/handlers/InhibitorHandler.js +0 -34
- package/dist/cjs/handlers/IntegrationHandler.js +0 -29
- package/dist/cjs/main.js +0 -36
- package/dist/cjs/models/Arguments.js +0 -159
- package/dist/cjs/models/Cooldowns.js +0 -36
- package/dist/cjs/tools/XernerxError.js +0 -14
- package/dist/cjs/tools/XernerxIntents.js +0 -27
- package/dist/cjs/tools/XernerxLog.js +0 -98
- package/dist/cjs/tools/XernerxText.js +0 -92
- package/dist/cjs/types/extenders.js +0 -3
- package/dist/cjs/types/interfaces.js +0 -3
- package/dist/cjs/types/types.js +0 -3
- package/dist/cjs/utils/ClientUtil.js +0 -84
- package/dist/cjs/utils/InteractionUtil.js +0 -156
- package/dist/cjs/utils/MessageUtil.js +0 -170
- package/dist/cjs/utils/Util.js +0 -14
- package/dist/cjs/validators/commandValidation.js +0 -127
- package/dist/cjs/validators/inhibitorValidations.js +0 -49
- package/dist/mjs/build/XernerxContextCommand.d.ts +0 -53
- package/dist/mjs/build/XernerxEvent.d.ts +0 -25
- package/dist/mjs/build/XernerxInhibitor.d.ts +0 -29
- package/dist/mjs/build/XernerxMessageCommand.d.ts +0 -57
- package/dist/mjs/build/XernerxSlashCommand.d.ts +0 -69
- package/dist/mjs/client/XernerxClient.d.ts +0 -53
- package/dist/mjs/client/XernerxShardClient.d.ts +0 -21
- package/dist/mjs/functions/deploy.d.ts +0 -3
- package/dist/mjs/functions/load.d.ts +0 -4
- package/dist/mjs/functions/reload.d.ts +0 -3
- package/dist/mjs/functions/setPresence.d.ts +0 -4
- package/dist/mjs/functions/xernerxUser.d.ts +0 -4
- package/dist/mjs/handlers/CommandHandler.d.ts +0 -16
- package/dist/mjs/handlers/EventHandler.d.ts +0 -9
- package/dist/mjs/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/mjs/handlers/Handler.d.ts +0 -14
- package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/mjs/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/mjs/main.d.ts +0 -40
- package/dist/mjs/models/Arguments.d.ts +0 -9
- package/dist/mjs/models/Cooldowns.d.ts +0 -11
- package/dist/mjs/tools/XernerxError.d.ts +0 -7
- package/dist/mjs/tools/XernerxIntents.d.ts +0 -5
- package/dist/mjs/tools/XernerxLog.d.ts +0 -28
- package/dist/mjs/tools/XernerxText.d.ts +0 -30
- package/dist/mjs/types/extenders.d.ts +0 -61
- package/dist/mjs/types/interfaces.d.ts +0 -256
- package/dist/mjs/types/types.d.ts +0 -14
- package/dist/mjs/utils/ClientUtil.d.ts +0 -19
- package/dist/mjs/utils/InteractionUtil.d.ts +0 -25
- package/dist/mjs/utils/MessageUtil.d.ts +0 -26
- package/dist/mjs/utils/Util.d.ts +0 -9
- package/dist/mjs/validators/commandValidation.d.ts +0 -7
- package/dist/mjs/validators/inhibitorValidations.d.ts +0 -9
- /package/dist/{cjs/build → build}/XernerxContextCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxContextCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxEvent.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxEvent.js +0 -0
- /package/dist/{cjs/build → build}/XernerxInhibitor.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxInhibitor.js +0 -0
- /package/dist/{cjs/build → build}/XernerxMessageCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxMessageCommand.js +0 -0
- /package/dist/{cjs/build → build}/XernerxSlashCommand.d.ts +0 -0
- /package/dist/{mjs/build → build}/XernerxSlashCommand.js +0 -0
- /package/dist/{cjs/client → client}/XernerxClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxClient.js +0 -0
- /package/dist/{cjs/client → client}/XernerxShardClient.d.ts +0 -0
- /package/dist/{mjs/client → client}/XernerxShardClient.js +0 -0
- /package/dist/{cjs/functions → functions}/deploy.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/deploy.js +0 -0
- /package/dist/{cjs/functions → functions}/load.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/load.js +0 -0
- /package/dist/{cjs/functions → functions}/reload.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/reload.js +0 -0
- /package/dist/{cjs/functions → functions}/setPresence.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/setPresence.js +0 -0
- /package/dist/{cjs/functions → functions}/xernerxUser.d.ts +0 -0
- /package/dist/{mjs/functions → functions}/xernerxUser.js +0 -0
- /package/dist/{cjs/handlers → handlers}/CommandHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/CommandHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/EventHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/EventHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/ExtensionHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/ExtensionHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/Handler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/Handler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/InhibitorHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/InhibitorHandler.js +0 -0
- /package/dist/{cjs/handlers → handlers}/IntegrationHandler.d.ts +0 -0
- /package/dist/{mjs/handlers → handlers}/IntegrationHandler.js +0 -0
- /package/dist/{cjs/main.d.ts → main.d.ts} +0 -0
- /package/dist/{mjs/main.js → main.js} +0 -0
- /package/dist/{cjs/models → models}/Arguments.d.ts +0 -0
- /package/dist/{mjs/models → models}/Arguments.js +0 -0
- /package/dist/{cjs/models → models}/Cooldowns.d.ts +0 -0
- /package/dist/{mjs/models → models}/Cooldowns.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxError.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxError.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxIntents.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxIntents.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxLog.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxLog.js +0 -0
- /package/dist/{cjs/tools → tools}/XernerxText.d.ts +0 -0
- /package/dist/{mjs/tools → tools}/XernerxText.js +0 -0
- /package/dist/{cjs/types → types}/extenders.d.ts +0 -0
- /package/dist/{mjs/types → types}/extenders.js +0 -0
- /package/dist/{cjs/types → types}/interfaces.d.ts +0 -0
- /package/dist/{mjs/types → types}/interfaces.js +0 -0
- /package/dist/{cjs/types → types}/types.d.ts +0 -0
- /package/dist/{mjs/types → types}/types.js +0 -0
- /package/dist/{cjs/utils → utils}/ClientUtil.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/ClientUtil.js +0 -0
- /package/dist/{cjs/utils → utils}/Util.d.ts +0 -0
- /package/dist/{mjs/utils → utils}/Util.js +0 -0
- /package/dist/{cjs/validators → validators}/commandValidation.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/commandValidation.js +0 -0
- /package/dist/{cjs/validators → validators}/inhibitorValidations.d.ts +0 -0
- /package/dist/{mjs/validators → validators}/inhibitorValidations.js +0 -0
|
@@ -20,6 +20,6 @@ export default class InteractionUtil extends Util {
|
|
|
20
20
|
mimic(user: XernerxUser | string, interaction: MessageCreateOptions, options: MimicOptions): Promise<void>;
|
|
21
21
|
paginator(embeds: Array<EmbedBuilder>, options?: PaginatorOptions): Promise<void | import("discord.js").Message<false> | import("discord.js").Message<true>>;
|
|
22
22
|
commands(): import("@discordjs/collection").Collection<string, import("../main.js").XernerxSlashCommand> | import("@discordjs/collection").Collection<string, import("../main.js").XernerxContextCommand>;
|
|
23
|
-
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames
|
|
23
|
+
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames>, emit?: boolean): boolean | string[];
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -125,7 +125,7 @@ export default class InteractionUtil extends Util {
|
|
|
125
125
|
else
|
|
126
126
|
return this.client.commands.context;
|
|
127
127
|
}
|
|
128
|
-
permissionCheck(type, permissions) {
|
|
128
|
+
permissionCheck(type, permissions, emit = true) {
|
|
129
129
|
console.log(type);
|
|
130
130
|
const missing = [];
|
|
131
131
|
for (const permission of permissions) {
|
|
@@ -137,8 +137,7 @@ export default class InteractionUtil extends Util {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
const command = this.commands().toJSON().find((cmd) => cmd.name == this.parsed.alias?.split(/ +/)[0]);
|
|
140
|
-
|
|
141
|
-
if (missing.length) {
|
|
140
|
+
if (missing.length && emit) {
|
|
142
141
|
this.client.emit(`commandBlock`, this.interaction, {
|
|
143
142
|
reason: `missing${Style.pascalCase(type)}Permissions`,
|
|
144
143
|
message: `${type == 'user' ? 'You are' : 'I am'} missing the following permissions to run \`${command?.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
@@ -147,6 +146,8 @@ export default class InteractionUtil extends Util {
|
|
|
147
146
|
}, command || null);
|
|
148
147
|
return false;
|
|
149
148
|
}
|
|
149
|
+
else if (missing.length && !emit)
|
|
150
|
+
return missing;
|
|
150
151
|
else
|
|
151
152
|
return true;
|
|
152
153
|
}
|
|
@@ -21,6 +21,6 @@ export default class MessageUtil extends Util {
|
|
|
21
21
|
mimic(user: XernerxUser | string, message: MessageCreateOptions, options: MimicOptions): Promise<void>;
|
|
22
22
|
paginator(embeds: Array<EmbedBuilder>, options?: PaginatorOptions): Promise<void | import("discord.js").Message<boolean> | null>;
|
|
23
23
|
commands(): import("@discordjs/collection").Collection<string, import("../main.js").XernerxMessageCommand>;
|
|
24
|
-
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames
|
|
24
|
+
permissionCheck(type: 'user' | 'client', permissions: Array<PermissionNames>, emit?: boolean): boolean | string[];
|
|
25
25
|
}
|
|
26
26
|
export {};
|
|
@@ -139,7 +139,7 @@ export default class MessageUtil extends Util {
|
|
|
139
139
|
commands() {
|
|
140
140
|
return this.client.commands.message;
|
|
141
141
|
}
|
|
142
|
-
permissionCheck(type, permissions) {
|
|
142
|
+
permissionCheck(type, permissions, emit = true) {
|
|
143
143
|
console.log(type);
|
|
144
144
|
const missing = [];
|
|
145
145
|
for (const permission of permissions) {
|
|
@@ -151,8 +151,7 @@ export default class MessageUtil extends Util {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
const command = this.commands().find((cmd) => cmd.name == this.parsed.alias || cmd.aliases?.includes(this.parsed.alias));
|
|
154
|
-
|
|
155
|
-
if (missing.length) {
|
|
154
|
+
if (missing.length && emit) {
|
|
156
155
|
this.client.emit(`commandBlock`, this.message, {
|
|
157
156
|
reason: `missing${Style.pascalCase(type)}Permissions`,
|
|
158
157
|
message: `${type == 'user' ? 'You are' : 'I am'} missing the following permissions to run \`${command?.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
@@ -161,6 +160,8 @@ export default class MessageUtil extends Util {
|
|
|
161
160
|
}, command || null);
|
|
162
161
|
return false;
|
|
163
162
|
}
|
|
163
|
+
else if (missing.length && !emit)
|
|
164
|
+
return missing;
|
|
164
165
|
else
|
|
165
166
|
return true;
|
|
166
167
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.2",
|
|
4
4
|
"description": "A bot framework for discord.js.",
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"module": "dist/mjs/main.js",
|
|
5
|
+
"main": "dist/main.js",
|
|
7
6
|
"type": "module",
|
|
8
7
|
"keywords": [
|
|
9
8
|
"discord.js",
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
"site": "git add docs && npm run commit && git push",
|
|
32
31
|
"write": "npm i && npm run build && npm run format",
|
|
33
32
|
"format": "npx prettier --write src dist",
|
|
34
|
-
"build": "npm run build:esm && npm run
|
|
33
|
+
"build": "npm run build:esm && npm run format",
|
|
35
34
|
"build:esm": "tsc",
|
|
36
35
|
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
|
|
37
36
|
},
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = require("discord.js");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
7
|
-
class XernerxContextCommand {
|
|
8
|
-
constructor(id, options) {
|
|
9
|
-
this.id = id;
|
|
10
|
-
this.data = new discord_js_1.ContextMenuCommandBuilder();
|
|
11
|
-
this.data.setName(options.name);
|
|
12
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
13
|
-
this.data.setType(options.type === 'user' ? 2 : 3);
|
|
14
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
15
|
-
options = zod_1.z
|
|
16
|
-
.object({
|
|
17
|
-
name: zod_1.z.string(),
|
|
18
|
-
type: zod_1.z.enum(['user', 'message']),
|
|
19
|
-
description: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
20
|
-
usage: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
21
|
-
info: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
22
|
-
category: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
23
|
-
cooldown: zod_1.z.number().or(zod_1.z.null()).default(null),
|
|
24
|
-
global: zod_1.z.boolean().default(true),
|
|
25
|
-
channel: zod_1.z
|
|
26
|
-
.array(zod_1.z.enum([
|
|
27
|
-
'GuildText',
|
|
28
|
-
'DM',
|
|
29
|
-
'GuildVoice',
|
|
30
|
-
'GroupDM',
|
|
31
|
-
'GuildCategory',
|
|
32
|
-
'GuildAnnouncement',
|
|
33
|
-
'AnnouncementThread',
|
|
34
|
-
'PublicThread',
|
|
35
|
-
'PrivateThread',
|
|
36
|
-
'GuildStageVoice',
|
|
37
|
-
'GuildDirectory',
|
|
38
|
-
'GuildForum',
|
|
39
|
-
'GuildNews',
|
|
40
|
-
'GuildNewsThread',
|
|
41
|
-
'GuildPublicThread',
|
|
42
|
-
'GuildPrivateThread',
|
|
43
|
-
]))
|
|
44
|
-
.or(zod_1.z.enum([
|
|
45
|
-
'GuildText',
|
|
46
|
-
'DM',
|
|
47
|
-
'GuildVoice',
|
|
48
|
-
'GroupDM',
|
|
49
|
-
'GuildCategory',
|
|
50
|
-
'GuildAnnouncement',
|
|
51
|
-
'AnnouncementThread',
|
|
52
|
-
'PublicThread',
|
|
53
|
-
'PrivateThread',
|
|
54
|
-
'GuildStageVoice',
|
|
55
|
-
'GuildDirectory',
|
|
56
|
-
'GuildForum',
|
|
57
|
-
'GuildNews',
|
|
58
|
-
'GuildNewsThread',
|
|
59
|
-
'GuildPublicThread',
|
|
60
|
-
'GuildPrivateThread',
|
|
61
|
-
]))
|
|
62
|
-
.or(zod_1.z.null())
|
|
63
|
-
.default(null),
|
|
64
|
-
ignore: zod_1.z
|
|
65
|
-
.object({
|
|
66
|
-
owner: zod_1.z.boolean().default(false),
|
|
67
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
68
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
69
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
70
|
-
voice: zod_1.z.boolean().default(false),
|
|
71
|
-
})
|
|
72
|
-
.default({}),
|
|
73
|
-
strict: zod_1.z
|
|
74
|
-
.object({
|
|
75
|
-
owner: zod_1.z.boolean().default(false),
|
|
76
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
77
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
78
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
79
|
-
voice: zod_1.z.boolean().default(false),
|
|
80
|
-
})
|
|
81
|
-
.default({}),
|
|
82
|
-
permissions: zod_1.z
|
|
83
|
-
.object({
|
|
84
|
-
user: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
85
|
-
client: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
86
|
-
dm: zod_1.z.boolean().default(true),
|
|
87
|
-
})
|
|
88
|
-
.default({}),
|
|
89
|
-
defer: zod_1.z
|
|
90
|
-
.object({
|
|
91
|
-
reply: zod_1.z.boolean().optional(),
|
|
92
|
-
ephemeral: zod_1.z.boolean().optional(),
|
|
93
|
-
fetch: zod_1.z.boolean().optional(),
|
|
94
|
-
})
|
|
95
|
-
.default({}),
|
|
96
|
-
})
|
|
97
|
-
.parse(options);
|
|
98
|
-
this.name = options.name;
|
|
99
|
-
this.type = options.type;
|
|
100
|
-
this.description = options.description;
|
|
101
|
-
this.usage = options.usage;
|
|
102
|
-
this.info = options.info;
|
|
103
|
-
this.category = options.category;
|
|
104
|
-
this.cooldown = options.cooldown;
|
|
105
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
106
|
-
this.global = options.global;
|
|
107
|
-
this.ignore = options.ignore;
|
|
108
|
-
this.strict = options.strict;
|
|
109
|
-
this.permissions = options.permissions;
|
|
110
|
-
this.defer = options.defer;
|
|
111
|
-
this.client = this.client;
|
|
112
|
-
this.util = this.util;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* @description the execution of the command
|
|
116
|
-
* @param interaction - Interaction event emitted on command
|
|
117
|
-
* @param args - The arguments parsed with the command, if any
|
|
118
|
-
*/
|
|
119
|
-
async exec(interaction, args) {
|
|
120
|
-
new XernerxLog_js_1.default(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
121
|
-
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.default = XernerxContextCommand;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
6
|
-
/**
|
|
7
|
-
* @description - The event builder for events.
|
|
8
|
-
* @param {String} id - The unique ID of the event.
|
|
9
|
-
* @param {EventOptions} options - The event options.
|
|
10
|
-
*/
|
|
11
|
-
class XernerxEvent {
|
|
12
|
-
constructor(id, options) {
|
|
13
|
-
this.id = id;
|
|
14
|
-
zod_1.z.object({
|
|
15
|
-
name: zod_1.z.string(),
|
|
16
|
-
emitter: zod_1.z.string().optional(),
|
|
17
|
-
type: zod_1.z.string().optional(),
|
|
18
|
-
once: zod_1.z.boolean().optional(),
|
|
19
|
-
}).parse(options);
|
|
20
|
-
this.name = options.name;
|
|
21
|
-
this.emitter = options.emitter || 'client';
|
|
22
|
-
this.type = options.type || 'discord';
|
|
23
|
-
this.once = options.once || false;
|
|
24
|
-
this.client = this.client;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @description run your custom event here.
|
|
28
|
-
* @param any - there can be all kinds of parameters on events.
|
|
29
|
-
*/
|
|
30
|
-
async run(...args) {
|
|
31
|
-
return new XernerxLog_js_1.default(this.client).error(`${this.id} doesn't have a run rule.`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = XernerxEvent;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
/**
|
|
6
|
-
* @description - The inhibitor builder for inhibitors.
|
|
7
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
8
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
9
|
-
*/
|
|
10
|
-
class XernerxInhibitor {
|
|
11
|
-
constructor(id, options) {
|
|
12
|
-
this.id = id;
|
|
13
|
-
zod_1.z.object({
|
|
14
|
-
name: zod_1.z.string(),
|
|
15
|
-
type: zod_1.z.string(),
|
|
16
|
-
}).parse(options);
|
|
17
|
-
this.name = options.name;
|
|
18
|
-
this.type = options.type;
|
|
19
|
-
this.client = this.client;
|
|
20
|
-
}
|
|
21
|
-
pre(interaction, args) { }
|
|
22
|
-
/**
|
|
23
|
-
* @description The check rule
|
|
24
|
-
* @param interaction - The interaction with the inhibitor, can be message and interaction
|
|
25
|
-
* @param args - The arguments parsed with this command
|
|
26
|
-
*/
|
|
27
|
-
async check(interaction, args, command) { }
|
|
28
|
-
async post(interaction, args, command) { }
|
|
29
|
-
}
|
|
30
|
-
exports.default = XernerxInhibitor;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
6
|
-
class XernerxMessageCommand {
|
|
7
|
-
constructor(id, options) {
|
|
8
|
-
this.id = id;
|
|
9
|
-
this.regex = options.regex;
|
|
10
|
-
this.args = options.args;
|
|
11
|
-
this.flags = options.flags;
|
|
12
|
-
options = zod_1.z
|
|
13
|
-
.object({
|
|
14
|
-
name: zod_1.z.string(),
|
|
15
|
-
aliases: zod_1.z.array(zod_1.z.string()).default([]),
|
|
16
|
-
description: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
17
|
-
usage: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
18
|
-
info: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
19
|
-
category: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
20
|
-
cooldown: zod_1.z.number().or(zod_1.z.null()).default(null),
|
|
21
|
-
global: zod_1.z.boolean().default(true),
|
|
22
|
-
channel: zod_1.z
|
|
23
|
-
.array(zod_1.z.enum([
|
|
24
|
-
'GuildText',
|
|
25
|
-
'DM',
|
|
26
|
-
'GuildVoice',
|
|
27
|
-
'GroupDM',
|
|
28
|
-
'GuildCategory',
|
|
29
|
-
'GuildAnnouncement',
|
|
30
|
-
'AnnouncementThread',
|
|
31
|
-
'PublicThread',
|
|
32
|
-
'PrivateThread',
|
|
33
|
-
'GuildStageVoice',
|
|
34
|
-
'GuildDirectory',
|
|
35
|
-
'GuildForum',
|
|
36
|
-
'GuildNews',
|
|
37
|
-
'GuildNewsThread',
|
|
38
|
-
'GuildPublicThread',
|
|
39
|
-
'GuildPrivateThread',
|
|
40
|
-
]))
|
|
41
|
-
.or(zod_1.z.enum([
|
|
42
|
-
'GuildText',
|
|
43
|
-
'DM',
|
|
44
|
-
'GuildVoice',
|
|
45
|
-
'GroupDM',
|
|
46
|
-
'GuildCategory',
|
|
47
|
-
'GuildAnnouncement',
|
|
48
|
-
'AnnouncementThread',
|
|
49
|
-
'PublicThread',
|
|
50
|
-
'PrivateThread',
|
|
51
|
-
'GuildStageVoice',
|
|
52
|
-
'GuildDirectory',
|
|
53
|
-
'GuildForum',
|
|
54
|
-
'GuildNews',
|
|
55
|
-
'GuildNewsThread',
|
|
56
|
-
'GuildPublicThread',
|
|
57
|
-
'GuildPrivateThread',
|
|
58
|
-
]))
|
|
59
|
-
.or(zod_1.z.null())
|
|
60
|
-
.default(null),
|
|
61
|
-
prefix: zod_1.z.array(zod_1.z.string()).or(zod_1.z.string()).default([]),
|
|
62
|
-
ignore: zod_1.z
|
|
63
|
-
.object({
|
|
64
|
-
owner: zod_1.z.boolean().default(false),
|
|
65
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
66
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
67
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
68
|
-
voice: zod_1.z.boolean().default(false),
|
|
69
|
-
})
|
|
70
|
-
.default({}),
|
|
71
|
-
strict: zod_1.z
|
|
72
|
-
.object({
|
|
73
|
-
owner: zod_1.z.boolean().default(false),
|
|
74
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
75
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
76
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
77
|
-
voice: zod_1.z.boolean().default(false),
|
|
78
|
-
})
|
|
79
|
-
.default({}),
|
|
80
|
-
permissions: zod_1.z
|
|
81
|
-
.object({
|
|
82
|
-
user: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
83
|
-
client: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
84
|
-
dm: zod_1.z.boolean().default(true),
|
|
85
|
-
})
|
|
86
|
-
.default({}),
|
|
87
|
-
})
|
|
88
|
-
.parse(options);
|
|
89
|
-
this.name = options.name;
|
|
90
|
-
this.aliases = options.aliases;
|
|
91
|
-
this.prefix = options.prefix;
|
|
92
|
-
this.description = options.description;
|
|
93
|
-
this.usage = options.usage;
|
|
94
|
-
this.info = options.info;
|
|
95
|
-
this.category = options.category;
|
|
96
|
-
this.cooldown = options.cooldown;
|
|
97
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
98
|
-
this.global = options.global;
|
|
99
|
-
this.ignore = options.ignore;
|
|
100
|
-
this.strict = options.strict;
|
|
101
|
-
this.separator = options.separator;
|
|
102
|
-
this.permissions = options.permissions;
|
|
103
|
-
this.client = this.client;
|
|
104
|
-
this.util = this.util;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* @description Checks for conditions before running the command
|
|
108
|
-
* @param message - The message event emitted on this command
|
|
109
|
-
* @param options - The args and flags parsed on this command
|
|
110
|
-
*/
|
|
111
|
-
async conditions(message, { args, flags }) { }
|
|
112
|
-
/**
|
|
113
|
-
* @description Runs the execution rule
|
|
114
|
-
* @param message - The message event emitted on this command
|
|
115
|
-
* @param options - The args and flags parsed on this command
|
|
116
|
-
*/
|
|
117
|
-
async exec(message, { args, flags }) {
|
|
118
|
-
new XernerxLog_js_1.default(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
119
|
-
return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this, this.filetype);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.default = XernerxMessageCommand;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const discord_js_1 = __importStar(require("discord.js"));
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const XernerxLog_js_1 = __importDefault(require("../tools/XernerxLog.js"));
|
|
7
|
-
class XernerxSlashCommand {
|
|
8
|
-
constructor(id, options) {
|
|
9
|
-
this.id = id;
|
|
10
|
-
this.data = new discord_js_1.default.SlashCommandBuilder();
|
|
11
|
-
this.data.setName(options.name);
|
|
12
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
13
|
-
this.data.setDescription(options.description);
|
|
14
|
-
this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
|
|
15
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
16
|
-
if (options.args && options?.args?.length > 0) {
|
|
17
|
-
this.addArguments(this.data, options.args);
|
|
18
|
-
}
|
|
19
|
-
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
20
|
-
this.addSubcommands(this.data, options.subcommands);
|
|
21
|
-
}
|
|
22
|
-
if (options.groups && options?.groups?.length > 0) {
|
|
23
|
-
this.addSubcommandGroups(options.groups);
|
|
24
|
-
}
|
|
25
|
-
options = zod_1.z
|
|
26
|
-
.object({
|
|
27
|
-
name: zod_1.z.string(),
|
|
28
|
-
description: zod_1.z.string(),
|
|
29
|
-
usage: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
30
|
-
info: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
31
|
-
category: zod_1.z.string().or(zod_1.z.null()).default(null),
|
|
32
|
-
number: zod_1.z.number().or(zod_1.z.null()).default(null),
|
|
33
|
-
global: zod_1.z.boolean().default(true),
|
|
34
|
-
channel: zod_1.z
|
|
35
|
-
.array(zod_1.z.enum([
|
|
36
|
-
'GuildText',
|
|
37
|
-
'DM',
|
|
38
|
-
'GuildVoice',
|
|
39
|
-
'GroupDM',
|
|
40
|
-
'GuildCategory',
|
|
41
|
-
'GuildAnnouncement',
|
|
42
|
-
'AnnouncementThread',
|
|
43
|
-
'PublicThread',
|
|
44
|
-
'PrivateThread',
|
|
45
|
-
'GuildStageVoice',
|
|
46
|
-
'GuildDirectory',
|
|
47
|
-
'GuildForum',
|
|
48
|
-
'GuildNews',
|
|
49
|
-
'GuildNewsThread',
|
|
50
|
-
'GuildPublicThread',
|
|
51
|
-
'GuildPrivateThread',
|
|
52
|
-
]))
|
|
53
|
-
.or(zod_1.z.enum([
|
|
54
|
-
'GuildText',
|
|
55
|
-
'DM',
|
|
56
|
-
'GuildVoice',
|
|
57
|
-
'GroupDM',
|
|
58
|
-
'GuildCategory',
|
|
59
|
-
'GuildAnnouncement',
|
|
60
|
-
'AnnouncementThread',
|
|
61
|
-
'PublicThread',
|
|
62
|
-
'PrivateThread',
|
|
63
|
-
'GuildStageVoice',
|
|
64
|
-
'GuildDirectory',
|
|
65
|
-
'GuildForum',
|
|
66
|
-
'GuildNews',
|
|
67
|
-
'GuildNewsThread',
|
|
68
|
-
'GuildPublicThread',
|
|
69
|
-
'GuildPrivateThread',
|
|
70
|
-
]))
|
|
71
|
-
.or(zod_1.z.null())
|
|
72
|
-
.default(null),
|
|
73
|
-
ignore: zod_1.z
|
|
74
|
-
.object({
|
|
75
|
-
owner: zod_1.z.boolean().default(false),
|
|
76
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
77
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
78
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
79
|
-
voice: zod_1.z.boolean().default(false),
|
|
80
|
-
})
|
|
81
|
-
.default({}),
|
|
82
|
-
strict: zod_1.z
|
|
83
|
-
.object({
|
|
84
|
-
owner: zod_1.z.boolean().default(false),
|
|
85
|
-
users: zod_1.z.array(zod_1.z.string()).default([]),
|
|
86
|
-
channels: zod_1.z.array(zod_1.z.string()).default([]),
|
|
87
|
-
guilds: zod_1.z.array(zod_1.z.string()).default([]),
|
|
88
|
-
voice: zod_1.z.boolean().default(false),
|
|
89
|
-
})
|
|
90
|
-
.default({}),
|
|
91
|
-
permissions: zod_1.z
|
|
92
|
-
.object({
|
|
93
|
-
user: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
94
|
-
client: zod_1.z.array(zod_1.z.string()).or(zod_1.z.null()).default(null),
|
|
95
|
-
dm: zod_1.z.boolean().default(true),
|
|
96
|
-
})
|
|
97
|
-
.default({}),
|
|
98
|
-
defer: zod_1.z
|
|
99
|
-
.object({
|
|
100
|
-
reply: zod_1.z.boolean().optional(),
|
|
101
|
-
ephemeral: zod_1.z.boolean().optional(),
|
|
102
|
-
fetch: zod_1.z.boolean().optional(),
|
|
103
|
-
})
|
|
104
|
-
.default({}),
|
|
105
|
-
})
|
|
106
|
-
.parse(options);
|
|
107
|
-
this.name = options.name;
|
|
108
|
-
this.description = options.description;
|
|
109
|
-
this.usage = options.usage;
|
|
110
|
-
this.info = options.info;
|
|
111
|
-
this.category = options.category;
|
|
112
|
-
this.cooldown = options.cooldown;
|
|
113
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
114
|
-
this.global = options.global;
|
|
115
|
-
this.ignore = options.ignore;
|
|
116
|
-
this.strict = options.strict;
|
|
117
|
-
this.permissions = options.permissions;
|
|
118
|
-
this.defer = options.defer;
|
|
119
|
-
this.client = this.client;
|
|
120
|
-
this.util = this.util;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @description autocomplete let's you add choices to string option arguments
|
|
124
|
-
* @param interaction - The interaction event emitted on this command
|
|
125
|
-
* @param focused - The command option that is in focus
|
|
126
|
-
* @param options - The full list of options on the command
|
|
127
|
-
*/
|
|
128
|
-
async autocomplete(interaction, focused, options) { }
|
|
129
|
-
/**
|
|
130
|
-
* @description Checks for conditions before running the command
|
|
131
|
-
* @param interaction - The interaction event emitted on this command
|
|
132
|
-
* @param options - The args, group and subcommand parsed on this command
|
|
133
|
-
*/
|
|
134
|
-
async conditions(interaction, { args, subcommand, group }) { }
|
|
135
|
-
/**
|
|
136
|
-
* @description Runs the execution rule
|
|
137
|
-
* @param interaction - The interaction event emitted on this command
|
|
138
|
-
* @param options - The args, group and subcommand parsed on this command
|
|
139
|
-
*/
|
|
140
|
-
async exec(interaction, { args, subcommand, group }) {
|
|
141
|
-
new XernerxLog_js_1.default(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
142
|
-
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
|
|
143
|
-
}
|
|
144
|
-
addArguments(command, args) {
|
|
145
|
-
for (const argument of args) {
|
|
146
|
-
let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
147
|
-
command[`add${slashCommandArgumentType}Option`]((option) => {
|
|
148
|
-
option
|
|
149
|
-
.setName(argument.name)
|
|
150
|
-
.setDescription(argument.description)
|
|
151
|
-
.setRequired(argument.required || false);
|
|
152
|
-
if (slashCommandArgumentType === 'String') {
|
|
153
|
-
if (argument.choices)
|
|
154
|
-
option.setChoices(...argument.choices.map((choices) => {
|
|
155
|
-
return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
|
|
156
|
-
}));
|
|
157
|
-
option.setAutocomplete(argument.autocomplete || false);
|
|
158
|
-
}
|
|
159
|
-
return option;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
addSubcommands(method, subcommands) {
|
|
164
|
-
for (const subcommand of subcommands) {
|
|
165
|
-
let sub = new discord_js_1.SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
166
|
-
if (subcommand.args && subcommand?.args?.length > 0)
|
|
167
|
-
this.addArguments(sub, subcommand.args);
|
|
168
|
-
method.addSubcommand(sub);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
addSubcommandGroups(groups) {
|
|
172
|
-
for (const group of groups) {
|
|
173
|
-
let subcommandGroup = new discord_js_1.SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
174
|
-
if (group.subcommands?.length > 0)
|
|
175
|
-
this.addSubcommands(subcommandGroup, group.subcommands);
|
|
176
|
-
this.data.addSubcommandGroup(subcommandGroup);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
exports.default = XernerxSlashCommand;
|