xernerx 4.4.13 → 4.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/ContextCommandBuilder.d.ts +31 -23
- package/dist/build/ContextCommandBuilder.js +39 -39
- package/dist/build/EventBuilder.d.ts +1 -1
- package/dist/build/EventBuilder.js +2 -2
- package/dist/build/InhibitorBuilder.d.ts +1 -1
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +26 -20
- package/dist/build/MessageCommandBuilder.js +34 -34
- package/dist/build/SlashCommandBuilder.d.ts +31 -23
- package/dist/build/SlashCommandBuilder.js +48 -48
- package/dist/client/XernerxClient.d.ts +30 -22
- package/dist/client/XernerxClient.js +33 -33
- package/dist/client/XernerxShardClient.d.ts +1 -1
- package/dist/client/XernerxShardClient.d.ts.map +1 -1
- package/dist/client/XernerxShardClient.js +18 -12
- package/dist/client/XernerxShardClient.js.map +1 -1
- package/dist/functions/delay.d.ts +1 -1
- package/dist/functions/delay.js +1 -1
- package/dist/functions/deploy.d.ts +1 -1
- package/dist/functions/deploy.js +13 -16
- package/dist/functions/isOwner.d.ts +1 -1
- package/dist/functions/isOwner.js +1 -1
- package/dist/functions/isVoter.d.ts +1 -1
- package/dist/functions/isVoter.js +1 -1
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +2 -3
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +9 -12
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +2 -3
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +12 -11
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +1 -1
- package/dist/handlers/CommandHandler.d.ts +1 -1
- package/dist/handlers/CommandHandler.js +82 -105
- package/dist/handlers/EventHandler.d.ts +1 -1
- package/dist/handlers/EventHandler.js +3 -3
- package/dist/handlers/ExtensionHandler.d.ts +1 -1
- package/dist/handlers/ExtensionHandler.js +3 -5
- package/dist/handlers/Handler.d.ts +1 -1
- package/dist/handlers/Handler.js +6 -16
- package/dist/handlers/InhibitorHandler.d.ts +1 -1
- package/dist/handlers/InhibitorHandler.js +3 -3
- package/dist/handlers/WebhookHandler.d.ts +2 -4
- package/dist/handlers/WebhookHandler.js +9 -6
- package/dist/main.d.ts +29 -22
- package/dist/main.js +29 -22
- package/dist/models/Arguments.d.ts +1 -1
- package/dist/models/Arguments.js +48 -63
- package/dist/tools/XernerxError.d.ts +1 -1
- package/dist/tools/XernerxError.js +1 -1
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +7 -2
- package/dist/types/extenders.d.ts +5 -9
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +9 -6
- package/dist/types/interfaces.js +1 -1
- package/dist/types/types.d.ts +174 -6
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +4 -4
- package/dist/utils/ClientUtil.js +8 -14
- package/dist/utils/InteractionUtil.d.ts +2 -2
- package/dist/utils/InteractionUtil.js +1 -1
- package/dist/utils/MessageUtil.d.ts +2 -2
- package/dist/utils/MessageUtil.js +5 -9
- package/dist/utils/Util.d.ts +1 -1
- package/dist/utils/Util.js +1 -1
- package/dist/validators/commandValidation.d.ts +1 -1
- package/dist/validators/commandValidation.js +19 -29
- package/dist/validators/inhibitorValidations.d.ts +15 -2
- package/dist/validators/inhibitorValidations.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ChannelType, PermissionFlagsBits } from 'discord.js';
|
|
2
2
|
export default async function commandValidation(event, command) {
|
|
3
3
|
const client = event.client;
|
|
4
|
-
if (command.ignore?.owner && client.settings.ownerId.includes(event.user.id))
|
|
5
|
-
return false;
|
|
4
|
+
if (command.ignore?.owner && client.settings.ownerId.includes(event.user.id)) return false;
|
|
6
5
|
if (!client.cache.cooldowns.has(`${event.user.id}-${command.name}`)) {
|
|
7
6
|
client.cache.cooldowns.set(`${event.user.id}-${command.name}`, {
|
|
8
7
|
id: event.user.id,
|
|
@@ -12,31 +11,21 @@ export default async function commandValidation(event, command) {
|
|
|
12
11
|
setTimeout(() => {
|
|
13
12
|
client.cache.cooldowns.delete(`${event.user.id}-${command.name}`);
|
|
14
13
|
}, command.cooldown || 0);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
14
|
+
} else {
|
|
17
15
|
const user = client.cache.cooldowns.get(`${event.user.id}-${command.name}`);
|
|
18
16
|
const time = (user?.createdTimestamp || 0) - Number(Date.now());
|
|
19
17
|
return emit(event, `Command on cooldown, ${time}`);
|
|
20
18
|
}
|
|
21
|
-
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
|
|
22
|
-
|
|
23
|
-
if ((command.ignore?.
|
|
24
|
-
|
|
25
|
-
if ((command.
|
|
26
|
-
|
|
27
|
-
if (command.strict?.
|
|
28
|
-
|
|
29
|
-
if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id))
|
|
30
|
-
return await emit(event, 'Command cannot be ran in this channel');
|
|
31
|
-
if ((command.strict?.guilds?.length || 0) > 0 && !command.strict?.guilds?.includes(event.guild?.id))
|
|
32
|
-
return await emit(event, 'Command cannot be ran in this guild');
|
|
33
|
-
if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id))
|
|
34
|
-
return await emit(event, 'Command cannot be ran by you');
|
|
35
|
-
if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM)
|
|
36
|
-
return await emit(event, "Can't use in a DM Channel");
|
|
19
|
+
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id)) return true;
|
|
20
|
+
if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id)) return true;
|
|
21
|
+
if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id)) return true;
|
|
22
|
+
if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id)) return await emit(event, 'Command is a developer command');
|
|
23
|
+
if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id)) return await emit(event, 'Command cannot be ran in this channel');
|
|
24
|
+
if ((command.strict?.guilds?.length || 0) > 0 && !command.strict?.guilds?.includes(event.guild?.id)) return await emit(event, 'Command cannot be ran in this guild');
|
|
25
|
+
if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id)) return await emit(event, 'Command cannot be ran by you');
|
|
26
|
+
if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM) return await emit(event, "Can't use in a DM Channel");
|
|
37
27
|
if (command.permissions?.user) {
|
|
38
|
-
if (!(event.member?.permissions).has(toBigInt(command.permissions.user)))
|
|
39
|
-
return await emit(event, 'Missing User Permissions');
|
|
28
|
+
if (!(event.member?.permissions).has(toBigInt(command.permissions.user))) return await emit(event, 'Missing User Permissions');
|
|
40
29
|
}
|
|
41
30
|
return false;
|
|
42
31
|
}
|
|
@@ -48,13 +37,14 @@ function toBigInt(permissions) {
|
|
|
48
37
|
let bigIntPermissions = 0n;
|
|
49
38
|
permissions.map((permission) => {
|
|
50
39
|
permission =
|
|
51
|
-
PermissionFlagsBits[
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
PermissionFlagsBits[
|
|
41
|
+
permission
|
|
42
|
+
.split(/ +/)
|
|
43
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
44
|
+
.join('')
|
|
45
|
+
];
|
|
46
|
+
if (typeof permission === 'bigint') bigIntPermissions += permission;
|
|
57
47
|
});
|
|
58
48
|
return bigIntPermissions;
|
|
59
49
|
}
|
|
60
|
-
//# sourceMappingURL=commandValidation.js.map
|
|
50
|
+
//# sourceMappingURL=commandValidation.js.map
|
|
@@ -2,5 +2,18 @@ import { ContextCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } fro
|
|
|
2
2
|
import { XernerxMessage } from '../types/extenders.js';
|
|
3
3
|
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
4
4
|
export declare function inhibitorValidation(event: XernerxMessage | XernerxInteraction, cmd?: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder): Promise<boolean>;
|
|
5
|
-
export declare function inhibitorArguments(
|
|
6
|
-
|
|
5
|
+
export declare function inhibitorArguments(
|
|
6
|
+
event: XernerxMessage | XernerxInteraction,
|
|
7
|
+
cmd: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder | null,
|
|
8
|
+
type: InhibitorType
|
|
9
|
+
):
|
|
10
|
+
| import('discord.js').Guild
|
|
11
|
+
| import('discord.js').GuildMember
|
|
12
|
+
| import('discord.js').TextBasedChannel
|
|
13
|
+
| import('discord.js').User
|
|
14
|
+
| SlashCommandBuilder
|
|
15
|
+
| ContextCommandBuilder
|
|
16
|
+
| MessageCommandBuilder
|
|
17
|
+
| import('../main.js').APIInteractionGuildMember
|
|
18
|
+
| null;
|
|
19
|
+
//# sourceMappingURL=inhibitorValidations.d.ts.map
|