xernerx 4.5.6 → 4.5.8

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 (129) hide show
  1. package/dist/build/XernerxContextCommand.d.ts +46 -46
  2. package/dist/build/XernerxContextCommand.d.ts.map +1 -1
  3. package/dist/build/XernerxContextCommand.js +63 -63
  4. package/dist/build/XernerxContextCommand.js.map +1 -1
  5. package/dist/build/XernerxEvent.d.ts +16 -15
  6. package/dist/build/XernerxEvent.d.ts.map +1 -1
  7. package/dist/build/XernerxEvent.js +20 -20
  8. package/dist/build/XernerxEvent.js.map +1 -1
  9. package/dist/build/XernerxInhibitor.d.ts +19 -19
  10. package/dist/build/XernerxInhibitor.d.ts.map +1 -1
  11. package/dist/build/XernerxInhibitor.js +12 -12
  12. package/dist/build/XernerxInhibitor.js.map +1 -1
  13. package/dist/build/XernerxMessageCommand.d.ts +44 -44
  14. package/dist/build/XernerxMessageCommand.d.ts.map +1 -1
  15. package/dist/build/XernerxMessageCommand.js +57 -57
  16. package/dist/build/XernerxMessageCommand.js.map +1 -1
  17. package/dist/build/XernerxSlashCommand.d.ts +56 -56
  18. package/dist/build/XernerxSlashCommand.d.ts.map +1 -1
  19. package/dist/build/XernerxSlashCommand.js +109 -109
  20. package/dist/build/XernerxSlashCommand.js.map +1 -1
  21. package/dist/client/XernerxClient.d.ts +45 -44
  22. package/dist/client/XernerxClient.d.ts.map +1 -1
  23. package/dist/client/XernerxClient.js +74 -73
  24. package/dist/client/XernerxClient.js.map +1 -1
  25. package/dist/client/XernerxShardClient.d.ts +11 -10
  26. package/dist/client/XernerxShardClient.d.ts.map +1 -1
  27. package/dist/client/XernerxShardClient.js +49 -48
  28. package/dist/client/XernerxShardClient.js.map +1 -1
  29. package/dist/functions/deploy.d.ts +1 -0
  30. package/dist/functions/deploy.d.ts.map +1 -1
  31. package/dist/functions/deploy.js +31 -30
  32. package/dist/functions/deploy.js.map +1 -1
  33. package/dist/functions/load.d.ts +1 -0
  34. package/dist/functions/load.d.ts.map +1 -1
  35. package/dist/functions/load.js +28 -27
  36. package/dist/functions/load.js.map +1 -1
  37. package/dist/functions/reload.d.ts +1 -0
  38. package/dist/functions/reload.d.ts.map +1 -1
  39. package/dist/functions/reload.js +35 -34
  40. package/dist/functions/reload.js.map +1 -1
  41. package/dist/functions/sendWebhook.d.ts +1 -0
  42. package/dist/functions/sendWebhook.d.ts.map +1 -1
  43. package/dist/functions/sendWebhook.js +11 -10
  44. package/dist/functions/sendWebhook.js.map +1 -1
  45. package/dist/functions/setPresence.d.ts +1 -0
  46. package/dist/functions/setPresence.d.ts.map +1 -1
  47. package/dist/functions/setPresence.js +18 -17
  48. package/dist/functions/setPresence.js.map +1 -1
  49. package/dist/functions/xernerxUser.d.ts +1 -0
  50. package/dist/functions/xernerxUser.d.ts.map +1 -1
  51. package/dist/functions/xernerxUser.js +6 -8
  52. package/dist/functions/xernerxUser.js.map +1 -1
  53. package/dist/handlers/CommandHandler.d.ts +9 -8
  54. package/dist/handlers/CommandHandler.d.ts.map +1 -1
  55. package/dist/handlers/CommandHandler.js +240 -239
  56. package/dist/handlers/CommandHandler.js.map +1 -1
  57. package/dist/handlers/EventHandler.d.ts +3 -2
  58. package/dist/handlers/EventHandler.d.ts.map +1 -1
  59. package/dist/handlers/EventHandler.js +19 -18
  60. package/dist/handlers/EventHandler.js.map +1 -1
  61. package/dist/handlers/ExtensionHandler.d.ts +3 -2
  62. package/dist/handlers/ExtensionHandler.d.ts.map +1 -1
  63. package/dist/handlers/ExtensionHandler.js +18 -17
  64. package/dist/handlers/ExtensionHandler.js.map +1 -1
  65. package/dist/handlers/Handler.d.ts +8 -7
  66. package/dist/handlers/Handler.d.ts.map +1 -1
  67. package/dist/handlers/Handler.js +32 -31
  68. package/dist/handlers/Handler.js.map +1 -1
  69. package/dist/handlers/InhibitorHandler.d.ts +3 -2
  70. package/dist/handlers/InhibitorHandler.d.ts.map +1 -1
  71. package/dist/handlers/InhibitorHandler.js +19 -18
  72. package/dist/handlers/InhibitorHandler.js.map +1 -1
  73. package/dist/handlers/WebhookHandler.d.ts +4 -3
  74. package/dist/handlers/WebhookHandler.d.ts.map +1 -1
  75. package/dist/handlers/WebhookHandler.js +47 -46
  76. package/dist/handlers/WebhookHandler.js.map +1 -1
  77. package/dist/main.d.ts +27 -26
  78. package/dist/main.d.ts.map +1 -1
  79. package/dist/main.js +27 -26
  80. package/dist/main.js.map +1 -1
  81. package/dist/models/Arguments.d.ts +3 -2
  82. package/dist/models/Arguments.d.ts.map +1 -1
  83. package/dist/models/Arguments.js +135 -134
  84. package/dist/models/Arguments.js.map +1 -1
  85. package/dist/tools/XernerxError.d.ts +5 -4
  86. package/dist/tools/XernerxError.d.ts.map +1 -1
  87. package/dist/tools/XernerxError.js +9 -8
  88. package/dist/tools/XernerxError.js.map +1 -1
  89. package/dist/tools/XernerxLog.d.ts +13 -12
  90. package/dist/tools/XernerxLog.d.ts.map +1 -1
  91. package/dist/tools/XernerxLog.js +76 -80
  92. package/dist/tools/XernerxLog.js.map +1 -1
  93. package/dist/types/extenders.d.ts +43 -12
  94. package/dist/types/extenders.d.ts.map +1 -1
  95. package/dist/types/extenders.js +1 -0
  96. package/dist/types/extenders.js.map +1 -1
  97. package/dist/types/interfaces.d.ts +186 -172
  98. package/dist/types/interfaces.d.ts.map +1 -1
  99. package/dist/types/interfaces.js +1 -0
  100. package/dist/types/interfaces.js.map +1 -1
  101. package/dist/types/types.d.ts +172 -171
  102. package/dist/types/types.d.ts.map +1 -1
  103. package/dist/types/types.js +1 -0
  104. package/dist/types/types.js.map +1 -1
  105. package/dist/utils/ClientUtil.d.ts +13 -6
  106. package/dist/utils/ClientUtil.d.ts.map +1 -1
  107. package/dist/utils/ClientUtil.js +56 -26
  108. package/dist/utils/ClientUtil.js.map +1 -1
  109. package/dist/utils/InteractionUtil.d.ts +10 -5
  110. package/dist/utils/InteractionUtil.d.ts.map +1 -1
  111. package/dist/utils/InteractionUtil.js +97 -8
  112. package/dist/utils/InteractionUtil.js.map +1 -1
  113. package/dist/utils/MessageUtil.d.ts +13 -9
  114. package/dist/utils/MessageUtil.d.ts.map +1 -1
  115. package/dist/utils/MessageUtil.js +130 -37
  116. package/dist/utils/MessageUtil.js.map +1 -1
  117. package/dist/utils/Util.d.ts +4 -3
  118. package/dist/utils/Util.d.ts.map +1 -1
  119. package/dist/utils/Util.js +8 -7
  120. package/dist/utils/Util.js.map +1 -1
  121. package/dist/validators/commandValidation.d.ts +3 -2
  122. package/dist/validators/commandValidation.d.ts.map +1 -1
  123. package/dist/validators/commandValidation.js +43 -42
  124. package/dist/validators/commandValidation.js.map +1 -1
  125. package/dist/validators/inhibitorValidations.d.ts +15 -14
  126. package/dist/validators/inhibitorValidations.d.ts.map +1 -1
  127. package/dist/validators/inhibitorValidations.js +31 -30
  128. package/dist/validators/inhibitorValidations.js.map +1 -1
  129. package/package.json +1 -1
