xernerx 4.5.5 → 4.5.7

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 (106) hide show
  1. package/dist/build/XernerxContextCommand.d.ts +46 -44
  2. package/dist/build/XernerxContextCommand.js +64 -62
  3. package/dist/build/XernerxEvent.d.ts +16 -14
  4. package/dist/build/XernerxEvent.js +21 -19
  5. package/dist/build/XernerxInhibitor.d.ts +19 -17
  6. package/dist/build/XernerxInhibitor.js +13 -11
  7. package/dist/build/XernerxMessageCommand.d.ts +44 -42
  8. package/dist/build/XernerxMessageCommand.js +58 -56
  9. package/dist/build/XernerxSlashCommand.d.ts +56 -54
  10. package/dist/build/XernerxSlashCommand.js +110 -108
  11. package/dist/client/XernerxClient.d.ts +46 -44
  12. package/dist/client/XernerxClient.js +75 -73
  13. package/dist/client/XernerxShardClient.d.ts +12 -10
  14. package/dist/client/XernerxShardClient.js +50 -48
  15. package/dist/functions/deploy.d.ts +2 -0
  16. package/dist/functions/deploy.js +32 -30
  17. package/dist/functions/load.d.ts +2 -0
  18. package/dist/functions/load.js +29 -27
  19. package/dist/functions/reload.d.ts +2 -0
  20. package/dist/functions/reload.js +36 -34
  21. package/dist/functions/sendWebhook.d.ts +2 -0
  22. package/dist/functions/sendWebhook.js +12 -10
  23. package/dist/functions/setPresence.d.ts +2 -0
  24. package/dist/functions/setPresence.js +19 -17
  25. package/dist/functions/xernerxUser.d.ts +2 -0
  26. package/dist/functions/xernerxUser.js +10 -8
  27. package/dist/handlers/CommandHandler.d.ts +10 -8
  28. package/dist/handlers/CommandHandler.js +241 -239
  29. package/dist/handlers/EventHandler.d.ts +4 -2
  30. package/dist/handlers/EventHandler.js +20 -18
  31. package/dist/handlers/ExtensionHandler.d.ts +4 -2
  32. package/dist/handlers/ExtensionHandler.js +19 -17
  33. package/dist/handlers/Handler.d.ts +9 -7
  34. package/dist/handlers/Handler.js +33 -31
  35. package/dist/handlers/InhibitorHandler.d.ts +4 -2
  36. package/dist/handlers/InhibitorHandler.js +20 -18
  37. package/dist/handlers/WebhookHandler.d.ts +5 -3
  38. package/dist/handlers/WebhookHandler.js +48 -46
  39. package/dist/main.d.ts +28 -26
  40. package/dist/main.js +28 -26
  41. package/dist/models/Arguments.d.ts +4 -2
  42. package/dist/models/Arguments.js +136 -134
  43. package/dist/tools/XernerxError.d.ts +6 -4
  44. package/dist/tools/XernerxError.js +10 -8
  45. package/dist/tools/XernerxLog.d.ts +14 -12
  46. package/dist/tools/XernerxLog.js +77 -80
  47. package/dist/tools/XernerxLog.js.map +1 -1
  48. package/dist/types/extenders.d.ts +13 -11
  49. package/dist/types/extenders.js +2 -0
  50. package/dist/types/interfaces.d.ts +184 -172
  51. package/dist/types/interfaces.d.ts.map +1 -1
  52. package/dist/types/interfaces.js +2 -0
  53. package/dist/types/interfaces.js.map +1 -1
  54. package/dist/types/types.d.ts +173 -171
  55. package/dist/types/types.js +2 -0
  56. package/dist/utils/ClientUtil.d.ts +8 -5
  57. package/dist/utils/ClientUtil.d.ts.map +1 -1
  58. package/dist/utils/ClientUtil.js +45 -26
  59. package/dist/utils/ClientUtil.js.map +1 -1
  60. package/dist/utils/InteractionUtil.d.ts +11 -5
  61. package/dist/utils/InteractionUtil.d.ts.map +1 -1
  62. package/dist/utils/InteractionUtil.js +98 -8
  63. package/dist/utils/InteractionUtil.js.map +1 -1
  64. package/dist/utils/MessageUtil.d.ts +14 -9
  65. package/dist/utils/MessageUtil.d.ts.map +1 -1
  66. package/dist/utils/MessageUtil.js +131 -37
  67. package/dist/utils/MessageUtil.js.map +1 -1
  68. package/dist/utils/Util.d.ts +5 -3
  69. package/dist/utils/Util.js +9 -7
  70. package/dist/validators/commandValidation.d.ts +4 -2
  71. package/dist/validators/commandValidation.js +44 -42
  72. package/dist/validators/inhibitorValidations.d.ts +16 -14
  73. package/dist/validators/inhibitorValidations.js +32 -30
  74. package/package.json +1 -1
  75. package/dist/build/ContextCommandBuilder.d.ts +0 -51
  76. package/dist/build/ContextCommandBuilder.d.ts.map +0 -1
  77. package/dist/build/ContextCommandBuilder.js +0 -68
  78. package/dist/build/ContextCommandBuilder.js.map +0 -1
  79. package/dist/build/EventBuilder.d.ts +0 -25
  80. package/dist/build/EventBuilder.d.ts.map +0 -1
  81. package/dist/build/EventBuilder.js +0 -30
  82. package/dist/build/EventBuilder.js.map +0 -1
  83. package/dist/build/InhibitorBuilder.d.ts +0 -29
  84. package/dist/build/InhibitorBuilder.d.ts.map +0 -1
  85. package/dist/build/InhibitorBuilder.js +0 -21
  86. package/dist/build/InhibitorBuilder.js.map +0 -1
  87. package/dist/build/MessageCommandBuilder.d.ts +0 -48
  88. package/dist/build/MessageCommandBuilder.d.ts.map +0 -1
  89. package/dist/build/MessageCommandBuilder.js +0 -61
  90. package/dist/build/MessageCommandBuilder.js.map +0 -1
  91. package/dist/build/SlashCommandBuilder.d.ts +0 -62
  92. package/dist/build/SlashCommandBuilder.d.ts.map +0 -1
  93. package/dist/build/SlashCommandBuilder.js +0 -114
  94. package/dist/build/SlashCommandBuilder.js.map +0 -1
  95. package/dist/functions/delay.d.ts +0 -2
  96. package/dist/functions/delay.d.ts.map +0 -1
  97. package/dist/functions/delay.js +0 -4
  98. package/dist/functions/delay.js.map +0 -1
  99. package/dist/functions/isOwner.d.ts +0 -4
  100. package/dist/functions/isOwner.d.ts.map +0 -1
  101. package/dist/functions/isOwner.js +0 -2
  102. package/dist/functions/isOwner.js.map +0 -1
  103. package/dist/functions/isVoter.d.ts +0 -4
  104. package/dist/functions/isVoter.d.ts.map +0 -1
  105. package/dist/functions/isVoter.js +0 -6
  106. package/dist/functions/isVoter.js.map +0 -1
