xernerx 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/build/ContextCommandBuilder.d.ts +68 -0
  3. package/dist/cjs/build/ContextCommandBuilder.js +97 -0
  4. package/dist/cjs/build/EventBuilder.d.ts +21 -0
  5. package/dist/cjs/build/EventBuilder.js +44 -0
  6. package/dist/cjs/build/InhibitorBuilder.d.ts +19 -0
  7. package/dist/cjs/build/InhibitorBuilder.js +37 -0
  8. package/dist/cjs/build/MessageCommandBuilder.d.ts +59 -0
  9. package/dist/cjs/build/MessageCommandBuilder.js +100 -0
  10. package/dist/cjs/build/SlashCommandBuilder.d.ts +64 -0
  11. package/dist/cjs/build/SlashCommandBuilder.js +168 -0
  12. package/dist/cjs/client/XernerxClient.d.ts +28 -0
  13. package/dist/cjs/client/XernerxClient.js +116 -0
  14. package/dist/cjs/handlers/CommandHandler.d.ts +27 -0
  15. package/dist/cjs/handlers/CommandHandler.js +45 -0
  16. package/dist/cjs/handlers/EventHandler.d.ts +13 -0
  17. package/dist/cjs/handlers/EventHandler.js +19 -0
  18. package/dist/cjs/handlers/Handler.d.ts +57 -0
  19. package/dist/cjs/handlers/Handler.js +308 -0
  20. package/dist/cjs/handlers/InhibitorHandler.d.ts +18 -0
  21. package/dist/cjs/handlers/InhibitorHandler.js +24 -0
  22. package/dist/cjs/main.d.ts +44 -0
  23. package/dist/cjs/main.js +112 -0
  24. package/dist/cjs/models/CommandArguments.d.ts +17 -0
  25. package/dist/cjs/models/CommandArguments.js +106 -0
  26. package/dist/cjs/models/Events.d.ts +24 -0
  27. package/dist/cjs/models/Events.js +307 -0
  28. package/dist/cjs/models/Extensions.d.ts +7 -0
  29. package/dist/cjs/models/Extensions.js +26 -0
  30. package/dist/cjs/tools/XernerxError.d.ts +5 -0
  31. package/dist/cjs/tools/XernerxError.js +11 -0
  32. package/dist/cjs/tools/package.d.ts +49 -0
  33. package/dist/cjs/tools/package.js +50 -0
  34. package/dist/cjs/types/enums.d.ts +44 -0
  35. package/dist/cjs/types/enums.js +38 -0
  36. package/dist/cjs/types/interfaces.d.ts +25 -0
  37. package/dist/cjs/types/interfaces.js +2 -0
  38. package/dist/cjs/types/options.d.ts +241 -0
  39. package/dist/cjs/types/options.js +2 -0
  40. package/dist/cjs/types/types.d.ts +61 -0
  41. package/dist/cjs/types/types.js +2 -0
  42. package/dist/cjs/utils/ClientUtil.d.ts +25 -0
  43. package/dist/cjs/utils/ClientUtil.js +211 -0
  44. package/dist/cjs/utils/CommandUtil.d.ts +58 -0
  45. package/dist/cjs/utils/CommandUtil.js +247 -0
  46. package/dist/cjs/validators/CommandValidations.d.ts +12 -0
  47. package/dist/cjs/validators/CommandValidations.js +169 -0
  48. package/dist/cjs/validators/InhibitorValidations.d.ts +11 -0
  49. package/dist/cjs/validators/InhibitorValidations.js +40 -0
  50. package/dist/main.d.ts +1 -1
  51. package/dist/main.js +1 -1
  52. package/dist/mjs/build/ContextCommandBuilder.d.ts +68 -0
  53. package/dist/mjs/build/ContextCommandBuilder.js +88 -0
  54. package/dist/mjs/build/EventBuilder.d.ts +21 -0
  55. package/dist/mjs/build/EventBuilder.js +34 -0
  56. package/dist/mjs/build/InhibitorBuilder.d.ts +19 -0
  57. package/dist/mjs/build/InhibitorBuilder.js +27 -0
  58. package/dist/mjs/build/MessageCommandBuilder.d.ts +59 -0
  59. package/dist/mjs/build/MessageCommandBuilder.js +90 -0
  60. package/dist/mjs/build/SlashCommandBuilder.d.ts +64 -0
  61. package/dist/mjs/build/SlashCommandBuilder.js +121 -0
  62. package/dist/mjs/client/XernerxClient.d.ts +28 -0
  63. package/dist/mjs/client/XernerxClient.js +108 -0
  64. package/dist/mjs/handlers/CommandHandler.d.ts +27 -0
  65. package/dist/mjs/handlers/CommandHandler.js +42 -0
  66. package/dist/mjs/handlers/EventHandler.d.ts +13 -0
  67. package/dist/mjs/handlers/EventHandler.js +16 -0
  68. package/dist/mjs/handlers/Handler.d.ts +57 -0
  69. package/dist/mjs/handlers/Handler.js +260 -0
  70. package/dist/mjs/handlers/InhibitorHandler.d.ts +18 -0
  71. package/dist/mjs/handlers/InhibitorHandler.js +21 -0
  72. package/dist/mjs/main.d.ts +44 -0
  73. package/dist/mjs/main.js +52 -0
  74. package/dist/mjs/models/CommandArguments.d.ts +17 -0
  75. package/dist/mjs/models/CommandArguments.js +101 -0
  76. package/dist/mjs/models/Events.d.ts +24 -0
  77. package/dist/mjs/models/Events.js +295 -0
  78. package/dist/mjs/models/Extensions.d.ts +7 -0
  79. package/dist/mjs/models/Extensions.js +23 -0
  80. package/dist/mjs/tools/XernerxError.d.ts +5 -0
  81. package/dist/mjs/tools/XernerxError.js +8 -0
  82. package/dist/mjs/tools/package.d.ts +49 -0
  83. package/dist/mjs/tools/package.js +48 -0
  84. package/dist/mjs/types/enums.d.ts +44 -0
  85. package/dist/mjs/types/enums.js +35 -0
  86. package/dist/mjs/types/interfaces.d.ts +25 -0
  87. package/dist/mjs/types/interfaces.js +1 -0
  88. package/dist/mjs/types/options.d.ts +241 -0
  89. package/dist/mjs/types/options.js +1 -0
  90. package/dist/mjs/types/types.d.ts +61 -0
  91. package/dist/mjs/types/types.js +1 -0
  92. package/dist/mjs/utils/ClientUtil.d.ts +25 -0
  93. package/dist/mjs/utils/ClientUtil.js +202 -0
  94. package/dist/mjs/utils/CommandUtil.d.ts +58 -0
  95. package/dist/mjs/utils/CommandUtil.js +232 -0
  96. package/dist/mjs/validators/CommandValidations.d.ts +12 -0
  97. package/dist/mjs/validators/CommandValidations.js +166 -0
  98. package/dist/mjs/validators/InhibitorValidations.d.ts +11 -0
  99. package/dist/mjs/validators/InhibitorValidations.js +36 -0
  100. package/dist/tools/XernerxLog.js +1 -1
  101. package/package.json +1 -1