@@ -1,51 +1,52 @@
1
+ /** @format */
1
2
  import { Client, ClientOptions, Collection } from 'discord.js';
2
3
  import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';
3
4
  import ClientUtil from '../utils/ClientUtil.js';
4
5
  import { XernerxInhibitor, XernerxEvent } from '../main.js';
5
6
  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>;
7
+ readonly settings: {
8
+ ownerId: (string | string[]) & (string | string[] | undefined);
9
+ local: string;
10
+ global?: boolean | undefined;
11
+ permissions?:
12
+ | {
13
+ client: string[];
14
+ user: string[];
15
+ dm: boolean;
16
+ }
17
+ | undefined;
18
+ ignore?:
19
+ | {
20
+ owner: boolean;
21
+ users: string[];
22
+ channels: string[];
23
+ guilds: string[];
24
+ }
25
+ | undefined;
26
+ log?:
27
+ | {
28
+ ready: boolean;
29
+ error: boolean;
30
+ info: boolean;
31
+ table: string[] | null;
32
+ }
33
+ | undefined;
34
+ cooldown?:
35
+ | {
36
+ command: number;
37
+ cache: number;
38
+ }
39
+ | undefined;
40
+ };
41
+ readonly config: NonNullable<T> | null;
42
+ readonly commands: XernerxCommands;
43
+ readonly events: Collection<string, XernerxEvent>;
44
+ readonly inhibitors: Collection<string, XernerxInhibitor>;
45
+ readonly modules: ModuleOptions;
46
+ readonly util: ClientUtil;
47
+ readonly stats: Record<string, number>;
48
+ readonly cache: XernerxCache;
49
+ constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T);
50
+ connect(token: string): Promise<string>;
50
51
  }
51
52
  //# sourceMappingURL=XernerxClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"XernerxClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ/D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,UAAU,MAAM,wBAAwB,CA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;IAC/B,SAAwB,QAAQ,EAAE,eAAe,CAAC;IAClD,SAAwB,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACjE,SAAwB,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACzE,SAAwB,OAAO,EAAE,aAAa,CAAC;IAC/C,SAAwB,IAAI,EAAE,UAAU,CAAC;IACzC,SAAwB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,SAAwB,KAAK,EAAE,YAAY,CAAC;gBAEzB,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC;IA8E/E,OAAO,CAAC,KAAK,EAAE,MAAM;CASlC"}
@@ -1,3 +1,4 @@
1
+ /** @format */
1
2
  import { Client, Collection } from 'discord.js';
2
3
  import { z } from 'zod';
3
4
  import CommandHandler from '../handlers/CommandHandler.js';
@@ -9,78 +10,78 @@ import ClientUtil from '../utils/ClientUtil.js';
9
10
  import ExtensionHandler from '../handlers/ExtensionHandler.js';
10
11
  import deploy from '../functions/deploy.js';
11
12
  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
- }
13
+ constructor(discordOptions, xernerxOptions, config) {
14
+ super(discordOptions);
15
+ this.settings = z
16
+ .object({
17
+ local: z.string(),
18
+ global: z.boolean().default(false).optional(),
19
+ ownerId: z.string().or(z.array(z.string())).default([]),
20
+ permissions: z
21
+ .object({
22
+ client: z.array(z.string()).default([]),
23
+ user: z.array(z.string()).default([]),
24
+ dm: z.boolean().default(false),
25
+ })
26
+ .optional(),
27
+ ignore: z
28
+ .object({
29
+ owner: z.boolean().default(false),
30
+ users: z.array(z.string()).default([]),
31
+ channels: z.array(z.string()).default([]),
32
+ guilds: z.array(z.string()).default([]),
33
+ })
34
+ .optional(),
35
+ log: z
36
+ .object({
37
+ ready: z.boolean().default(false),
38
+ info: z.boolean().default(false),
39
+ error: z.boolean().default(false),
40
+ table: z.array(z.string()).or(z.null()).default(null),
41
+ })
42
+ .optional(),
43
+ cooldown: z
44
+ .object({
45
+ command: z.number().default(0),
46
+ cache: z.number().default(0),
47
+ })
48
+ .optional(),
49
+ })
50
+ .parse(xernerxOptions);
51
+ this.config = config || null;
52
+ this.commands = {
53
+ message: new Collection(),
54
+ slash: new Collection(),
55
+ context: new Collection(),
56
+ };
57
+ this.events = new Collection();
58
+ this.inhibitors = new Collection();
59
+ this.modules = {
60
+ options: {},
61
+ commandHandler: new CommandHandler(this),
62
+ eventHandler: new EventHandler(this),
63
+ inhibitorHandler: new InhibitorHandler(this),
64
+ webhookHandler: new WebhookHandler(this),
65
+ extensionHandler: new ExtensionHandler(this),
66
+ };
67
+ this.util = new ClientUtil(this);
68
+ this.stats = {
69
+ guildCount: this.guilds.cache.size,
70
+ userCount: 0,
71
+ shardId: 0,
72
+ shardCount: 1,
73
+ };
74
+ this.cache = {
75
+ messages: new Collection(),
76
+ cooldowns: new Collection(),
77
+ };
78
+ return this;
79
+ }
80
+ async connect(token) {
81
+ const login = this.login(token);
82
+ deploy(this);
83
+ new XernerxLog(this).ready();
84
+ return login;
85
+ }
85
86
  }
86
87
  //# sourceMappingURL=XernerxClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"XernerxClient.js","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,YAAY,MAAM,6BAA6B,CAAC;AACvD,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,CAAC,OAAO,OAAO,aAA2B,SAAQ,MAAM;IAW1D,YAAmB,cAA6B,EAAE,cAA8B,EAAE,M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AC,IAAI,CAAC;YACxC,gBAAgB,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC;SACtC,CAAC;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjC,IAAI,CAAC,KAAK,GAAG;YACT,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;YAClC,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,CAAC;SAChB,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG;YACT,QAAQ,EAAE,IAAI,UAAU,EAAE;YAC1B,SAAS,EAAE,IAAI,UAAU,EAAE;SAC9B,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,KAAa;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAE7B,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { Client, ClientOptions, Collection } from 'discord.js';\nimport { z } from 'zod';\n\nimport CommandHandler from '../handlers/CommandHandler.js';\nimport EventHandler from '../handlers/EventHandler.js';\nimport InhibitorHandler from '../handlers/InhibitorHandler.js';\nimport WebhookHandler from '../handlers/WebhookHandler.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';\nimport ClientUtil from '../utils/ClientUtil.js';\nimport { XernerxInhibitor, XernerxEvent } from '../main.js';\nimport ExtensionHandler from '../handlers/ExtensionHandler.js';\nimport deploy from '../functions/deploy.js';\n\nexport default class XernerxClient<T = unknown> extends Client {\n public declare readonly settings;\n public declare readonly config;\n public declare readonly commands: XernerxCommands;\n public declare readonly events: Collection<string, XernerxEvent>;\n public declare readonly inhibitors: Collection<string, XernerxInhibitor>;\n public declare readonly modules: ModuleOptions;\n public declare readonly util: ClientUtil;\n public declare readonly stats: Record<string, number>;\n public declare readonly cache: XernerxCache;\n\n public constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T) {\n super(discordOptions);\n\n this.settings = z\n .object({\n local: z.string(),\n global: z.boolean().default(false).optional(),\n ownerId: z.string().or(z.array(z.string())).default([]),\n permissions: z\n .object({\n client: z.array(z.string()).default([]),\n user: z.array(z.string()).default([]),\n dm: z.boolean().default(false),\n })\n .optional(),\n ignore: z\n .object({\n owner: z.boolean().default(false),\n users: z.array(z.string()).default([]),\n channels: z.array(z.string()).default([]),\n guilds: z.array(z.string()).default([]),\n })\n .optional(),\n log: z\n .object({\n ready: z.boolean().default(false),\n info: z.boolean().default(false),\n error: z.boolean().default(false),\n table: z.array(z.string()).or(z.null()).default(null),\n })\n .optional(),\n cooldown: z\n .object({\n command: z.number().default(0),\n cache: z.number().default(0),\n })\n .optional(),\n })\n .parse(xernerxOptions);\n\n this.config = config || null;\n\n this.commands = {\n message: new Collection(),\n slash: new Collection(),\n context: new Collection(),\n };\n\n this.events = new Collection();\n\n this.inhibitors = new Collection();\n\n this.modules = {\n options: {},\n commandHandler: new CommandHandler(this),\n eventHandler: new EventHandler(this),\n inhibitorHandler: new InhibitorHandler(this),\n webhookHandler: new WebhookHandler(this),\n extensionHandler: new ExtensionHandler(this),\n } as const;\n\n this.util = new ClientUtil(this);\n\n this.stats = {\n guildCount: this.guilds.cache.size,\n userCount: 0,\n shardId: 0,\n shardCount: 1,\n };\n\n this.cache = {\n messages: new Collection(),\n cooldowns: new Collection(),\n };\n\n return this;\n }\n\n public async connect(token: string) {\n const login = this.login(token);\n\n deploy(this);\n\n new XernerxLog(this).ready();\n\n return login;\n }\n}\n"]}
1
+ {"version":3,"file":"XernerxClient.js","sourceRoot":"","sources":["../../src/client/XernerxClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EA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format */\n\nimport { Client, ClientOptions, Collection } from 'discord.js';\nimport { z } from 'zod';\n\nimport CommandHandler from '../handlers/CommandHandler.js';\nimport EventHandler from '../handlers/EventHandler.js';\nimport InhibitorHandler from '../handlers/InhibitorHandler.js';\nimport WebhookHandler from '../handlers/WebhookHandler.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';\nimport ClientUtil from '../utils/ClientUtil.js';\nimport { XernerxInhibitor, XernerxEvent } from '../main.js';\nimport ExtensionHandler from '../handlers/ExtensionHandler.js';\nimport deploy from '../functions/deploy.js';\n\nexport default class XernerxClient<T = unknown> extends Client {\n\tpublic declare readonly settings;\n\tpublic declare readonly config;\n\tpublic declare readonly commands: XernerxCommands;\n\tpublic declare readonly events: Collection<string, XernerxEvent>;\n\tpublic declare readonly inhibitors: Collection<string, XernerxInhibitor>;\n\tpublic declare readonly modules: ModuleOptions;\n\tpublic declare readonly util: ClientUtil;\n\tpublic declare readonly stats: Record<string, number>;\n\tpublic declare readonly cache: XernerxCache;\n\n\tpublic constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: T) {\n\t\tsuper(discordOptions);\n\n\t\tthis.settings = z\n\t\t\t.object({\n\t\t\t\tlocal: z.string(),\n\t\t\t\tglobal: z.boolean().default(false).optional(),\n\t\t\t\townerId: z.string().or(z.array(z.string())).default([]),\n\t\t\t\tpermissions: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tclient: z.array(z.string()).default([]),\n\t\t\t\t\t\tuser: z.array(z.string()).default([]),\n\t\t\t\t\t\tdm: z.boolean().default(false),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tignore: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\towner: z.boolean().default(false),\n\t\t\t\t\t\tusers: z.array(z.string()).default([]),\n\t\t\t\t\t\tchannels: z.array(z.string()).default([]),\n\t\t\t\t\t\tguilds: z.array(z.string()).default([]),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tlog: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tready: z.boolean().default(false),\n\t\t\t\t\t\tinfo: z.boolean().default(false),\n\t\t\t\t\t\terror: z.boolean().default(false),\n\t\t\t\t\t\ttable: z.array(z.string()).or(z.null()).default(null),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t\tcooldown: z\n\t\t\t\t\t.object({\n\t\t\t\t\t\tcommand: z.number().default(0),\n\t\t\t\t\t\tcache: z.number().default(0),\n\t\t\t\t\t})\n\t\t\t\t\t.optional(),\n\t\t\t})\n\t\t\t.parse(xernerxOptions);\n\n\t\tthis.config = config || null;\n\n\t\tthis.commands = {\n\t\t\tmessage: new Collection(),\n\t\t\tslash: new Collection(),\n\t\t\tcontext: new Collection(),\n\t\t};\n\n\t\tthis.events = new Collection();\n\n\t\tthis.inhibitors = new Collection();\n\n\t\tthis.modules = {\n\t\t\toptions: {},\n\t\t\tcommandHandler: new CommandHandler(this),\n\t\t\teventHandler: new EventHandler(this),\n\t\t\tinhibitorHandler: new InhibitorHandler(this),\n\t\t\twebhookHandler: new WebhookHandler(this),\n\t\t\textensionHandler: new ExtensionHandler(this),\n\t\t} as const;\n\n\t\tthis.util = new ClientUtil(this);\n\n\t\tthis.stats = {\n\t\t\tguildCount: this.guilds.cache.size,\n\t\t\tuserCount: 0,\n\t\t\tshardId: 0,\n\t\t\tshardCount: 1,\n\t\t};\n\n\t\tthis.cache = {\n\t\t\tmessages: new Collection(),\n\t\t\tcooldowns: new Collection(),\n\t\t};\n\n\t\treturn this;\n\t}\n\n\tpublic async connect(token: string) {\n\t\tconst login = this.login(token);\n\n\t\tdeploy(this);\n\n\t\tnew XernerxLog(this).ready();\n\n\t\treturn login;\n\t}\n}\n"]}
@@ -1,17 +1,18 @@
1
+ /** @format */
1
2
  import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
2
3
  interface XernerxOptions {
3
- log?: {
4
- info?: boolean;
5
- };
4
+ log?: {
5
+ info?: boolean;
6
+ };
6
7
  }
7
8
  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);
9
+ readonly stats: {
10
+ guildCount: number;
11
+ userCount: number;
12
+ shardCount: number;
13
+ };
14
+ user: ClientUser | null;
15
+ constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
15
16
  }
16
17
  export {};
17
18
  //# sourceMappingURL=XernerxShardClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"XernerxShardClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAS,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxF,UAAU,cAAc;IACpB,GAAG,CAAC,EAAE;QACF,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACL;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAC3D,SAAwB,KAAK;;;;MAAC;IACf,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,CAAC,EAAE,cAAc;CA6DpG"}
1
+ {"version":3,"file":"XernerxShardClient.d.ts","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAS,UAAU,EAAE,MAAM,YAAY,CAAC;AAIxF,UAAU,cAAc;IACvB,GAAG,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAC9D,SAAwB,KAAK;;;;MAAC;IACf,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,CAAC,EAAE,cAAc;CA6DjG"}
@@ -1,54 +1,55 @@
1
+ /** @format */
1
2
  import { ShardingManager } from 'discord.js';
2
3
  import XernerxLog from '../tools/XernerxLog.js';
3
4
  import { Style } from 'dumfunctions';
4
5
  export default class XernerxShardClient extends ShardingManager {
5
- constructor(file, discordOptions, xernerxOptions) {
6
- super(file, discordOptions);
7
- this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };
8
- this.user = null;
9
- this.on('shardCreate', async (shard) => {
10
- shard
11
- .on('ready', async () => {
12
- const guilds = await shard.fetchClientValue('guilds.cache');
13
- const guildCount = guilds.length;
14
- const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;
15
- this.user = await shard.fetchClientValue('user');
16
- this.stats.guildCount += Number(guildCount);
17
- this.stats.userCount += Number(userCount);
18
- this.stats.shardCount++;
19
- await new XernerxLog({ settings: xernerxOptions }).info(
20
- `Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`
21
- );
22
- })
23
- .on('error', (error) => {
24
- new XernerxLog({ settings: xernerxOptions }).info(
25
- `An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`
26
- );
27
- });
28
- });
29
- const spawn = this.spawn();
30
- spawn.then(async (shards) => {
31
- const collector = setInterval(() => {
32
- const index = shards.size - 1;
33
- if (shards.get(index)?.ready) {
34
- new XernerxLog({ settings: xernerxOptions }).info(
35
- `All Shards launched for ${Style.log(String(this.user?.tag), {
36
- color: Style.TextColor.Blue,
37
- })} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(
38
- String(this.stats.guildCount),
39
- {
40
- color: Style.TextColor.Cyan,
41
- }
42
- )} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`
43
- );
44
- clearInterval(collector);
45
- }
46
- }, 1000);
47
- });
48
- return {
49
- shards: spawn,
50
- stats: this.stats,
51
- };
52
- }
6
+ constructor(file, discordOptions, xernerxOptions) {
7
+ super(file, discordOptions);
8
+ this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };
9
+ this.user = null;
10
+ this.on('shardCreate', async (shard) => {
11
+ shard
12
+ .on('ready', async () => {
13
+ const guilds = await shard.fetchClientValue('guilds.cache');
14
+ const guildCount = guilds.length;
15
+ const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;
16
+ this.user = await shard.fetchClientValue('user');
17
+ this.stats.guildCount += Number(guildCount);
18
+ this.stats.userCount += Number(userCount);
19
+ this.stats.shardCount++;
20
+ await new XernerxLog({ settings: xernerxOptions }).info(
21
+ `Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`
22
+ );
23
+ })
24
+ .on('error', (error) => {
25
+ new XernerxLog({ settings: xernerxOptions }).info(
26
+ `An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`
27
+ );
28
+ });
29
+ });
30
+ const spawn = this.spawn();
31
+ spawn.then(async (shards) => {
32
+ const collector = setInterval(() => {
33
+ const index = shards.size - 1;
34
+ if (shards.get(index)?.ready) {
35
+ new XernerxLog({ settings: xernerxOptions }).info(
36
+ `All Shards launched for ${Style.log(String(this.user?.tag), {
37
+ color: Style.TextColor.Blue,
38
+ })} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(
39
+ String(this.stats.guildCount),
40
+ {
41
+ color: Style.TextColor.Cyan,
42
+ }
43
+ )} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`
44
+ );
45
+ clearInterval(collector);
46
+ }
47
+ }, 1000);
48
+ });
49
+ return {
50
+ shards: spawn,
51
+ stats: this.stats,
52
+ };
53
+ }
53
54
  }
54
55
  //# sourceMappingURL=XernerxShardClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"XernerxShardClient.js","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA6C,MAAM,YAAY,CAAC;AACxF,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAQrC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAI3D,YAAY,IAAY,EAAE,cAAsC,EAAE,cAA+B;QAC7F,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAE5D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACnC,KAAK;iBACA,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;gBACpB,MAAM,MAAM,GAAG,CAAC,MAAM,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAiB,CAAC;gBAC9E,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;gBACjC,MAAM,SAAS,GAAG,MAAM,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,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAChL,CAAC;oBAEF,aAAa,CAAC,SAAS,CAAC,CAAC;iBAC5B;YACL,CAAC,EAAE,IAAI,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SACX,CAAC;IACf,CAAC;CACJ","sourcesContent":["import { ShardingManager, ShardingManagerOptions, Guild, ClientUser } from 'discord.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { Style } from 'dumfunctions';\n\ninterface XernerxOptions {\n log?: {\n info?: boolean;\n };\n}\n\nexport default class XernerxShardClient extends ShardingManager {\n public declare readonly stats;\n public declare user: ClientUser | null;\n\n constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions) {\n super(file, discordOptions);\n\n this.stats = { guildCount: 0, userCount: 0, shardCount: 0 };\n\n this.user = null;\n\n this.on('shardCreate', async (shard) => {\n shard\n .on('ready', async () => {\n const guilds = (await shard.fetchClientValue('guilds.cache')) as Array<Guild>;\n const guildCount = guilds.length;\n const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;\n\n this.user = (await shard.fetchClientValue('user')) as ClientUser;\n\n this.stats.guildCount += Number(guildCount);\n\n this.stats.userCount += Number(userCount);\n\n this.stats.shardCount++;\n\n await new XernerxLog({ settings: xernerxOptions } as never).info(\n `Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`\n );\n })\n .on('error', (error) => {\n new XernerxLog({ settings: xernerxOptions } as never).info(\n `An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`\n );\n });\n });\n\n const spawn = this.spawn();\n\n spawn.then(async (shards) => {\n const collector = setInterval(() => {\n const index = shards.size - 1;\n\n if (shards.get(index)?.ready) {\n new XernerxLog({ settings: xernerxOptions } as never).info(\n `All Shards launched for ${Style.log(String(this.user?.tag), {\n color: Style.TextColor.Blue,\n })} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(\n String(this.stats.guildCount),\n {\n color: Style.TextColor.Cyan,\n }\n )} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`\n );\n\n clearInterval(collector);\n }\n }, 1000);\n });\n\n return {\n shards: spawn,\n stats: this.stats,\n } as never;\n }\n}\n"]}