@@ -1,62 +1,64 @@
1
+ /** @format */
2
+
1
3
  import Discord from 'discord.js';
2
4
  import XernerxClient from '../client/XernerxClient.js';
3
5
  import { XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
4
6
  import { SlashCommandArguments, SlashCommandOptions } from '../types/interfaces.js';
5
7
  import { XernerxInteraction } from '../types/types.js';
6
8
  export default class XernerxSlashCommand {
7
- readonly id: string;
8
- readonly data: Discord.SlashCommandBuilder;
9
- readonly name: string;
10
- readonly description: string;
11
- readonly usage: string | null | undefined;
12
- readonly info: string | null | undefined;
13
- readonly category: string | null | undefined;
14
- readonly cooldown: number | null | undefined;
15
- readonly ignore:
16
- | {
17
- owner?: boolean | undefined;
18
- users?: string[] | undefined;
19
- channels?: string[] | undefined;
20
- guilds?: string[] | undefined;
21
- }
22
- | undefined;
23
- readonly strict:
24
- | {
25
- owner?: boolean | undefined;
26
- users?: string[] | undefined;
27
- channels?: string[] | undefined;
28
- guilds?: string[] | undefined;
29
- }
30
- | undefined;
31
- readonly permissions:
32
- | {
33
- user?: string[] | import('../types/types.js').PermissionNames[] | undefined;
34
- client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
35
- dm?: boolean | undefined;
36
- }
37
- | undefined;
38
- readonly defer:
39
- | {
40
- reply?: boolean | undefined;
41
- ephemeral?: boolean | undefined;
42
- fetchReply?: boolean | undefined;
43
- }
44
- | undefined;
45
- readonly fileType: 'SlashCommand';
46
- readonly filePath: string;
47
- readonly client: typeof XernerxClient;
48
- constructor(id: string, options: SlashCommandOptions);
49
- autocomplete<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, focused: T, options: T[]): Promise<void | any | T>;
50
- conditions<T>(
51
- interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
52
- { args, subcommand, group }: SlashCommandArguments
53
- ): Promise<void | any | T>;
54
- exec<T>(
55
- interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
56
- { args, subcommand, group }: SlashCommandArguments
57
- ): Promise<void | any | T>;
58
- private addArguments;
59
- private addSubcommands;
60
- private addSubcommandGroups;
9
+ readonly id: string;
10
+ readonly data: Discord.SlashCommandBuilder;
11
+ readonly name: string;
12
+ readonly description: string;
13
+ readonly usage: string | null | undefined;
14
+ readonly info: string | null | undefined;
15
+ readonly category: string | null | undefined;
16
+ readonly cooldown: number | null | undefined;
17
+ readonly ignore:
18
+ | {
19
+ owner?: boolean | undefined;
20
+ users?: string[] | undefined;
21
+ channels?: string[] | undefined;
22
+ guilds?: string[] | undefined;
23
+ }
24
+ | undefined;
25
+ readonly strict:
26
+ | {
27
+ owner?: boolean | undefined;
28
+ users?: string[] | undefined;
29
+ channels?: string[] | undefined;
30
+ guilds?: string[] | undefined;
31
+ }
32
+ | undefined;
33
+ readonly permissions:
34
+ | {
35
+ user?: string[] | import('../types/types.js').PermissionNames[] | undefined;
36
+ client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
37
+ dm?: boolean | undefined;
38
+ }
39
+ | undefined;
40
+ readonly defer:
41
+ | {
42
+ reply?: boolean | undefined;
43
+ ephemeral?: boolean | undefined;
44
+ fetchReply?: boolean | undefined;
45
+ }
46
+ | undefined;
47
+ readonly fileType: 'SlashCommand';
48
+ readonly filePath: string;
49
+ readonly client: typeof XernerxClient;
50
+ constructor(id: string, options: SlashCommandOptions);
51
+ autocomplete<T>(interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, focused: T, options: T[]): Promise<void | any | T>;
52
+ conditions<T>(
53
+ interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
54
+ { args, subcommand, group }: SlashCommandArguments
55
+ ): Promise<void | any | T>;
56
+ exec<T>(
57
+ interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
58
+ { args, subcommand, group }: SlashCommandArguments
59
+ ): Promise<void | any | T>;
60
+ private addArguments;
61
+ private addSubcommands;
62
+ private addSubcommandGroups;
61
63
  }
62
64
  //# sourceMappingURL=XernerxSlashCommand.d.ts.map
@@ -1,114 +1,116 @@
1
+ /** @format */
2
+
1
3
  import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from 'discord.js';
2
4
  import { z } from 'zod';
3
5
  import XernerxClient from '../client/XernerxClient.js';
4
6
  export default class XernerxSlashCommand {
5
- constructor(id, options) {
6
- this.id = id;
7
- this.data = new Discord.SlashCommandBuilder();
8
- this.data.setName(options.name);
9
- this.data.setNameLocalizations(options.nameLocalizations || null);
10
- this.data.setDescription(options.description);
11
- this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
12
- this.data.setDMPermission(options.permissions?.dm || null);
13
- if (options.args && options?.args?.length > 0) {
14
- this.addArguments(this.data, options.args);
15
- }
16
- if (options.subcommands && options?.subcommands?.length > 0) {
17
- this.addSubcommands(this.data, options.subcommands);
18
- }
19
- if (options.groups && options?.groups?.length > 0) {
20
- this.addSubcommandGroups(options.groups);
21
- }
22
- options = z
23
- .object({
24
- name: z.string(),
25
- description: z.string(),
26
- usage: z.string().or(z.null()).default(null),
27
- info: z.string().or(z.null()).default(null),
28
- category: z.string().or(z.null()).default(null),
29
- number: z.number().or(z.null()).default(null),
30
- channelType: z.array(z.number()).or(z.null()).default(null),
31
- ignore: z
32
- .object({
33
- owner: z.boolean().default(false),
34
- users: z.array(z.string()).default([]),
35
- channels: z.array(z.string()).default([]),
36
- guilds: z.array(z.string()).default([]),
37
- })
38
- .default({}),
39
- strict: z
40
- .object({
41
- owner: z.boolean().default(false),
42
- users: z.array(z.string()).default([]),
43
- channels: z.array(z.string()).default([]),
44
- guilds: z.array(z.string()).default([]),
45
- })
46
- .default({}),
47
- permissions: z
48
- .object({
49
- user: z.array(z.string()).default([]),
50
- client: z.array(z.string()).default([]),
51
- dm: z.boolean().default(true),
52
- })
53
- .default({}),
54
- defer: z
55
- .object({
56
- reply: z.boolean().default(false),
57
- ephemeral: z.boolean().default(false),
58
- fetch: z.boolean().default(false),
59
- })
60
- .default({}),
61
- })
62
- .parse(options);
63
- this.name = options.name;
64
- this.description = options.description;
65
- this.usage = options.usage;
66
- this.info = options.info;
67
- this.category = options.category;
68
- this.cooldown = options.cooldown;
69
- this.ignore = options.ignore;
70
- this.strict = options.strict;
71
- this.permissions = options.permissions;
72
- this.defer = options.defer;
73
- this.client = XernerxClient;
74
- }
75
- async autocomplete(interaction, focused, options) {}
76
- async conditions(interaction, { args, subcommand, group }) {}
77
- async exec(interaction, { args, subcommand, group }) {}
78
- addArguments(command, args) {
79
- for (const argument of args) {
80
- let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
81
- command[`add${slashCommandArgumentType}Option`]((option) => {
82
- option
83
- .setName(argument.name)
84
- .setDescription(argument.description)
85
- .setRequired(argument.required || false);
86
- if (slashCommandArgumentType === 'String') {
87
- if (argument.choices)
88
- option.setChoices(
89
- ...argument.choices.map((choices) => {
90
- return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
91
- })
92
- );
93
- option.setAutocomplete(argument.autocomplete || false);
94
- }
95
- return option;
96
- });
97
- }
98
- }
99
- addSubcommands(method, subcommands) {
100
- for (const subcommand of subcommands) {
101
- let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
102
- if (subcommand.args && subcommand?.args?.length > 0) this.addArguments(sub, subcommand.args);
103
- method.addSubcommand(sub);
104
- }
105
- }
106
- addSubcommandGroups(groups) {
107
- for (const group of groups) {
108
- let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
109
- if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
110
- this.data.addSubcommandGroup(subcommandGroup);
111
- }
112
- }
7
+ constructor(id, options) {
8
+ this.id = id;
9
+ this.data = new Discord.SlashCommandBuilder();
10
+ this.data.setName(options.name);
11
+ this.data.setNameLocalizations(options.nameLocalizations || null);
12
+ this.data.setDescription(options.description);
13
+ this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
14
+ this.data.setDMPermission(options.permissions?.dm || null);
15
+ if (options.args && options?.args?.length > 0) {
16
+ this.addArguments(this.data, options.args);
17
+ }
18
+ if (options.subcommands && options?.subcommands?.length > 0) {
19
+ this.addSubcommands(this.data, options.subcommands);
20
+ }
21
+ if (options.groups && options?.groups?.length > 0) {
22
+ this.addSubcommandGroups(options.groups);
23
+ }
24
+ options = z
25
+ .object({
26
+ name: z.string(),
27
+ description: z.string(),
28
+ usage: z.string().or(z.null()).default(null),
29
+ info: z.string().or(z.null()).default(null),
30
+ category: z.string().or(z.null()).default(null),
31
+ number: z.number().or(z.null()).default(null),
32
+ channelType: z.array(z.number()).or(z.null()).default(null),
33
+ ignore: z
34
+ .object({
35
+ owner: z.boolean().default(false),
36
+ users: z.array(z.string()).default([]),
37
+ channels: z.array(z.string()).default([]),
38
+ guilds: z.array(z.string()).default([]),
39
+ })
40
+ .default({}),
41
+ strict: z
42
+ .object({
43
+ owner: z.boolean().default(false),
44
+ users: z.array(z.string()).default([]),
45
+ channels: z.array(z.string()).default([]),
46
+ guilds: z.array(z.string()).default([]),
47
+ })
48
+ .default({}),
49
+ permissions: z
50
+ .object({
51
+ user: z.array(z.string()).default([]),
52
+ client: z.array(z.string()).default([]),
53
+ dm: z.boolean().default(true),
54
+ })
55
+ .default({}),
56
+ defer: z
57
+ .object({
58
+ reply: z.boolean().default(false),
59
+ ephemeral: z.boolean().default(false),
60
+ fetch: z.boolean().default(false),
61
+ })
62
+ .default({}),
63
+ })
64
+ .parse(options);
65
+ this.name = options.name;
66
+ this.description = options.description;
67
+ this.usage = options.usage;
68
+ this.info = options.info;
69
+ this.category = options.category;
70
+ this.cooldown = options.cooldown;
71
+ this.ignore = options.ignore;
72
+ this.strict = options.strict;
73
+ this.permissions = options.permissions;
74
+ this.defer = options.defer;
75
+ this.client = XernerxClient;
76
+ }
77
+ async autocomplete(interaction, focused, options) {}
78
+ async conditions(interaction, { args, subcommand, group }) {}
79
+ async exec(interaction, { args, subcommand, group }) {}
80
+ addArguments(command, args) {
81
+ for (const argument of args) {
82
+ let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
83
+ command[`add${slashCommandArgumentType}Option`]((option) => {
84
+ option
85
+ .setName(argument.name)
86
+ .setDescription(argument.description)
87
+ .setRequired(argument.required || false);
88
+ if (slashCommandArgumentType === 'String') {
89
+ if (argument.choices)
90
+ option.setChoices(
91
+ ...argument.choices.map((choices) => {
92
+ return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
93
+ })
94
+ );
95
+ option.setAutocomplete(argument.autocomplete || false);
96
+ }
97
+ return option;
98
+ });
99
+ }
100
+ }
101
+ addSubcommands(method, subcommands) {
102
+ for (const subcommand of subcommands) {
103
+ let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
104
+ if (subcommand.args && subcommand?.args?.length > 0) this.addArguments(sub, subcommand.args);
105
+ method.addSubcommand(sub);
106
+ }
107
+ }
108
+ addSubcommandGroups(groups) {
109
+ for (const group of groups) {
110
+ let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
111
+ if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
112
+ this.data.addSubcommandGroup(subcommandGroup);
113
+ }
114
+ }
113
115
  }