@@ -0,0 +1,307 @@
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
+ exports.CommandsDeploy = exports.ContextCommandEvents = exports.SlashCommandEvents = exports.MessageCommandEvents = void 0;
9
+ const discord_js_1 = require('discord.js');
10
+ const CommandUtil_js_1 = require('../utils/CommandUtil.js');
11
+ const CommandArguments_js_1 = require('./CommandArguments.js');
12
+ const CommandValidations_js_1 = __importDefault(require('../validators/CommandValidations.js'));
13
+ const dumfunctions_1 = require('dumfunctions');
14
+ const InhibitorValidations_js_1 = require('../validators/InhibitorValidations.js');
15
+ class MessageCommandEvents {
16
+ client;
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ messageCreate() {
21
+ this.client.on('messageCreate', async (message) => {
22
+ if (!message.author.bot) {
23
+ let command = undefined,
24
+ px = undefined;
25
+ message.author.isOwner = this.client.util.isOwner(message.author.id);
26
+ message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
27
+ const commands = this.client.commands.message;
28
+ commands
29
+ .filter((c) => !c.regex)
30
+ .map(async (cmd) => {
31
+ if (cmd.prefix) {
32
+ cmd.prefix.map((prefix) => {
33
+ if (message.content.startsWith(prefix)) {
34
+ command = message.content.replace(prefix, '').split(/ +/).shift();
35
+ px = prefix;
36
+ }
37
+ });
38
+ }
39
+ if (this.client.handlerOptions.message?.prefix) {
40
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
41
+ prefix.map((prefix) => {
42
+ if (message.content.startsWith(prefix)) {
43
+ command = message.content.replace(prefix, '').split(/ +/).shift();
44
+ px = prefix;
45
+ }
46
+ });
47
+ }
48
+ if (this.client.handlerOptions.message?.allowMention) {
49
+ if (message.mentions.users.has(this.client.user?.id) || message.mentions.repliedUser?.id === this.client.user?.id) {
50
+ command = message.content.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
51
+ px = 'MentionPrefix';
52
+ }
53
+ }
54
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
55
+ if (
56
+ (cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
57
+ (cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
58
+ ) {
59
+ try {
60
+ if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
61
+ const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
62
+ if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
63
+ if (await inhibitor.inhibit()) return;
64
+ if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
65
+ await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
66
+ this.client.emit('commandRun', message, cmd);
67
+ } catch (error) {
68
+ return this.client.emit('commandError', message, error, cmd);
69
+ }
70
+ }
71
+ });
72
+ }
73
+ });
74
+ }
75
+ messageUpdate() {
76
+ this.client.on('messageUpdate', async (old, message) => {
77
+ message = message;
78
+ if (!message.author?.bot) {
79
+ let command = undefined,
80
+ px = undefined;
81
+ if (message.author) message.author.isOwner = this.client.util.isOwner(message.author.id);
82
+ message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
83
+ const commands = this.client.commands.message;
84
+ commands
85
+ .filter((c) => !c.regex)
86
+ .map(async (cmd) => {
87
+ if (cmd.prefix) {
88
+ cmd.prefix.map((prefix) => {
89
+ if (message?.content?.startsWith(prefix)) {
90
+ command = message.content.replace(prefix, '').split(/ +/).shift();
91
+ px = prefix;
92
+ }
93
+ });
94
+ }
95
+ if (this.client.handlerOptions.message?.prefix) {
96
+ const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
97
+ prefix.map((prefix) => {
98
+ if (message?.content?.startsWith(prefix)) {
99
+ command = message.content.replace(prefix, '').split(/ +/).shift();
100
+ px = prefix;
101
+ }
102
+ });
103
+ }
104
+ if (this.client.handlerOptions.message?.allowMention) {
105
+ if (message.mentions.users.has(this.client.user?.id || '') || message.mentions.repliedUser?.id === this.client.user?.id) {
106
+ command = message?.content?.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
107
+ px = 'MentionPrefix';
108
+ }
109
+ }
110
+ const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
111
+ if (
112
+ (cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
113
+ (cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
114
+ ) {
115
+ try {
116
+ if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
117
+ message = message;
118
+ const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
119
+ if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
120
+ if (await inhibitor.inhibit()) return;
121
+ if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
122
+ await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
123
+ this.client.emit('commandRun', message, cmd);
124
+ } catch (error) {
125
+ return this.client.emit('commandError', message, error, cmd);
126
+ }
127
+ }
128
+ });
129
+ }
130
+ });
131
+ }
132
+ messageDelete() {
133
+ this.client.on('messageDelete', async (message) => {
134
+ if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
135
+ try {
136
+ if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
137
+ const msg = this.client.cache.messages.get(message.id);
138
+ const response = await message.channel.messages.fetch(msg?.response);
139
+ await response.delete();
140
+ } catch (error) {
141
+ this.client.emit('commandError', message, error, null);
142
+ }
143
+ }
144
+ });
145
+ }
146
+ }
147
+ exports.MessageCommandEvents = MessageCommandEvents;
148
+ class SlashCommandEvents {
149
+ client;
150
+ constructor(client) {
151
+ this.client = client;
152
+ }
153
+ slashCreate() {
154
+ this.client.on('interactionCreate', async (interaction) => {
155
+ interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
156
+ interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
157
+ if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
158
+ if (this.client.commands.slash.has(interaction.commandName)) {
159
+ let command = this.client.commands.slash.get(interaction.commandName);
160
+ const argumentsInfo = new CommandArguments_js_1.InteractionArguments(interaction);
161
+ try {
162
+ const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
163
+ if (await inhibitor.inhibit()) return;
164
+ if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) return;
165
+ if (command.defer?.reply !== false && this.client.handlerOptions.slash?.defer?.reply)
166
+ await interaction.deferReply({
167
+ ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral,
168
+ fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply,
169
+ });
170
+ if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
171
+ await interaction.deferReply({
172
+ ephemeral: command.defer?.ephemeral,
173
+ fetchReply: command.defer?.fetchReply,
174
+ });
175
+ if (
176
+ command.conditions &&
177
+ (await command.conditions(interaction, {
178
+ group: argumentsInfo.group(),
179
+ subcommand: argumentsInfo.subcommand(),
180
+ args: await argumentsInfo.arguments(),
181
+ }))
182
+ )
183
+ return;
184
+ await command.exec(interaction, {
185
+ group: argumentsInfo.group(),
186
+ subcommand: argumentsInfo.subcommand(),
187
+ args: await argumentsInfo.arguments(),
188
+ });
189
+ this.client.emit('commandRun', interaction, command);
190
+ } catch (error) {
191
+ this.client.emit('commandError', interaction, error, command);
192
+ }
193
+ }
194
+ }
195
+ });
196
+ }
197
+ }
198
+ exports.SlashCommandEvents = SlashCommandEvents;
199
+ class ContextCommandEvents {
200
+ client;
201
+ constructor(client) {
202
+ this.client = client;
203
+ }
204
+ contextCreate() {
205
+ this.client.on('interactionCreate', async (interaction) => {
206
+ interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
207
+ interaction.user.isOwner = this.client.util.isOwner(interaction.user.id);
208
+ if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
209
+ if (this.client.commands.context.has(interaction.commandName)) {
210
+ let command = this.client.commands.context.get(interaction.commandName);
211
+ try {
212
+ const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
213
+ if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) return;
214
+ if (await inhibitor.inhibit()) return;
215
+ if (command.conditions && (await command.conditions(interaction))) return;
216
+ if (command.defer?.reply !== false && this.client.handlerOptions.context?.defer?.reply)
217
+ await interaction.deferReply({
218
+ ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
219
+ fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
220
+ });
221
+ if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
222
+ await interaction.deferReply({
223
+ ephemeral: command.defer?.ephemeral,
224
+ fetchReply: command.defer?.fetchReply,
225
+ });
226
+ let args = {};
227
+ if (command.type === 3) args = await interaction.channel.messages.fetch(interaction.targetId);
228
+ if (command.type === 2) args = await this.client.users.fetch(interaction.targetId);
229
+ await command.exec(interaction, args);
230
+ this.client.emit('commandRun', interaction, command);
231
+ } catch (error) {
232
+ this.client.emit('commandError', interaction, error, command);
233
+ }
234
+ }
235
+ }
236
+ });
237
+ }
238
+ }
239
+ exports.ContextCommandEvents = ContextCommandEvents;
240
+ class CommandsDeploy {
241
+ client;
242
+ constructor(client) {
243
+ this.client = client;
244
+ }
245
+ deploy() {
246
+ this.client.once('ready', async (client) => {
247
+ const slashCommands = [],
248
+ contextCommands = [];
249
+ this.client.commands.context.map((command) => (command.data ? contextCommands.push(command.data.toJSON()) : null));
250
+ this.client.commands.slash.map((command) => (command.data ? slashCommands.push(command.data.toJSON()) : null));
251
+ try {
252
+ const global = {
253
+ slash: this.client.handlerOptions.slash?.global,
254
+ context: this.client.handlerOptions.context?.global,
255
+ };
256
+ const guild = {
257
+ slash: this.client.handlerOptions.slash?.guildId,
258
+ context: this.client.handlerOptions.context?.guildId,
259
+ };
260
+ if (!guild.slash && !guild.context) return;
261
+ if (global.slash && global.context) {
262
+ if (guild.slash !== guild.context)
263
+ console.info(
264
+ dumfunctions_1.Style.log(
265
+ `Xernerx | Warning: slash and context commands are both set to global, but don't have a matching guildId, using ${
266
+ (await this.client.guilds.fetch(this.client.handlerOptions.slash?.guildId)).name
267
+ }!`,
268
+ { color: dumfunctions_1.Style.TextColor.Red }
269
+ )
270
+ );
271
+ this.put('global', guild.slash, [...contextCommands, ...slashCommands]);
272
+ this.put('guild', guild.slash, []);
273
+ }
274
+ if (global.slash && global.context === false) {
275
+ this.put('global', guild.slash, slashCommands);
276
+ }
277
+ if (global.slash === false && global.context) {
278
+ this.put('global', guild.context, contextCommands);
279
+ }
280
+ if (global.slash === false && global.context === false) {
281
+ this.put('guild', guild.slash, [...contextCommands, ...slashCommands]);
282
+ }
283
+ if (this.client.handlerOptions.context?.logging || this.client.handlerOptions.slash?.logging)
284
+ console.info(
285
+ dumfunctions_1.Style.log(
286
+ `Xernerx | Deployed ${slashCommands.length} slash commands ${global.slash ? 'globally' : 'locally'} and ${contextCommands.length} context commands ${
287
+ global.context ? 'globally' : 'locally'
288
+ }.`,
289
+ { color: dumfunctions_1.Style.TextColor.Purple }
290
+ )
291
+ );
292
+ } catch (error) {
293
+ console.error(
294
+ dumfunctions_1.Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, {
295
+ color: dumfunctions_1.Style.BackgroundColor.Red,
296
+ })
297
+ );
298
+ }
299
+ });
300
+ }
301
+ put(type, guild, body) {
302
+ const rest = new discord_js_1.REST({ version: discord_js_1.GatewayVersion }).setToken(this.client.token);
303
+ if (type === 'guild') rest.put(discord_js_1.Routes.applicationGuildCommands(this.client.user?.id, guild), { body });
304
+ else rest.put(discord_js_1.Routes.applicationCommands(this.client.user?.id), { body });
305
+ }
306
+ }
307
+ exports.CommandsDeploy = CommandsDeploy;
@@ -0,0 +1,7 @@
1
+ import XernerxExtensionBuilder from 'xernerx-extension-builder';
2
+ import XernerxClient from '../client/XernerxClient.js';
3
+ export default class Extensions {
4
+ client: XernerxClient;
5
+ constructor(client: XernerxClient);
6
+ load(extensions: Array<XernerxExtensionBuilder>, logging?: boolean): Promise<void>;
7
+ }
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ const dumfunctions_1 = require('dumfunctions');
4
+ class Extensions {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ async load(extensions, logging = false) {
10
+ const exts = [];
11
+ extensions.map((extension) => {
12
+ try {
13
+ this.client.extensions[extension.name] = extension;
14
+ exts.push(extension.name);
15
+ } catch (error) {
16
+ console.error(
17
+ dumfunctions_1.Style.log(`Xernerx | An error occurred trying to load ${extension.name}, error: <${error}>`, {
18
+ color: dumfunctions_1.Style.BackgroundColor.Red,
19
+ })
20
+ );
21
+ }
22
+ });
23
+ if (logging) console.info(dumfunctions_1.Style.log(`Xernerx | Loaded ${exts.length} extensions: ${exts.join(', ')}`, { color: dumfunctions_1.Style.TextColor.Cyan }));
24
+ }
25
+ }
26
+ exports.default = Extensions;
@@ -0,0 +1,5 @@
1
+ export default class XernerxError {
2
+ name: string;
3
+ message: string;
4
+ constructor(message?: string);
5
+ }
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ class XernerxError {
4
+ name;
5
+ message;
6
+ constructor(message) {
7
+ this.name = 'XernerxError';
8
+ this.message = message || '';
9
+ }
10
+ }
11
+ exports.default = XernerxError;
@@ -0,0 +1,49 @@
1
+ declare const _default: {
2
+ name: string;
3
+ version: string;
4
+ type: string;
5
+ description: string;
6
+ main: string;
7
+ keywords: string[];
8
+ author: string;
9
+ license: string;
10
+ homepage: string;
11
+ packageManager: string;
12
+ exports: {
13
+ import: string;
14
+ require: string;
15
+ types: string;
16
+ node: null;
17
+ default: null;
18
+ };
19
+ scripts: {
20
+ start: string;
21
+ patch: string;
22
+ minor: string;
23
+ major: string;
24
+ site: string;
25
+ commit: string;
26
+ write: string;
27
+ build: string;
28
+ };
29
+ repository: {
30
+ type: string;
31
+ url: string;
32
+ };
33
+ bugs: {
34
+ url: string;
35
+ };
36
+ dependencies: {
37
+ '@sapphire/shapeshift': string;
38
+ 'discord.js': string;
39
+ dumfunctions: string;
40
+ 'xernerx-extension-builder': string;
41
+ zod: string;
42
+ };
43
+ devDependencies: {
44
+ prettier: string;
45
+ tsup: string;
46
+ typescript: string;
47
+ };
48
+ };
49
+ export default _default;
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.default = {
4
+ name: 'xernerx',
5
+ version: '3.5.1',
6
+ type: 'module',
7
+ description: 'A bot framework for discord.js.',
8
+ main: 'dist/main.js',
9
+ keywords: ['discord.js', 'discord', 'framework', 'mjs', 'esm', 'cjs', 'ts'],
10
+ author: 'Dummi',
11
+ license: 'MIT',
12
+ homepage: 'https://xernerx.github.io/xernerx/home.html',
13
+ packageManager: 'npm@8.5.5',
14
+ exports: {
15
+ import: './dist/main.js',
16
+ require: './dist/main.cjs',
17
+ types: './types',
18
+ node: null,
19
+ default: null,
20
+ },
21
+ scripts: {
22
+ start: 'npm i && npm fund && npm audit fix --force && npm link && tsc -w',
23
+ patch: 'npm run write && git add . && npm run commit && npm version patch && npm publish && git push',
24
+ minor: 'npm run write && git add . && npm run commit && npm version minor && npm publish && git push',
25
+ major: 'npm run write && git add . && npm run commit && npm version major && npm publish && git push',
26
+ site: 'git add docs && npm run commit && git push',
27
+ commit: 'node ../.scripts/commit.js',
28
+ write: 'npm run build && node ../.scripts/rewritePackage.js ',
29
+ build: 'tsc && npx tsup src/main.ts && npx prettier --write src',
30
+ },
31
+ repository: {
32
+ type: 'git',
33
+ url: 'git+https://github.com/xernerx/xernerx.git',
34
+ },
35
+ bugs: {
36
+ url: 'https://github.com/xernerx/xernerx/issues',
37
+ },
38
+ dependencies: {
39
+ '@sapphire/shapeshift': '^3.8.1',
40
+ 'discord.js': '^14.7.1',
41
+ dumfunctions: '^2.1.1',
42
+ 'xernerx-extension-builder': '^0.0.5',
43
+ zod: '^3.20.6',
44
+ },
45
+ devDependencies: {
46
+ prettier: '^2.8.4',
47
+ tsup: '^6.6.0',
48
+ typescript: '^4.9.5',
49
+ },
50
+ };
@@ -0,0 +1,44 @@
1
+ import {
2
+ SlashCommandStringOption,
3
+ SlashCommandNumberOption,
4
+ SlashCommandIntegerOption,
5
+ SlashCommandBooleanOption,
6
+ SlashCommandUserOption,
7
+ SlashCommandChannelOption,
8
+ SlashCommandRoleOption,
9
+ SlashCommandMentionableOption,
10
+ } from 'discord.js';
11
+ export declare enum InhibitorType {
12
+ Member = 'Member',
13
+ User = 'User',
14
+ Guild = 'Guild',
15
+ SlashCommand = 'SlashCommand',
16
+ MessageCommand = 'MessageCommand',
17
+ ContextCommand = 'ContextCommand',
18
+ Command = 'Command',
19
+ Message = 'Message',
20
+ Interaction = 'Interaction',
21
+ Channel = 'Channel',
22
+ }
23
+ export declare enum CommandType {
24
+ Message = 'MessageCommand',
25
+ Slash = 'SlashCommand',
26
+ Context = 'ContextCommand',
27
+ Event = 'Event',
28
+ Inhibitor = 'Inhibitor',
29
+ MessageCommand = 'MessageCommand',
30
+ SlashCommand = 'SlashCommand',
31
+ ContextCommand = 'ContextCommand',
32
+ }
33
+ export declare enum ContextCommandType {
34
+ Message = 3,
35
+ User = 2,
36
+ }
37
+ export declare enum EventEmitterType {
38
+ Client = 'client',
39
+ Rest = 'rest',
40
+ Process = 'process',
41
+ }
42
+ export type SlashCommandOptionChoices = SlashCommandStringOption | SlashCommandNumberOption | SlashCommandIntegerOption;
43
+ export type SlashCommandOption = SlashCommandOptionChoices | SlashCommandBooleanOption | SlashCommandUserOption | SlashCommandChannelOption | SlashCommandRoleOption | SlashCommandMentionableOption;
44
+ export type SlashArgumentTypes = 'String' | 'Number' | 'Boolean' | 'User' | 'Channel' | 'Role' | 'Mentionable' | 'Integer';
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.EventEmitterType = exports.ContextCommandType = exports.CommandType = exports.InhibitorType = void 0;
4
+ var InhibitorType;
5
+ (function (InhibitorType) {
6
+ InhibitorType['Member'] = 'Member';
7
+ InhibitorType['User'] = 'User';
8
+ InhibitorType['Guild'] = 'Guild';
9
+ InhibitorType['SlashCommand'] = 'SlashCommand';
10
+ InhibitorType['MessageCommand'] = 'MessageCommand';
11
+ InhibitorType['ContextCommand'] = 'ContextCommand';
12
+ InhibitorType['Command'] = 'Command';
13
+ InhibitorType['Message'] = 'Message';
14
+ InhibitorType['Interaction'] = 'Interaction';
15
+ InhibitorType['Channel'] = 'Channel';
16
+ })((InhibitorType = exports.InhibitorType || (exports.InhibitorType = {})));
17
+ var CommandType;
18
+ (function (CommandType) {
19
+ CommandType['Message'] = 'MessageCommand';
20
+ CommandType['Slash'] = 'SlashCommand';
21
+ CommandType['Context'] = 'ContextCommand';
22
+ CommandType['Event'] = 'Event';
23
+ CommandType['Inhibitor'] = 'Inhibitor';
24
+ CommandType['MessageCommand'] = 'MessageCommand';
25
+ CommandType['SlashCommand'] = 'SlashCommand';
26
+ CommandType['ContextCommand'] = 'ContextCommand';
27
+ })((CommandType = exports.CommandType || (exports.CommandType = {})));
28
+ var ContextCommandType;
29
+ (function (ContextCommandType) {
30
+ ContextCommandType[(ContextCommandType['Message'] = 3)] = 'Message';
31
+ ContextCommandType[(ContextCommandType['User'] = 2)] = 'User';
32
+ })((ContextCommandType = exports.ContextCommandType || (exports.ContextCommandType = {})));
33
+ var EventEmitterType;
34
+ (function (EventEmitterType) {
35
+ EventEmitterType['Client'] = 'client';
36
+ EventEmitterType['Rest'] = 'rest';
37
+ EventEmitterType['Process'] = 'process';
38
+ })((EventEmitterType = exports.EventEmitterType || (exports.EventEmitterType = {})));
@@ -0,0 +1,25 @@
1
+ import { Collection } from 'discord.js';
2
+ import CommandHandler from '../handlers/CommandHandler.js';
3
+ import EventHandler from '../handlers/EventHandler.js';
4
+ import InhibitorHandler from '../handlers/InhibitorHandler.js';
5
+ import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
6
+ import ContextCommandBuilder from '../build/ContextCommandBuilder.js';
7
+ import SlashCommandBuilder from '../build/SlashCommandBuilder.js';
8
+ export interface ClientCommands {
9
+ message: Collection<string, MessageCommandBuilder>;
10
+ slash: Collection<string, SlashCommandBuilder>;
11
+ context: Collection<string, ContextCommandBuilder>;
12
+ }
13
+ export interface ClientCache {
14
+ messages: Collection<string, object>;
15
+ cooldowns: Collection<string, object>;
16
+ messageCommands: Collection<string, object>;
17
+ slashCommands: Collection<string, object>;
18
+ contextCommands: Collection<string, object>;
19
+ commands: Collection<string, object>;
20
+ }
21
+ export interface ClientModules {
22
+ commandHandler: CommandHandler;
23
+ eventHandler: EventHandler;
24
+ inhibitorHandler: InhibitorHandler;
25
+ }
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });