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.
Files changed (73) hide show
  1. package/dist/build/ContextCommandBuilder.d.ts +31 -23
  2. package/dist/build/ContextCommandBuilder.js +39 -39
  3. package/dist/build/EventBuilder.d.ts +1 -1
  4. package/dist/build/EventBuilder.js +2 -2
  5. package/dist/build/InhibitorBuilder.d.ts +1 -1
  6. package/dist/build/InhibitorBuilder.js +2 -2
  7. package/dist/build/MessageCommandBuilder.d.ts +26 -20
  8. package/dist/build/MessageCommandBuilder.js +34 -34
  9. package/dist/build/SlashCommandBuilder.d.ts +31 -23
  10. package/dist/build/SlashCommandBuilder.js +48 -48
  11. package/dist/client/XernerxClient.d.ts +30 -22
  12. package/dist/client/XernerxClient.js +33 -33
  13. package/dist/client/XernerxShardClient.d.ts +1 -1
  14. package/dist/client/XernerxShardClient.d.ts.map +1 -1
  15. package/dist/client/XernerxShardClient.js +18 -12
  16. package/dist/client/XernerxShardClient.js.map +1 -1
  17. package/dist/functions/delay.d.ts +1 -1
  18. package/dist/functions/delay.js +1 -1
  19. package/dist/functions/deploy.d.ts +1 -1
  20. package/dist/functions/deploy.js +13 -16
  21. package/dist/functions/isOwner.d.ts +1 -1
  22. package/dist/functions/isOwner.js +1 -1
  23. package/dist/functions/isVoter.d.ts +1 -1
  24. package/dist/functions/isVoter.js +1 -1
  25. package/dist/functions/load.d.ts +1 -1
  26. package/dist/functions/load.js +2 -3
  27. package/dist/functions/reload.d.ts +1 -1
  28. package/dist/functions/reload.js +9 -12
  29. package/dist/functions/sendWebhook.d.ts +1 -1
  30. package/dist/functions/sendWebhook.js +2 -3
  31. package/dist/functions/setPresence.d.ts +2 -2
  32. package/dist/functions/setPresence.js +12 -11
  33. package/dist/functions/xernerxUser.d.ts +1 -1
  34. package/dist/functions/xernerxUser.js +1 -1
  35. package/dist/handlers/CommandHandler.d.ts +1 -1
  36. package/dist/handlers/CommandHandler.js +82 -105
  37. package/dist/handlers/EventHandler.d.ts +1 -1
  38. package/dist/handlers/EventHandler.js +3 -3
  39. package/dist/handlers/ExtensionHandler.d.ts +1 -1
  40. package/dist/handlers/ExtensionHandler.js +3 -5
  41. package/dist/handlers/Handler.d.ts +1 -1
  42. package/dist/handlers/Handler.js +6 -16
  43. package/dist/handlers/InhibitorHandler.d.ts +1 -1
  44. package/dist/handlers/InhibitorHandler.js +3 -3
  45. package/dist/handlers/WebhookHandler.d.ts +2 -4
  46. package/dist/handlers/WebhookHandler.js +9 -6
  47. package/dist/main.d.ts +29 -22
  48. package/dist/main.js +29 -22
  49. package/dist/models/Arguments.d.ts +1 -1
  50. package/dist/models/Arguments.js +48 -63
  51. package/dist/tools/XernerxError.d.ts +1 -1
  52. package/dist/tools/XernerxError.js +1 -1
  53. package/dist/tools/XernerxLog.d.ts +1 -1
  54. package/dist/tools/XernerxLog.js +7 -2
  55. package/dist/types/extenders.d.ts +5 -9
  56. package/dist/types/extenders.js +1 -1
  57. package/dist/types/interfaces.d.ts +9 -6
  58. package/dist/types/interfaces.js +1 -1
  59. package/dist/types/types.d.ts +174 -6
  60. package/dist/types/types.js +1 -1
  61. package/dist/utils/ClientUtil.d.ts +4 -4
  62. package/dist/utils/ClientUtil.js +8 -14
  63. package/dist/utils/InteractionUtil.d.ts +2 -2
  64. package/dist/utils/InteractionUtil.js +1 -1
  65. package/dist/utils/MessageUtil.d.ts +2 -2
  66. package/dist/utils/MessageUtil.js +5 -9
  67. package/dist/utils/Util.d.ts +1 -1
  68. package/dist/utils/Util.js +1 -1
  69. package/dist/validators/commandValidation.d.ts +1 -1
  70. package/dist/validators/commandValidation.js +19 -29
  71. package/dist/validators/inhibitorValidations.d.ts +15 -2
  72. package/dist/validators/inhibitorValidations.js +1 -1
  73. 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
- return true;
23
- if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id))
24
- return true;
25
- if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id))
26
- return true;
27
- if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id))
28
- return await emit(event, 'Command is a developer command');
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[permission
52
- .split(/ +/)
53
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
54
- .join('')];
55
- if (typeof permission === 'bigint')
56
- bigIntPermissions += permission;
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(event: XernerxMessage | XernerxInteraction, cmd: ContextCommandBuilder | MessageCommandBuilder | SlashCommandBuilder | null, type: InhibitorType): import("discord.js").Guild | import("discord.js").User | MessageCommandBuilder | SlashCommandBuilder | ContextCommandBuilder | import("discord.js").GuildMember | import("discord.js").TextBasedChannel | import("../main.js").APIInteractionGuildMember | null;
6
- //# sourceMappingURL=inhibitorValidations.d.ts.map
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
@@ -32,4 +32,4 @@ export function inhibitorArguments(event, cmd, type) {
32
32
  return event.user;
33
33
  }
34
34
  }
35
- //# sourceMappingURL=inhibitorValidations.js.map
35
+ //# sourceMappingURL=inhibitorValidations.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xernerx",
3
- "version": "4.4.13",
3
+ "version": "4.4.14",
4
4
  "description": "A bot framework for discord.js.",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",