114
116
  //# sourceMappingURL=XernerxSlashCommand.js.map
@@ -1,51 +1,53 @@
1
+ /** @format */
2
+
1
3
  import { Client, ClientOptions, Collection } from 'discord.js';
2
4
  import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';
3
5
  import ClientUtil from '../utils/ClientUtil.js';
4
6
  import { XernerxInhibitor, XernerxEvent } from '../main.js';
5
7
  export default class XernerxClient<T = unknown> extends Client {
6
- readonly settings: {
7
- ownerId: (string | string[]) & (string | string[] | undefined);
8
- local: string;
9
- global?: boolean | undefined;
10
- permissions?:
11
- | {
12
- client: string[];
13
- user: string[];
14
- dm: boolean;
15
- }
16
- | undefined;
17
- ignore?:
18
- | {
19
- owner: boolean;
20
- users: string[];
21
- channels: string[];
22
- guilds: string[];
23
- }
24
- | undefined;
25
- log?:
26
- | {
27
- ready: boolean;
28
- error: boolean;
29
- info: boolean;
30
- table: string[] | null;
31
- }
32
- | undefined;
33
- cooldown?:
34
- | {
35
- command: number;
36
- cache: number;
37
- }
38
- | undefined;
39
- };
40
- readonly config: NonNullable<T> | null;
41
- readonly commands: XernerxCommands;
42
- readonly events: Collection<string, XernerxEvent>;
43
- readonly inhibitors: Collection<string, XernerxInhibitor>;
44
- readonly modules: ModuleOptions;
45
- readonly util: ClientUtil;
46
- readonly stats: Record<string, number>;
47
- readonly cache: XernerxCache;
48
- constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
49
- connect(token: string): Promise<string>;
8
+ readonly settings: {
9
+ ownerId: (string | string[]) & (string | string[] | undefined);
10
+ local: string;
11
+ global?: boolean | undefined;
12
+ permissions?:
13
+ | {
14
+ client: string[];
15
+ user: string[];
16
+ dm: boolean;
17
+ }
18
+ | undefined;
19
+ ignore?:
20
+ | {
21
+ owner: boolean;
22
+ users: string[];
23
+ channels: string[];
24
+ guilds: string[];
25
+ }
26
+ | undefined;
27
+ log?:
28
+ | {
29
+ ready: boolean;
30
+ error: boolean;
31
+ info: boolean;
32
+ table: string[] | null;
33
+ }
34
+ | undefined;
35
+ cooldown?:
36
+ | {
37
+ command: number;
38
+ cache: number;
39
+ }
40
+ | undefined;
41
+ };
42
+ readonly config: NonNullable<T> | null;
43
+ readonly commands: XernerxCommands;
44
+ readonly events: Collection<string, XernerxEvent>;
45
+ readonly inhibitors: Collection<string, XernerxInhibitor>;
46
+ readonly modules: ModuleOptions;
47
+ readonly util: ClientUtil;
48
+ readonly stats: Record<string, number>;
49
+ readonly cache: XernerxCache;
50
+ constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
51
+ connect(token: string): Promise<string>;
50
52
  }
