xernerx 3.6.0 → 4.0.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 (201) hide show
  1. package/dist/build/ContextCommandBuilder.d.ts +47 -0
  2. package/dist/build/ContextCommandBuilder.js +78 -0
  3. package/dist/{cjs/build → build}/EventBuilder.d.ts +7 -6
  4. package/dist/build/EventBuilder.js +35 -0
  5. package/dist/build/InhibitorBuilder.d.ts +17 -0
  6. package/dist/build/InhibitorBuilder.js +26 -0
  7. package/dist/build/MessageCommandBuilder.d.ts +43 -0
  8. package/dist/build/MessageCommandBuilder.js +71 -0
  9. package/dist/{cjs/build → build}/SlashCommandBuilder.d.ts +16 -31
  10. package/dist/build/SlashCommandBuilder.js +122 -0
  11. package/dist/build copy/ContextCommandBuilder.d.ts +37 -0
  12. package/dist/build copy/ContextCommandBuilder.js +88 -0
  13. package/dist/{mjs/build/EventBuilder.d.ts → build copy/EventBuilder.d.ts } +4 -4
  14. package/dist/build copy/EventBuilder.js +34 -0
  15. package/dist/{cjs/build/InhibitorBuilder.d.ts → build copy/InhibitorBuilder.d.ts } +2 -2
  16. package/dist/build copy/InhibitorBuilder.js +27 -0
  17. package/dist/{cjs/build/MessageCommandBuilder.d.ts → build copy/MessageCommandBuilder.d.ts } +14 -34
  18. package/dist/build copy/MessageCommandBuilder.js +90 -0
  19. package/dist/build copy/SlashCommandBuilder.d.ts +41 -0
  20. package/dist/build copy/SlashCommandBuilder.js +122 -0
  21. package/dist/client/DBLClient.d.ts +8 -0
  22. package/dist/client/DBLClient.js +15 -0
  23. package/dist/client/Top.ggClient.d.ts +1 -0
  24. package/dist/client/Top.ggClient.js +1 -0
  25. package/dist/client/XernerxClient.d.ts +54 -0
  26. package/dist/client/XernerxClient.js +90 -0
  27. package/dist/events/messageCreate.d.ts +1 -0
  28. package/dist/events/messageCreate.js +1 -0
  29. package/dist/functions/AsyncFunctions.d.ts +1 -0
  30. package/dist/functions/AsyncFunctions.js +1 -0
  31. package/dist/functions/delay.d.ts +1 -0
  32. package/dist/functions/delay.js +3 -0
  33. package/dist/functions/deploy.d.ts +2 -0
  34. package/dist/functions/deploy.js +29 -0
  35. package/dist/functions/getPermissionBitField.d.ts +2 -0
  36. package/dist/functions/getPermissionBitField.js +17 -0
  37. package/dist/functions/hasVoted.d.ts +1 -0
  38. package/dist/functions/hasVoted.js +1 -0
  39. package/dist/functions/isOwner.d.ts +3 -0
  40. package/dist/functions/isOwner.js +3 -0
  41. package/dist/functions/isVoter.d.ts +3 -0
  42. package/dist/functions/isVoter.js +5 -0
  43. package/dist/functions/load.d.ts +3 -0
  44. package/dist/functions/load.js +32 -0
  45. package/dist/functions/reload.d.ts +2 -0
  46. package/dist/functions/reload.js +39 -0
  47. package/dist/functions/sendWebhook.d.ts +2 -0
  48. package/dist/functions/sendWebhook.js +12 -0
  49. package/dist/functions/voted.d.ts +1 -0
  50. package/dist/functions/voted.js +1 -0
  51. package/dist/functions/xernerxUser.d.ts +3 -0
  52. package/dist/functions/xernerxUser.js +8 -0
  53. package/dist/handlers/CommandHandler.d.ts +13 -0
  54. package/dist/handlers/CommandHandler.js +220 -0
  55. package/dist/handlers/EventHandler.d.ts +7 -0
  56. package/dist/handlers/EventHandler.js +24 -0
  57. package/dist/handlers/ExtensionHandler.d.ts +7 -0
  58. package/dist/handlers/ExtensionHandler.js +19 -0
  59. package/dist/handlers/Handler.d.ts +14 -0
  60. package/dist/handlers/Handler.js +36 -0
  61. package/dist/handlers/InhibitorHandler.d.ts +7 -0
  62. package/dist/handlers/InhibitorHandler.js +24 -0
  63. package/dist/handlers/WebhookHandler.d.ts +7 -0
  64. package/dist/handlers/WebhookHandler.js +50 -0
  65. package/dist/main.d.ts +11 -0
  66. package/dist/main.js +11 -0
  67. package/dist/models/Arguments.d.ts +15 -0
  68. package/dist/models/Arguments.js +129 -0
  69. package/dist/{cjs/models → models}/CommandArguments.js +2 -7
  70. package/dist/{mjs/models → models}/Events.js +44 -56
  71. package/dist/models/Extensions.js +23 -0
  72. package/dist/models/XernerxUser.js +9 -0
  73. package/dist/tools/XernerxError.d.ts +6 -0
  74. package/dist/tools/XernerxError.js +10 -0
  75. package/dist/tools/XernerxLog.d.ts +13 -0
  76. package/dist/tools/XernerxLog.js +30 -0
  77. package/dist/tools/classes.d.ts +6 -0
  78. package/dist/tools/classes.js +10 -0
  79. package/dist/tools/loggers.d.ts +4 -0
  80. package/dist/tools/loggers.js +4 -0
  81. package/dist/{mjs/tools → tools}/package.d.ts +1 -4
  82. package/dist/{cjs/tools → tools}/package.js +11 -16
  83. package/dist/{cjs/types → types}/enums.js +8 -11
  84. package/dist/types/extenders.d.ts +23 -0
  85. package/dist/types/extenders.js +1 -0
  86. package/dist/types/interfaces.d.ts +224 -0
  87. package/dist/types/interfaces.js +1 -0
  88. package/dist/types/options.js +1 -0
  89. package/dist/types/types.d.ts +181 -0
  90. package/dist/types/types.js +1 -0
  91. package/dist/utils/ClientUtil.d.ts +6 -0
  92. package/dist/utils/ClientUtil.js +7 -0
  93. package/dist/{cjs/utils → utils}/CommandUtil.js +14 -29
  94. package/dist/utils/InteractionArguments.d.ts +1 -0
  95. package/dist/utils/InteractionArguments.js +1 -0
  96. package/dist/utils/InteractionUtil.d.ts +10 -0
  97. package/dist/utils/InteractionUtil.js +15 -0
  98. package/dist/utils/MessageUtil.d.ts +11 -0
  99. package/dist/utils/MessageUtil.js +42 -0
  100. package/dist/utils/Util.d.ts +5 -0
  101. package/dist/utils/Util.js +6 -0
  102. package/dist/{mjs/validators → validators}/CommandValidations.js +10 -13
  103. package/dist/validators/InhibitorValidations.d.ts +18 -0
  104. package/dist/validators/InhibitorValidations.js +34 -0
  105. package/dist/validators/commandValidation.d.ts +6 -0
  106. package/dist/validators/commandValidation.js +48 -0
  107. package/dist/validators/commands.d.ts +4 -0
  108. package/dist/validators/commands.js +25 -0
  109. package/package.json +10 -13
  110. package/dist/cjs/build/ContextCommandBuilder.d.ts +0 -63
  111. package/dist/cjs/build/ContextCommandBuilder.js +0 -97
  112. package/dist/cjs/build/EventBuilder.js +0 -44
  113. package/dist/cjs/build/InhibitorBuilder.js +0 -37
  114. package/dist/cjs/build/MessageCommandBuilder.js +0 -100
  115. package/dist/cjs/build/SlashCommandBuilder.js +0 -169
  116. package/dist/cjs/client/XernerxClient.d.ts +0 -29
  117. package/dist/cjs/client/XernerxClient.js +0 -120
  118. package/dist/cjs/handlers/CommandHandler.d.ts +0 -27
  119. package/dist/cjs/handlers/CommandHandler.js +0 -45
  120. package/dist/cjs/handlers/EventHandler.d.ts +0 -13
  121. package/dist/cjs/handlers/EventHandler.js +0 -19
  122. package/dist/cjs/handlers/Handler.d.ts +0 -57
  123. package/dist/cjs/handlers/Handler.js +0 -308
  124. package/dist/cjs/handlers/InhibitorHandler.d.ts +0 -18
  125. package/dist/cjs/handlers/InhibitorHandler.js +0 -24
  126. package/dist/cjs/handlers/WebhookHandler.d.ts +0 -7
  127. package/dist/cjs/handlers/WebhookHandler.js +0 -23
  128. package/dist/cjs/main.d.ts +0 -44
  129. package/dist/cjs/main.js +0 -112
  130. package/dist/cjs/models/Events.js +0 -309
  131. package/dist/cjs/models/Extensions.js +0 -26
  132. package/dist/cjs/models/XernerxUser.js +0 -12
  133. package/dist/cjs/tools/XernerxError.d.ts +0 -5
  134. package/dist/cjs/tools/XernerxError.js +0 -11
  135. package/dist/cjs/tools/package.d.ts +0 -44
  136. package/dist/cjs/types/interfaces.d.ts +0 -27
  137. package/dist/cjs/types/interfaces.js +0 -2
  138. package/dist/cjs/types/options.js +0 -2
  139. package/dist/cjs/types/types.d.ts +0 -62
  140. package/dist/cjs/types/types.js +0 -2
  141. package/dist/cjs/utils/ClientUtil.d.ts +0 -26
  142. package/dist/cjs/utils/ClientUtil.js +0 -211
  143. package/dist/cjs/validators/CommandValidations.js +0 -169
  144. package/dist/cjs/validators/InhibitorValidations.d.ts +0 -11
  145. package/dist/cjs/validators/InhibitorValidations.js +0 -40
  146. package/dist/mjs/build/ContextCommandBuilder.d.ts +0 -63
  147. package/dist/mjs/build/ContextCommandBuilder.js +0 -97
  148. package/dist/mjs/build/EventBuilder.js +0 -44
  149. package/dist/mjs/build/InhibitorBuilder.d.ts +0 -19
  150. package/dist/mjs/build/InhibitorBuilder.js +0 -37
  151. package/dist/mjs/build/MessageCommandBuilder.d.ts +0 -59
  152. package/dist/mjs/build/MessageCommandBuilder.js +0 -100
  153. package/dist/mjs/build/SlashCommandBuilder.d.ts +0 -65
  154. package/dist/mjs/build/SlashCommandBuilder.js +0 -169
  155. package/dist/mjs/client/XernerxClient.d.ts +0 -29
  156. package/dist/mjs/client/XernerxClient.js +0 -120
  157. package/dist/mjs/handlers/CommandHandler.d.ts +0 -27
  158. package/dist/mjs/handlers/CommandHandler.js +0 -45
  159. package/dist/mjs/handlers/EventHandler.d.ts +0 -13
  160. package/dist/mjs/handlers/EventHandler.js +0 -19
  161. package/dist/mjs/handlers/Handler.d.ts +0 -57
  162. package/dist/mjs/handlers/Handler.js +0 -308
  163. package/dist/mjs/handlers/InhibitorHandler.d.ts +0 -18
  164. package/dist/mjs/handlers/InhibitorHandler.js +0 -24
  165. package/dist/mjs/handlers/WebhookHandler.d.ts +0 -7
  166. package/dist/mjs/handlers/WebhookHandler.js +0 -23
  167. package/dist/mjs/main.d.ts +0 -44
  168. package/dist/mjs/main.js +0 -112
  169. package/dist/mjs/models/CommandArguments.d.ts +0 -17
  170. package/dist/mjs/models/CommandArguments.js +0 -106
  171. package/dist/mjs/models/Events.d.ts +0 -24
  172. package/dist/mjs/models/Extensions.d.ts +0 -7
  173. package/dist/mjs/models/Extensions.js +0 -26
  174. package/dist/mjs/models/XernerxUser.d.ts +0 -2
  175. package/dist/mjs/models/XernerxUser.js +0 -12
  176. package/dist/mjs/tools/XernerxError.d.ts +0 -5
  177. package/dist/mjs/tools/XernerxError.js +0 -11
  178. package/dist/mjs/tools/package.js +0 -45
  179. package/dist/mjs/types/enums.d.ts +0 -44
  180. package/dist/mjs/types/enums.js +0 -38
  181. package/dist/mjs/types/interfaces.d.ts +0 -27
  182. package/dist/mjs/types/interfaces.js +0 -2
  183. package/dist/mjs/types/options.d.ts +0 -254
  184. package/dist/mjs/types/options.js +0 -2
  185. package/dist/mjs/types/types.d.ts +0 -62
  186. package/dist/mjs/types/types.js +0 -2
  187. package/dist/mjs/utils/ClientUtil.d.ts +0 -26
  188. package/dist/mjs/utils/ClientUtil.js +0 -211
  189. package/dist/mjs/utils/CommandUtil.d.ts +0 -58
  190. package/dist/mjs/utils/CommandUtil.js +0 -247
  191. package/dist/mjs/validators/CommandValidations.d.ts +0 -12
  192. package/dist/mjs/validators/InhibitorValidations.d.ts +0 -11
  193. package/dist/mjs/validators/InhibitorValidations.js +0 -40
  194. /package/dist/{cjs/models → models}/CommandArguments.d.ts +0 -0
  195. /package/dist/{cjs/models → models}/Events.d.ts +0 -0
  196. /package/dist/{cjs/models → models}/Extensions.d.ts +0 -0
  197. /package/dist/{cjs/models → models}/XernerxUser.d.ts +0 -0
  198. /package/dist/{cjs/types → types}/enums.d.ts +0 -0
  199. /package/dist/{cjs/types → types}/options.d.ts +0 -0
  200. /package/dist/{cjs/utils → utils}/CommandUtil.d.ts +0 -0
  201. /package/dist/{cjs/validators → validators}/CommandValidations.d.ts +0 -0