1
+ {"version":3,"file":"XernerxShardClient.js","sourceRoot":"","sources":["../../src/client/XernerxShardClient.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,eAAe,EAA6C,MAAM,YAAY,CAAC;AACxF,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAQrC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,eAAe;IAI9D,YAAY,IAAY,EAAE,cAAsC,EAAE,cAA+B;QAChG,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QAE5D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IA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AC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,KAAK,CAAC,GAAG,CAClK,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAC7B;wBACC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI;qBAC3B,CACD,SAAS,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAC7K,CAAC;oBAEF,aAAa,CAAC,SAAS,CAAC,CAAC;iBACzB;YACF,CAAC,EAAE,IAAI,CAAC,CAAC;QACV,CAAC,CAAC,CAAC;QAEH,OAAO;YACN,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;SACR,CAAC;IACZ,CAAC;CACD","sourcesContent":["/** @format */\n\nimport { ShardingManager, ShardingManagerOptions, Guild, ClientUser } from 'discord.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport { Style } from 'dumfunctions';\n\ninterface XernerxOptions {\n\tlog?: {\n\t\tinfo?: boolean;\n\t};\n}\n\nexport default class XernerxShardClient extends ShardingManager {\n\tpublic declare readonly stats;\n\tpublic declare user: ClientUser | null;\n\n\tconstructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions) {\n\t\tsuper(file, discordOptions);\n\n\t\tthis.stats = { guildCount: 0, userCount: 0, shardCount: 0 };\n\n\t\tthis.user = null;\n\n\t\tthis.on('shardCreate', async (shard) => {\n\t\t\tshard\n\t\t\t\t.on('ready', async () => {\n\t\t\t\t\tconst guilds = (await shard.fetchClientValue('guilds.cache')) as Array<Guild>;\n\t\t\t\t\tconst guildCount = guilds.length;\n\t\t\t\t\tconst userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;\n\n\t\t\t\t\tthis.user = (await shard.fetchClientValue('user')) as ClientUser;\n\n\t\t\t\t\tthis.stats.guildCount += Number(guildCount);\n\n\t\t\t\t\tthis.stats.userCount += Number(userCount);\n\n\t\t\t\t\tthis.stats.shardCount++;\n\n\t\t\t\t\tawait new XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.on('error', (error) => {\n\t\t\t\t\tnew XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`An error occurred in ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(String(this.user?.tag), { color: Style.TextColor.Blue })}! ${error}`\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t});\n\n\t\tconst spawn = this.spawn();\n\n\t\tspawn.then(async (shards) => {\n\t\t\tconst collector = setInterval(() => {\n\t\t\t\tconst index = shards.size - 1;\n\n\t\t\t\tif (shards.get(index)?.ready) {\n\t\t\t\t\tnew XernerxLog({ settings: xernerxOptions } as never).info(\n\t\t\t\t\t\t`All Shards launched for ${Style.log(String(this.user?.tag), {\n\t\t\t\t\t\t\tcolor: Style.TextColor.Blue,\n\t\t\t\t\t\t})} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(\n\t\t\t\t\t\t\tString(this.stats.guildCount),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolor: Style.TextColor.Cyan,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`\n\t\t\t\t\t);\n\n\t\t\t\t\tclearInterval(collector);\n\t\t\t\t}\n\t\t\t}, 1000);\n\t\t});\n\n\t\treturn {\n\t\t\tshards: spawn,\n\t\t\tstats: this.stats,\n\t\t} as never;\n\t}\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /** @format */
1
2
  import XernerxClient from '../client/XernerxClient.js';
2
3
  export default function deploy(client: XernerxClient): void;
3
4
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAOvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,QA6BnD"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,cAAc;AAMd,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAOvD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,QA6BnD"}
@@ -1,40 +1,41 @@
1
+ /** @format */
1
2
  import { GatewayVersion, REST, Routes } from 'discord.js';
2
3
  import XernerxLog from '../tools/XernerxLog.js';
3
4
  import XernerxError from '../tools/XernerxError.js';
4
5
  import { Style } from 'dumfunctions';
5
6
  const commands = [];
6
7
  export default function deploy(client) {
7
- client.prependOnceListener('ready', (client) => {
8
- if (client.commands.slash.size) client.commands.slash.map((command) => commands.push(command.data.toJSON()));
9
- if (client.commands.context.size) client.commands.context.map((command) => commands.push(command.data.toJSON()));
10
- if (commands.length <= 0) return;
11
- try {
12
- if (client.settings.global) {
13
- put(client, client.settings.global, commands);
14
- put(client, !client.settings.global, []);
15
- } else {
16
- put(client, !client.settings.global, commands);
17
- put(client, client.settings.global, []);
18
- }
19
- } catch (error) {
20
- new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
21
- } finally {
22
- new XernerxLog(client).info(
23
- `Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {
24
- color: Style.TextColor.Cyan,
25
- })} Commands ${
26
- client.settings.global
27
- ? Style.log('globally', { color: Style.TextColor.Green })
28
- : `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`
29
- }.`
30
- );
31
- }
32
- });
8
+ client.prependOnceListener('ready', (client) => {
9
+ if (client.commands.slash.size) client.commands.slash.map((command) => commands.push(command.data.toJSON()));
10
+ if (client.commands.context.size) client.commands.context.map((command) => commands.push(command.data.toJSON()));
11
+ if (commands.length <= 0) return;
12
+ try {
13
+ if (client.settings.global) {
14
+ put(client, client.settings.global, commands);
15
+ put(client, !client.settings.global, []);
16
+ } else {
17
+ put(client, !client.settings.global, commands);
18
+ put(client, client.settings.global, []);
19
+ }
20
+ } catch (error) {
21
+ new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
22
+ } finally {
23
+ new XernerxLog(client).info(
24
+ `Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {
25
+ color: Style.TextColor.Cyan,
26
+ })} Commands ${
27
+ client.settings.global
28
+ ? Style.log('globally', { color: Style.TextColor.Green })
29
+ : `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`
30
+ }.`
31
+ );
32
+ }
33
+ });
33
34
  }
34
35
  function put(client, global, body) {
35
- const rest = new REST({ version: GatewayVersion }).setToken(client.token);
36
- if (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);
37
- if (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
38
- else rest.put(Routes.applicationCommands(client.user?.id), { body });
36
+ const rest = new REST({ version: GatewayVersion }).setToken(client.token);
37
+ if (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);
38
+ if (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
39
+ else rest.put(Routes.applicationCommands(client.user?.id), { body });
39
40
  }
40
41
  //# sourceMappingURL=deploy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAK1D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,QAAQ,GAA6D,EAAE,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAqB;IAChD,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;QAC3C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI;YAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAoD,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1J,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI;YAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAoD,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAE9J,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC;YAAE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E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EACvK,GAAG,CACN,CAAC;SACL;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,GAAG,CAAC,MAAqB,EAAE,MAAe,EAAE,IAAmB;IACpE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAe,CAAC,CAAC;IAEpF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,MAAM,IAAI,YAAY,CAAC,sCAAsC,CAAC,CAAC;IAEvG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;;QACxI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC","sourcesContent":["import { GatewayVersion, REST, Routes } from 'discord.js';\n\nimport XernerxContextCommand from '../build/XernerxContextCommand.js';\nimport XernerxSlashCommand from '../build/XernerxSlashCommand.js';\nimport XernerxClient from '../client/XernerxClient.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport XernerxError from '../tools/XernerxError.js';\nimport { Style } from 'dumfunctions';\n\nconst commands: Array<XernerxSlashCommand | XernerxContextCommand | any> = [];\n\nexport default function deploy(client: XernerxClient) {\n client.prependOnceListener('ready', (client) => {\n if (client.commands.slash.size) client.commands.slash.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n if (client.commands.context.size) client.commands.context.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n\n if (commands.length <= 0) return;\n\n try {\n if (client.settings.global) {\n put(client, client.settings.global, commands);\n put(client, !client.settings.global, []);\n } else {\n put(client, !client.settings.global, commands);\n put(client, client.settings.global, []);\n }\n } catch (error) {\n new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);\n } finally {\n new XernerxLog(client).info(\n `Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {\n color: Style.TextColor.Cyan,\n })} Commands ${\n client.settings.global\n ? Style.log('globally', { color: Style.TextColor.Green })\n : `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`\n }.`\n );\n }\n });\n}\n\nfunction put(client: XernerxClient, global: boolean, body: Array<object>) {\n const rest = new REST({ version: GatewayVersion }).setToken(client.token as string);\n\n if (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);\n\n if (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id as string, client.settings.local), { body });\n else rest.put(Routes.applicationCommands(client.user?.id as string), { body });\n}\n"]}
1
+ {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/functions/deploy.ts"],"names":[],"mappings":"AAAA,cAAc;AAEd,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAK1D,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,QAAQ,GAA6D,EAAE,CAAC;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,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK;QAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;;QACxI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAY,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC","sourcesContent":["/** @format */\n\nimport { GatewayVersion, REST, Routes } from 'discord.js';\n\nimport XernerxContextCommand from '../build/XernerxContextCommand.js';\nimport XernerxSlashCommand from '../build/XernerxSlashCommand.js';\nimport XernerxClient from '../client/XernerxClient.js';\nimport XernerxLog from '../tools/XernerxLog.js';\nimport XernerxError from '../tools/XernerxError.js';\nimport { Style } from 'dumfunctions';\n\nconst commands: Array<XernerxSlashCommand | XernerxContextCommand | any> = [];\n\nexport default function deploy(client: XernerxClient) {\n\tclient.prependOnceListener('ready', (client) => {\n\t\tif (client.commands.slash.size) client.commands.slash.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n\t\tif (client.commands.context.size) client.commands.context.map((command: XernerxSlashCommand | XernerxContextCommand) => commands.push(command.data.toJSON()));\n\n\t\tif (commands.length <= 0) return;\n\n\t\ttry {\n\t\t\tif (client.settings.global) {\n\t\t\t\tput(client, client.settings.global, commands);\n\t\t\t\tput(client, !client.settings.global, []);\n\t\t\t} else {\n\t\t\t\tput(client, !client.settings.global, commands);\n\t\t\t\tput(client, client.settings.global, []);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tnew XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);\n\t\t} finally {\n\t\t\tnew XernerxLog(client).info(\n\t\t\t\t`Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {\n\t\t\t\t\tcolor: Style.TextColor.Cyan,\n\t\t\t\t})} Commands ${\n\t\t\t\t\tclient.settings.global\n\t\t\t\t\t\t? Style.log('globally', { color: Style.TextColor.Green })\n\t\t\t\t\t\t: `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`\n\t\t\t\t}.`\n\t\t\t);\n\t\t}\n\t});\n}\n\nfunction put(client: XernerxClient, global: boolean, body: Array<object>) {\n\tconst rest = new REST({ version: GatewayVersion }).setToken(client.token as string);\n\n\tif (!global && !client.settings?.local) throw new XernerxError(`No guild ID provided as local guild!`);\n\n\tif (!global && client.settings?.local) rest.put(Routes.applicationGuildCommands(client.user?.id as string, client.settings.local), { body });\n\telse rest.put(Routes.applicationCommands(client.user?.id as string), { body });\n}\n"]}
@@ -1,3 +1,4 @@
1
+ /** @format */
1
2
  import XernerxClient from '../client/XernerxClient.js';
2
3
  import { FileType } from '../types/types.js';
3
4
  export default function load(client: XernerxClient, path: string, type: FileType): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/functions/load.ts"],"names":[],"mappings":"AAKA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,wBAA8B,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,gBAgBrF"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/functions/load.ts"],"names":[],"mappings":"AAAA,cAAc;AAOd,OAAO,aAAa,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,wBAA8B,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,gBAgBrF"}