51
53
  //# sourceMappingURL=XernerxClient.d.ts.map
@@ -1,3 +1,5 @@
1
+ /** @format */
2
+
1
3
  import { Client, Collection } from 'discord.js';
2
4
  import { z } from 'zod';
3
5
  import CommandHandler from '../handlers/CommandHandler.js';
@@ -9,78 +11,78 @@ import ClientUtil from '../utils/ClientUtil.js';
9
11
  import ExtensionHandler from '../handlers/ExtensionHandler.js';
10
12
  import deploy from '../functions/deploy.js';
11
13
  export default class XernerxClient extends Client {
12
- constructor(discordOptions, xernerxOptions, config) {
13
- super(discordOptions);
14
- this.settings = z
15
- .object({
16
- local: z.string(),
17
- global: z.boolean().default(false).optional(),
18
- ownerId: z.string().or(z.array(z.string())).default([]),
19
- permissions: z
20
- .object({
21
- client: z.array(z.string()).default([]),
22
- user: z.array(z.string()).default([]),
23
- dm: z.boolean().default(false),
24
- })
25
- .optional(),
26
- ignore: z
27
- .object({
28
- owner: z.boolean().default(false),
29
- users: z.array(z.string()).default([]),
30
- channels: z.array(z.string()).default([]),
31
- guilds: z.array(z.string()).default([]),
32
- })
33
- .optional(),
34
- log: z
35
- .object({
36
- ready: z.boolean().default(false),
37
- info: z.boolean().default(false),
38
- error: z.boolean().default(false),
39
- table: z.array(z.string()).or(z.null()).default(null),
40
- })
41
- .optional(),
42
- cooldown: z
43
- .object({
44
- command: z.number().default(0),
45
- cache: z.number().default(0),
46
- })
47
- .optional(),
48
- })
49
- .parse(xernerxOptions);
50
- this.config = config || null;
51
- this.commands = {
52
- message: new Collection(),
53
- slash: new Collection(),
54
- context: new Collection(),
55
- };
56
- this.events = new Collection();
57
- this.inhibitors = new Collection();
58
- this.modules = {
59
- options: {},
60
- commandHandler: new CommandHandler(this),
61
- eventHandler: new EventHandler(this),
62
- inhibitorHandler: new InhibitorHandler(this),
63
- webhookHandler: new WebhookHandler(this),
64
- extensionHandler: new ExtensionHandler(this),
65
- };
66
- this.util = new ClientUtil(this);
67
- this.stats = {
68
- guildCount: this.guilds.cache.size,
69
- userCount: 0,
70
- shardId: 0,
71
- shardCount: 1,
72
- };
73
- this.cache = {
74
- messages: new Collection(),
75
- cooldowns: new Collection(),
76
- };
77
- return this;
78
- }
79
- async connect(token) {
80
- const login = this.login(token);
81
- deploy(this);
82
- new XernerxLog(this).ready();
83
- return login;
84
- }
14
+ constructor(discordOptions, xernerxOptions, config) {
15
+ super(discordOptions);
16
+ this.settings = z
17
+ .object({
18
+ local: z.string(),
19
+ global: z.boolean().default(false).optional(),
20
+ ownerId: z.string().or(z.array(z.string())).default([]),
21
+ permissions: z
22
+ .object({
23
+ client: z.array(z.string()).default([]),
24
+ user: z.array(z.string()).default([]),
25
+ dm: z.boolean().default(false),
26
+ })
27
+ .optional(),
28
+ ignore: z
29
+ .object({
30
+ owner: z.boolean().default(false),
31
+ users: z.array(z.string()).default([]),
32
+ channels: z.array(z.string()).default([]),
33
+ guilds: z.array(z.string()).default([]),
34
+ })
35
+ .optional(),
36
+ log: z
37
+ .object({
38
+ ready: z.boolean().default(false),
39
+ info: z.boolean().default(false),
40
+ error: z.boolean().default(false),
41
+ table: z.array(z.string()).or(z.null()).default(null),
42
+ })
43
+ .optional(),
44
+ cooldown: z
45
+ .object({
46
+ command: z.number().default(0),
47
+ cache: z.number().default(0),
48
+ })
49
+ .optional(),
50
+ })
51
+ .parse(xernerxOptions);
52
+ this.config = config || null;
53
+ this.commands = {
54
+ message: new Collection(),
55
+ slash: new Collection(),
56
+ context: new Collection(),
57
+ };
58
+ this.events = new Collection();
59
+ this.inhibitors = new Collection();
60
+ this.modules = {
61
+ options: {},
62
+ commandHandler: new CommandHandler(this),
63
+ eventHandler: new EventHandler(this),
64
+ inhibitorHandler: new InhibitorHandler(this),
65
+ webhookHandler: new WebhookHandler(this),
66
+ extensionHandler: new ExtensionHandler(this),
67
+ };
68
+ this.util = new ClientUtil(this);
69
+ this.stats = {
70
+ guildCount: this.guilds.cache.size,
71
+ userCount: 0,
72
+ shardId: 0,
73
+ shardCount: 1,
74
+ };
75
+ this.cache = {
76
+ messages: new Collection(),
77
+ cooldowns: new Collection(),
78
+ };
79
+ return this;
80
+ }
81
+ async connect(token) {
82
+ const login = this.login(token);
83
+ deploy(this);
84
+ new XernerxLog(this).ready();
85
+ return login;
86
+ }
85
87
  }
86
88
  //# sourceMappingURL=XernerxClient.js.map
@@ -1,17 +1,19 @@
1
+ /** @format */
2
+
1
3
  import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
2
4
  interface XernerxOptions {
3
- log?: {
4
- info?: boolean;
5
- };
5
+ log?: {
6
+ info?: boolean;
7
+ };
6
8
  }
7
9
  export default class XernerxShardClient extends ShardingManager {
8
- readonly stats: {
9
- guildCount: number;
10
- userCount: number;
11
- shardCount: number;
12
- };
13
- user: ClientUser | null;
14
- constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
10
+ readonly stats: {
11
+ guildCount: number;
12
+ userCount: number;
13
+ shardCount: number;
14
+ };
15
+ user: ClientUser | null;
16
+ constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
15
17
  }
16
18
  export {};
17
19
  //# sourceMappingURL=XernerxShardClient.d.ts.map