@@ -1,309 +0,0 @@
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
- const XernerxUser_js_1 = __importDefault(require('./XernerxUser.js'));
16
- class MessageCommandEvents {
17
- client;
18
- constructor(client) {
19
- this.client = client;
20
- }
21
- messageCreate() {
22
- this.client.on('messageCreate', async (message) => {
23
- if (!message.author.bot) {
24
- let command = undefined,
25
- px = undefined;
26
- message.author = await (0, XernerxUser_js_1.default)(message);
27
- message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
28
- const commands = this.client.commands.message;
29
- commands
30
- .filter((c) => !c.regex)
31
- .map(async (cmd) => {
32
- if (cmd.prefix) {
33
- cmd.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?.prefix) {
41
- const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
42
- prefix.map((prefix) => {
43
- if (message.content.startsWith(prefix)) {
44
- command = message.content.replace(prefix, '').split(/ +/).shift();
45
- px = prefix;
46
- }
47
- });
48
- }
49
- if (this.client.handlerOptions.message?.allowMention) {
50
- if (message.mentions.users.has(this.client.user?.id) || message.mentions.repliedUser?.id === this.client.user?.id) {
51
- command = message.content.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
52
- px = 'MentionPrefix';
53
- }
54
- }
55
- const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
56
- if (
57
- (cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
58
- (cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
59
- ) {
60
- try {
61
- if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
62
- const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
63
- if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
64
- if (await inhibitor.inhibit()) return;
65
- if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
66
- await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
67
- this.client.emit('commandRun', message, cmd);
68
- } catch (error) {
69
- return this.client.emit('commandError', message, error, cmd);
70
- }
71
- }
72
- });
73
- }
74
- });
75
- }
76
- messageUpdate() {
77
- this.client.on('messageUpdate', async (old, message) => {
78
- message = message;
79
- if (!message.author?.bot) {
80
- let command = undefined,
81
- px = undefined;
82
- message.author = await (0, XernerxUser_js_1.default)(message);
83
- message.util = new CommandUtil_js_1.MessageCommandUtil(this.client, message);
84
- const commands = this.client.commands.message;
85
- commands
86
- .filter((c) => !c.regex)
87
- .map(async (cmd) => {
88
- if (cmd.prefix) {
89
- cmd.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?.prefix) {
97
- const prefix = Array.isArray(this.client.handlerOptions.message.prefix) ? this.client.handlerOptions.message.prefix : [this.client.handlerOptions.message.prefix];
98
- prefix.map((prefix) => {
99
- if (message?.content?.startsWith(prefix)) {
100
- command = message.content.replace(prefix, '').split(/ +/).shift();
101
- px = prefix;
102
- }
103
- });
104
- }
105
- if (this.client.handlerOptions.message?.allowMention) {
106
- if (message.mentions.users.has(this.client.user?.id || '') || message.mentions.repliedUser?.id === this.client.user?.id) {
107
- command = message?.content?.replace(`<@${this.client.user?.id}>`, '').trim().split(/ +/).shift();
108
- px = 'MentionPrefix';
109
- }
110
- }
111
- const prefix = Array.isArray(this.client.handlerOptions.message?.prefix) ? this.client.handlerOptions.message?.prefix : [this.client.handlerOptions.message?.prefix];
112
- if (
113
- (cmd.name.toLowerCase() == command?.toLowerCase() || cmd.aliases?.map((c) => c.toLowerCase())?.includes(command?.toLowerCase())) &&
114
- (cmd.prefix.includes(px) || prefix?.includes(px) || px === 'MentionPrefix')
115
- ) {
116
- try {
117
- if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
118
- message = message;
119
- const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, message, command);
120
- if ((0, CommandValidations_js_1.default)(message, cmd, this.client)) return;
121
- if (await inhibitor.inhibit()) return;
122
- if (cmd.conditions && (await cmd.conditions(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd)))) return;
123
- await cmd.exec(message, await (0, CommandArguments_js_1.messageArguments)(message, cmd));
124
- this.client.emit('commandRun', message, cmd);
125
- } catch (error) {
126
- return this.client.emit('commandError', message, error, cmd);
127
- }
128
- }
129
- });
130
- }
131
- });
132
- }
133
- messageDelete() {
134
- this.client.on('messageDelete', async (message) => {
135
- if (this.client.cache.messages.has(message.id) && this.client.handlerOptions.message?.handleDeletes) {
136
- try {
137
- if (this.client.handlerOptions.message?.handleTyping) message.channel.sendTyping();
138
- message.author = await (0, XernerxUser_js_1.default)(message);
139
- const msg = this.client.cache.messages.get(message.id);
140
- const response = await message.channel.messages.fetch(msg?.response);
141
- await response.delete();
142
- } catch (error) {
143
- this.client.emit('commandError', message, error, null);
144
- }
145
- }
146
- });
147
- }
148
- }
149
- exports.MessageCommandEvents = MessageCommandEvents;
150
- class SlashCommandEvents {
151
- client;
152
- constructor(client) {
153
- this.client = client;
154
- }
155
- slashCreate() {
156
- this.client.on('interactionCreate', async (interaction) => {
157
- interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
158
- interaction.author = await (0, XernerxUser_js_1.default)(interaction);
159
- if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
160
- if (this.client.commands.slash.has(interaction.commandName)) {
161
- let command = this.client.commands.slash.get(interaction.commandName);
162
- const argumentsInfo = new CommandArguments_js_1.InteractionArguments(interaction);
163
- try {
164
- const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
165
- if (await inhibitor.inhibit()) return;
166
- if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) return;
167
- if (command.defer?.reply !== false && this.client.handlerOptions.slash?.defer?.reply)
168
- await interaction.deferReply({
169
- ephemeral: this.client.handlerOptions.slash?.defer?.ephemeral,
170
- fetchReply: this.client.handlerOptions.slash?.defer?.fetchReply,
171
- });
172
- if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
173
- await interaction.deferReply({
174
- ephemeral: command.defer?.ephemeral,
175
- fetchReply: command.defer?.fetchReply,
176
- });
177
- if (
178
- command.conditions &&
179
- (await command.conditions(interaction, {
180
- group: argumentsInfo.group(),
181
- subcommand: argumentsInfo.subcommand(),
182
- args: await argumentsInfo.arguments(),
183
- }))
184
- )
185
- return;
186
- await command.exec(interaction, {
187
- group: argumentsInfo.group(),
188
- subcommand: argumentsInfo.subcommand(),
189
- args: await argumentsInfo.arguments(),
190
- });
191
- this.client.emit('commandRun', interaction, command);
192
- } catch (error) {
193
- this.client.emit('commandError', interaction, error, command);
194
- }
195
- }
196
- }
197
- });
198
- }
199
- }
200
- exports.SlashCommandEvents = SlashCommandEvents;
201
- class ContextCommandEvents {
202
- client;
203
- constructor(client) {
204
- this.client = client;
205
- }
206
- contextCreate() {
207
- this.client.on('interactionCreate', async (interaction) => {
208
- interaction.util = new CommandUtil_js_1.InteractionCommandUtil(this.client, interaction);
209
- interaction.author = await (0, XernerxUser_js_1.default)(interaction);
210
- if (interaction.type === discord_js_1.InteractionType.ApplicationCommand) {
211
- if (this.client.commands.context.has(interaction.commandName)) {
212
- let command = this.client.commands.context.get(interaction.commandName);
213
- try {
214
- const inhibitor = new InhibitorValidations_js_1.InhibitorValidation(this.client, interaction, command);
215
- if ((0, CommandValidations_js_1.default)(interaction, command, this.client)) return;
216
- if (await inhibitor.inhibit()) return;
217
- if (command.conditions && (await command.conditions(interaction))) return;
218
- if (command.defer?.reply !== false && this.client.handlerOptions.context?.defer?.reply)
219
- await interaction.deferReply({
220
- ephemeral: this.client.handlerOptions.context?.defer?.ephemeral,
221
- fetchReply: this.client.handlerOptions.context?.defer?.fetchReply,
222
- });
223
- if (!(interaction.deferred || interaction.replied) && command.defer?.reply)
224
- await interaction.deferReply({
225
- ephemeral: command.defer?.ephemeral,
226
- fetchReply: command.defer?.fetchReply,
227
- });
228
- let args = {};
229
- if (command.type === 3) args = await interaction.channel.messages.fetch(interaction.targetId);
230
- if (command.type === 2) args = await this.client.users.fetch(interaction.targetId);
231
- await command.exec(interaction, args);
232
- this.client.emit('commandRun', interaction, command);
233
- } catch (error) {
234
- this.client.emit('commandError', interaction, error, command);
235
- }
236
- }
237
- }
238
- });
239
- }
240
- }
241
- exports.ContextCommandEvents = ContextCommandEvents;
242
- class CommandsDeploy {
243
- client;
244
- constructor(client) {
245
- this.client = client;
246
- }
247
- deploy() {
248
- this.client.once('ready', async (client) => {
249
- const slashCommands = [],
250
- contextCommands = [];
251
- this.client.commands.context.map((command) => (command.data ? contextCommands.push(command.data.toJSON()) : null));
252
- this.client.commands.slash.map((command) => (command.data ? slashCommands.push(command.data.toJSON()) : null));
253
- try {
254
- const global = {
255
- slash: this.client.handlerOptions.slash?.global,
256
- context: this.client.handlerOptions.context?.global,
257
- };
258
- const guild = {
259
- slash: this.client.handlerOptions.slash?.guildId,
260
- context: this.client.handlerOptions.context?.guildId,
261
- };
262
- if (!guild.slash && !guild.context) return;
263
- if (global.slash && global.context) {
264
- if (guild.slash !== guild.context)
265
- console.info(
266
- dumfunctions_1.Style.log(
267
- `Xernerx | Warning: slash and context commands are both set to global, but don't have a matching guildId, using ${
268
- (await this.client.guilds.fetch(this.client.handlerOptions.slash?.guildId)).name
269
- }!`,
270
- { color: dumfunctions_1.Style.TextColor.Red }
271
- )
272
- );
273
- this.put('global', guild.slash, [...contextCommands, ...slashCommands]);
274
- this.put('guild', guild.slash, []);
275
- }
276
- if (global.slash && global.context === false) {
277
- this.put('global', guild.slash, slashCommands);
278
- }
279
- if (global.slash === false && global.context) {
280
- this.put('global', guild.context, contextCommands);
281
- }
282
- if (global.slash === false && global.context === false) {
283
- this.put('guild', guild.slash, [...contextCommands, ...slashCommands]);
284
- }
285
- if (this.client.handlerOptions.context?.logging || this.client.handlerOptions.slash?.logging)
286
- console.info(
287
- dumfunctions_1.Style.log(
288
- `Xernerx | Deployed ${slashCommands.length} slash commands ${global.slash ? 'globally' : 'locally'} and ${contextCommands.length} context commands ${
289
- global.context ? 'globally' : 'locally'
290
- }.`,
291
- { color: dumfunctions_1.Style.TextColor.Purple }
292
- )
293
- );
294
- } catch (error) {
295
- console.error(
296
- dumfunctions_1.Style.log(`Xernerx | Couldn't deploy interaction commands because <${error}>.`, {
297
- color: dumfunctions_1.Style.BackgroundColor.Red,
298
- })
299
- );
300
- }
301
- });
302
- }
303
- put(type, guild, body) {
304
- const rest = new discord_js_1.REST({ version: discord_js_1.GatewayVersion }).setToken(this.client.token);
305
- if (type === 'guild') rest.put(discord_js_1.Routes.applicationGuildCommands(this.client.user?.id, guild), { body });
306
- else rest.put(discord_js_1.Routes.applicationCommands(this.client.user?.id), { body });
307
- }
308
- }
309
- exports.CommandsDeploy = CommandsDeploy;
@@ -1,26 +0,0 @@
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;
@@ -1,12 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const dbl_sdk_1 = require('dbl-sdk');
4
- async function XernerxUser(interaction) {
5
- const user = interaction.user || interaction.author;
6
- user.owner = interaction.client.util.isOwner(user.id);
7
- user.voter = interaction.client.handlerOptions?.webhook?.topgg?.token
8
- ? await (0, dbl_sdk_1.hasVoted)(user.id, interaction.client.user.id, interaction.client.handlerOptions.webhook.topgg.token, 'top.gg')
9
- : false;
10
- return user;
11
- }
12
- exports.default = XernerxUser;
@@ -1,5 +0,0 @@
1
- export default class XernerxError {
2
- name: string;
3
- message: string;
4
- constructor(message?: string);
5
- }
@@ -1,11 +0,0 @@
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;
@@ -1,44 +0,0 @@
1
- declare const _default: {
2
- name: string;
3
- version: string;
4
- description: string;
5
- main: string;
6
- module: string;
7
- keywords: string[];
8
- author: string;
9
- license: string;
10
- homepage: string;
11
- packageManager: string;
12
- scripts: {
13
- start: string;
14
- patch: string;
15
- minor: string;
16
- major: string;
17
- site: string;
18
- commit: string;
19
- write: string;
20
- format: string;
21
- build: string;
22
- 'build:esm': string;
23
- 'build:cjs': string;
24
- };
25
- repository: {
26
- type: string;
27
- url: string;
28
- };
29
- bugs: {
30
- url: string;
31
- };
32
- dependencies: {
33
- '@sapphire/shapeshift': string;
34
- 'discord.js': string;
35
- dumfunctions: string;
36
- 'xernerx-extension-builder': string;
37
- zod: string;
38
- };
39
- devDependencies: {
40
- prettier: string;
41
- typescript: string;
42
- };
43
- };
44
- export default _default;
@@ -1,27 +0,0 @@
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
- import WebhookHandler from '../handlers/WebhookHandler.js';
9
- export interface ClientCommands {
10
- message: Collection<string, MessageCommandBuilder>;
11
- slash: Collection<string, SlashCommandBuilder>;
12
- context: Collection<string, ContextCommandBuilder>;
13
- }
14
- export interface ClientCache {
15
- messages: Collection<string, object>;
16
- cooldowns: Collection<string, object>;
17
- messageCommands: Collection<string, object>;
18
- slashCommands: Collection<string, object>;
19
- contextCommands: Collection<string, object>;
20
- commands: Collection<string, object>;
21
- }
22
- export interface ClientModules {
23
- commandHandler: CommandHandler;
24
- eventHandler: EventHandler;
25
- inhibitorHandler: InhibitorHandler;
26
- webhookHandler: WebhookHandler;
27
- }
@@ -1,2 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,2 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,62 +0,0 @@
1
- import { TextChannel, Message, User, Guild, GuildMember, Channel, Role, InteractionResponse } from 'discord.js';
2
- import { InteractionCommandUtil, MessageCommandUtil } from '../utils/CommandUtil.js';
3
- export interface XernerxMessage extends Message {
4
- util?: MessageCommandUtil;
5
- response?: string;
6
- }
7
- export interface XernerxInteraction extends InteractionResponse {
8
- util: InteractionCommandUtil;
9
- options?: {
10
- _group: string;
11
- _subcommand: string;
12
- _hoistedOptions: Array<{
13
- name: string;
14
- channel: Channel;
15
- user: XernerxUser;
16
- role: XernerxRole;
17
- value: string;
18
- }>;
19
- };
20
- }
21
- export interface XernerxUser extends User {
22
- owner: boolean;
23
- voter?: boolean;
24
- }
25
- export interface XernerxRole extends Role {}
26
- export interface XernerxTextChannel extends TextChannel {}
27
- export interface XernerxGuild extends Guild {}
28
- export interface XernerxMember extends GuildMember {}
29
- export type MessageCommandArgsTypes = 'rest' | 'option' | 'flag' | 'string' | 'number' | 'channel' | 'user' | 'member' | 'boolean' | 'role';
30
- export type Localizations =
31
- | 'id'
32
- | 'da'
33
- | 'de'
34
- | 'en-GB'
35
- | 'en-US'
36
- | 'es-ES'
37
- | 'fr'
38
- | 'hr'
39
- | 'it'
40
- | 'lt'
41
- | 'hu'
42
- | 'nl'
43
- | 'no'
44
- | 'pl'
45
- | 'pt-BR'
46
- | 'ro'
47
- | 'fi'
48
- | 'sv-SE'
49
- | 'vi'
50
- | 'tr'
51
- | 'cs'
52
- | 'el'
53
- | 'bg'
54
- | 'ru'
55
- | 'uk'
56
- | 'hi'
57
- | 'th'
58
- | 'zh-CN'
59
- | 'ja'
60
- | 'zh-TW'
61
- | 'ko';
62
- export type EventEmitterType = 'client' | 'process';
@@ -1,2 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,26 +0,0 @@
1
- import { ActivityType, ClientPresenceStatus } from 'discord.js';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- interface Presence {
4
- text?: string;
5
- type?: ActivityType.Playing | ActivityType.Streaming | ActivityType.Listening | ActivityType.Watching | ActivityType.Competing;
6
- link?: string;
7
- status?: ClientPresenceStatus;
8
- interval?: number;
9
- }
10
- export declare class ClientUtil {
11
- client: XernerxClient;
12
- [index: string]: Function | XernerxClient;
13
- constructor(client: XernerxClient);
14
- uptime(timestamp: number | null): string;
15
- getSubcommands(name: string): object[];
16
- isOwner(userId: string): boolean;
17
- getAllCommands(): object[];
18
- getAllMessageCommands(): object[];
19
- getAllSlashCommands(): object[];
20
- getAllContextCommands(): object[];
21
- setPresence(options: Presence): void;
22
- getCooldowns(id: string, command?: string): any;
23
- getCooldownTimers(id: string, command?: string): any;
24
- defer(time: number): Promise<unknown>;
25
- }
26
- export {};