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