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,139 +1,141 @@
1
+ /** @format */
2
+
1
3
  export async function messageArguments(message, command, prefix) {
2
- const separator = command.separator || ' ',
3
- content = message.content
4
- .replace(new RegExp(`${prefix} +?`), '')
5
- .split(separator)
6
- .slice(1);
7
- let args = {},
8
- flags = {};
9
- if (command.flags)
10
- command.flags.map((flag) => {
11
- if (!flags) flags = {};
12
- if (content.includes(flag.match)) flags[flag.name] = true;
13
- else flags[flag.name] = false;
14
- const index = content.indexOf(flag.match);
15
- if (index > 0) content.splice(index, 1);
16
- });
17
- if (command.args)
18
- for (const argument of command.args) {
19
- const element = content.at(0) || null;
20
- if (!element) {
21
- if (typeof argument.default === 'function') args[argument.name] = argument.default(message);
22
- args[argument.name] = argument.default || null;
23
- continue;
24
- }
25
- if (argument.type === 'option') argument.match?.includes(element) ? (args[argument.name] = element) : (args[argument.name] = null);
26
- if (argument.type === 'number') args[argument.name] = parseInt(element);
27
- if (argument.type === 'integer') args[argument.name] = parseInt(element);
28
- if (argument.type === 'boolean') args[argument.name] = element === 'true' ? true : false;
29
- if (argument.type === 'confirm') args[argument.name] = element === 'yes' ? 'yes' : 'no';
30
- if (argument.type === 'string') args[argument.name] = element;
31
- if (argument.type === 'channel') {
32
- try {
33
- const channel = await message.client.channels.fetch(element);
34
- args[argument.name] = channel;
35
- } catch (e) {
36
- args[argument.name] = null;
37
- }
38
- }
39
- if (argument.type === 'guild') {
40
- try {
41
- const guild = await message.client.guilds.fetch(element);
42
- args[argument.name] = guild;
43
- } catch (e) {
44
- args[argument.name] = null;
45
- }
46
- }
47
- if (argument.type === 'mentionable') {
48
- (
49
- await Promise.all(
50
- [message.guild?.roles, message.client.users, message.client.guilds, message.client.channels, message.guild?.members, message.channel.messages].map((req) =>
51
- req
52
- ? req
53
- .fetch(element)
54
- .then((r) => r)
55
- .catch(() => null)
56
- : null
57
- )
58
- )
59
- ).map((mentionable) => {
60
- if (!args) args = {};
61
- if (mentionable) return (args[argument.name] = mentionable);
62
- else return (args[argument.name] = null);
63
- });
64
- }
65
- if (argument.type === 'role') {
66
- try {
67
- const role = await message.guild?.roles.fetch(element);
68
- args[argument.name] = role;
69
- } catch (e) {
70
- args[argument.name] = null;
71
- }
72
- }
73
- if (argument.type === 'user') {
74
- try {
75
- const user = await message.client.users.fetch(element);
76
- args[argument.name] = user;
77
- } catch (e) {
78
- args[argument.name] = null;
79
- }
80
- }
81
- if (argument.type === 'member') {
82
- try {
83
- const member = await message.guild?.members.fetch(element);
84
- args[argument.name] = member;
85
- } catch (e) {
86
- args[argument.name] = null;
87
- }
88
- }
89
- if (argument.type === 'message') {
90
- try {
91
- const msg = await message.channel?.messages.fetch(element);
92
- args[argument.name] = msg;
93
- } catch (e) {
94
- args[argument.name] = null;
95
- }
96
- }
97
- if (argument.type === 'list') {
98
- let separator = String(argument.separator) || ',';
99
- if (separator.startsWith('/') && separator.endsWith('/')) separator = separator.replace(/^\/|\/$/gim, '');
100
- const items = content.join(' ').split(new RegExp(' *' + separator + ' *', 'gi'));
101
- if (!argument.content) args[argument.name] = items;
102
- else {
103
- const contents = argument.content.map((content) => content.toLowerCase()),
104
- itemList = [];
105
- items.map((item) => (contents.includes(item.toLowerCase()) ? itemList.push(argument.content?.at(contents.indexOf(item.toLowerCase()))) : null));
106
- args[argument.name] = itemList;
107
- break;
108
- }
109
- }
110
- if (argument.type === 'rest') {
111
- args[argument.name] = content.join(separator);
112
- break;
113
- }
114
- content.splice(0, 1);
115
- }
116
- if (!command.flags) flags = null;
117
- if (!command.args) args = null;
118
- return { args, flags };
4
+ const separator = command.separator || ' ',
5
+ content = message.content
6
+ .replace(new RegExp(`${prefix} +?`), '')
7
+ .split(separator)
8
+ .slice(1);
9
+ let args = {},
10
+ flags = {};
11
+ if (command.flags)
12
+ command.flags.map((flag) => {
13
+ if (!flags) flags = {};
14
+ if (content.includes(flag.match)) flags[flag.name] = true;
15
+ else flags[flag.name] = false;
16
+ const index = content.indexOf(flag.match);
17
+ if (index > 0) content.splice(index, 1);
18
+ });
19
+ if (command.args)
20
+ for (const argument of command.args) {
21
+ const element = content.at(0) || null;
22
+ if (!element) {
23
+ if (typeof argument.default === 'function') args[argument.name] = argument.default(message);
24
+ args[argument.name] = argument.default || null;
25
+ continue;
26
+ }
27
+ if (argument.type === 'option') argument.match?.includes(element) ? (args[argument.name] = element) : (args[argument.name] = null);
28
+ if (argument.type === 'number') args[argument.name] = parseInt(element);
29
+ if (argument.type === 'integer') args[argument.name] = parseInt(element);
30
+ if (argument.type === 'boolean') args[argument.name] = element === 'true' ? true : false;
31
+ if (argument.type === 'confirm') args[argument.name] = element === 'yes' ? 'yes' : 'no';
32
+ if (argument.type === 'string') args[argument.name] = element;
33
+ if (argument.type === 'channel') {
34
+ try {
35
+ const channel = await message.client.channels.fetch(element);
36
+ args[argument.name] = channel;
37
+ } catch (e) {
38
+ args[argument.name] = null;
39
+ }
40
+ }
41
+ if (argument.type === 'guild') {
42
+ try {
43
+ const guild = await message.client.guilds.fetch(element);
44
+ args[argument.name] = guild;
45
+ } catch (e) {
46
+ args[argument.name] = null;
47
+ }
48
+ }
49
+ if (argument.type === 'mentionable') {
50
+ (
51
+ await Promise.all(
52
+ [message.guild?.roles, message.client.users, message.client.guilds, message.client.channels, message.guild?.members, message.channel.messages].map((req) =>
53
+ req
54
+ ? req
55
+ .fetch(element)
56
+ .then((r) => r)
57
+ .catch(() => null)
58
+ : null
59
+ )
60
+ )
61
+ ).map((mentionable) => {
62
+ if (!args) args = {};
63
+ if (mentionable) return (args[argument.name] = mentionable);
64
+ else return (args[argument.name] = null);
65
+ });
66
+ }
67
+ if (argument.type === 'role') {
68
+ try {
69
+ const role = await message.guild?.roles.fetch(element);
70
+ args[argument.name] = role;
71
+ } catch (e) {
72
+ args[argument.name] = null;
73
+ }
74
+ }
75
+ if (argument.type === 'user') {
76
+ try {
77
+ const user = await message.client.users.fetch(element);
78
+ args[argument.name] = user;
79
+ } catch (e) {
80
+ args[argument.name] = null;
81
+ }
82
+ }
83
+ if (argument.type === 'member') {
84
+ try {
85
+ const member = await message.guild?.members.fetch(element);
86
+ args[argument.name] = member;
87
+ } catch (e) {
88
+ args[argument.name] = null;
89
+ }
90
+ }
91
+ if (argument.type === 'message') {
92
+ try {
93
+ const msg = await message.channel?.messages.fetch(element);
94
+ args[argument.name] = msg;
95
+ } catch (e) {
96
+ args[argument.name] = null;
97
+ }
98
+ }
99
+ if (argument.type === 'list') {
100
+ let separator = String(argument.separator) || ',';
101
+ if (separator.startsWith('/') && separator.endsWith('/')) separator = separator.replace(/^\/|\/$/gim, '');
102
+ const items = content.join(' ').split(new RegExp(' *' + separator + ' *', 'gi'));
103
+ if (!argument.content) args[argument.name] = items;
104
+ else {
105
+ const contents = argument.content.map((content) => content.toLowerCase()),
106
+ itemList = [];
107
+ items.map((item) => (contents.includes(item.toLowerCase()) ? itemList.push(argument.content?.at(contents.indexOf(item.toLowerCase()))) : null));
108
+ args[argument.name] = itemList;
109
+ break;
110
+ }
111
+ }
112
+ if (argument.type === 'rest') {
113
+ args[argument.name] = content.join(separator);
114
+ break;
115
+ }
116
+ content.splice(0, 1);
117
+ }
118
+ if (!command.flags) flags = null;
119
+ if (!command.args) args = null;
120
+ return { args, flags };
119
121
  }
120
122
  export async function interactionArguments(interaction, command) {
121
- if (command.fileType === 'SlashCommand') {
122
- const options = {};
123
- let args = interaction?.options?._hoistedOptions,
124
- group = interaction?.options?._group,
125
- subcommand = interaction?.options?._subcommand;
126
- if (interaction.options._hoistedOptions) {
127
- for (const option of interaction.options._hoistedOptions) {
128
- options[option.name] = option.member || option.channel || option.user || option.role || option.value;
129
- }
130
- args = options;
131
- }
132
- return { args, group, subcommand };
133
- }
134
- if (command.fileType === 'ContextCommand') {
135
- if (command.type === 'user') return await interaction.client.users.fetch(interaction.targetId);
136
- if (command.type === 'message') return await interaction.channel.messages.fetch(interaction.targetId);
137
- }
123
+ if (command.fileType === 'SlashCommand') {
124
+ const options = {};
125
+ let args = interaction?.options?._hoistedOptions,
126
+ group = interaction?.options?._group,
127
+ subcommand = interaction?.options?._subcommand;
128
+ if (interaction.options._hoistedOptions) {
129
+ for (const option of interaction.options._hoistedOptions) {
130
+ options[option.name] = option.member || option.channel || option.user || option.role || option.value;
131
+ }
132
+ args = options;
133
+ }
134
+ return { args, group, subcommand };
135
+ }
136
+ if (command.fileType === 'ContextCommand') {
137
+ if (command.type === 'user') return await interaction.client.users.fetch(interaction.targetId);
138
+ if (command.type === 'message') return await interaction.channel.messages.fetch(interaction.targetId);
139
+ }
138
140
  }
139
141
  //# sourceMappingURL=Arguments.js.map
@@ -1,7 +1,9 @@
1
+ /** @format */
2
+
1
3
  export default class XernerxError {
2
- name: string;
3
- message: string | null;
4
- stack: {} | undefined;
5
- constructor(message?: string, error?: Error | unknown);
4
+ name: string;
5
+ message: string | null;
6
+ stack: {} | undefined;
7
+ constructor(message?: string, error?: Error | unknown);
6
8
  }
7
9
  //# sourceMappingURL=XernerxError.d.ts.map
@@ -1,11 +1,13 @@
1
+ /** @format */
2
+
1
3
  export default class XernerxError {
2
- name;
3
- message;
4
- stack;
5
- constructor(message, error) {
6
- this.name = 'XernerxError';
7
- this.message = message || null;
8
- this.stack = error || new Error().stack;
9
- }
4
+ name;
5
+ message;
6
+ stack;
7
+ constructor(message, error) {
8
+ this.name = 'XernerxError';
9
+ this.message = message || null;
10
+ this.stack = error || new Error().stack;
11
+ }
10
12
  }
11
13
  //# sourceMappingURL=XernerxError.js.map
@@ -1,17 +1,19 @@
1
+ /** @format */
2
+
1
3
  import XernerxError from './XernerxError.js';
2
4
  import XernerxClient from '../client/XernerxClient.js';
3
5
  export default class XernerxLog {
4
- private readonly client;
5
- private readonly errorLog;
6
- private readonly infoLog;
7
- private readonly readyLog;
8
- private readonly tableLog;
9
- private readonly time;
10
- constructor(client: XernerxClient | true);
11
- info(message: string, force?: boolean): void | null;
12
- warn(message: string): void | null;
13
- update(version: string, url: string): Promise<void>;
14
- error(message: string, error?: XernerxError | unknown): void | null;
15
- ready(): void;
6
+ private readonly client;
7
+ private readonly errorLog;
8
+ private readonly infoLog;
9
+ private readonly readyLog;
10
+ private readonly tableLog;
11
+ private readonly time;
12
+ constructor(client: XernerxClient | true);
13
+ info(message: string, force?: boolean): void | null;
14
+ warn(message: string): void | null;
15
+ update(version: string, url: string): Promise<void>;
16
+ error(message: string, error?: XernerxError | unknown): void | null;
17
+ ready(): void;
16
18
  }
17
19
  //# sourceMappingURL=XernerxLog.d.ts.map
@@ -1,84 +1,81 @@
1
+ /** @format */
2
+
1
3
  import { Style } from 'dumfunctions';
2
4
  export default class XernerxLog {
3
- constructor(client) {
4
- this.client = client;
5
- if (client == true) {
6
- this.errorLog = true;
7
- this.infoLog = true;
8
- } else {
9
- this.errorLog = client.settings.log?.error;
10
- this.infoLog = client.settings.log?.info;
11
- this.readyLog = client.settings.log?.ready;
12
- this.tableLog = client.settings.log?.table;
13
- }
14
- this.time = () => String(new Date()).split(/ +/)[4];
15
- }
16
- info(message, force = false) {
17
- return this.infoLog || force
18
- ? console.info(`✔️ | ${Style.log('Xernerx', { color: Style.TextColor.Purple })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`)
19
- : null;
20
- }
21
- warn(message) {
22
- return this.infoLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
23
- }
24
- async update(version, url) {
25
- const pkg = await fetch(url)
26
- .then(async (res) => await res.json())
27
- .catch((pkg) => {
28
- pkg.version, pkg.name;
29
- });
30
- if (version != pkg.version)
31
- new XernerxLog(true).warn(
32
- `A new version is available, you're using version ${Style.log(version, { color: Style.TextColor.Cyan })}, new version is ${Style.log(pkg.version, {
33
- color: Style.TextColor.Cyan,
34
- })}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, { color: Style.BackgroundColor.Grey })} to update to the latest version.`
35
- );
36
- }
37
- error(message, error) {
38
- return this.errorLog
39
- ? console.error(`❗ | ${Style.log('Xernerx', { color: Style.TextColor.Red })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}${error ? ` | ${error.stack}` : ''}`)
40
- : null;
41
- }
42
- ready() {
43
- if (typeof this.client == 'boolean') return;
44
- const client = this.client;
45
- this.client.prependOnceListener('ready', async (synced) => {
46
- this.info(
47
- `${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${Style.log('online', { color: Style.TextColor.Green })}, watching ${Style.log(
48
- String(client.guilds.cache.size),
49
- {
50
- color: Style.TextColor.Cyan,
51
- }
52
- )} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${
53
- client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local)).name, { color: Style.TextColor.Blue }) : 'none'
54
- } as local guild.`,
55
- this.readyLog
56
- );
57
- const files = [];
58
- for (const [id, data] of client.commands.message) {
59
- files.push(data);
60
- id;
61
- }
62
- for (const [id, data] of client.commands.slash) {
63
- files.push(data);
64
- id;
65
- }
66
- for (const [id, data] of client.commands.context) {
67
- files.push(data);
68
- id;
69
- }
70
- for (const [id, data] of client.events) {
71
- files.push(data);
72
- id;
73
- }
74
- for (const [id, data] of client.inhibitors) {
75
- files.push(data);
76
- id;
77
- }
78
- if (this.tableLog) {
79
- console.table(files, this.tableLog);
80
- }
81
- });
82
- }
5
+ constructor(client) {
6
+ this.client = client;
7
+ if (client == true) {
8
+ this.errorLog = true;
9
+ this.infoLog = true;
10
+ } else {
11
+ this.errorLog = client.settings.log?.error;
12
+ this.infoLog = client.settings.log?.info;
13
+ this.readyLog = client.settings.log?.ready;
14
+ this.tableLog = client.settings.log?.table;
15
+ }
16
+ this.time = () => String(new Date()).split(/ +/)[4];
17
+ }
18
+ info(message, force = false) {
19
+ return this.infoLog || force ? console.info(`✔️ | ${Style.log('Xernerx', { color: Style.TextColor.Purple })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
20
+ }
21
+ warn(message) {
22
+ return this.infoLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;
23
+ }
24
+ async update(version, url) {
25
+ const pkg = await fetch(url)
26
+ .then(async (res) => await res.json())
27
+ .catch((pkg) => {
28
+ pkg.version || version, pkg.name;
29
+ });
30
+ if (version != pkg.version)
31
+ new XernerxLog(true).warn(
32
+ `A new version for ${pkg.name} is available, you're using version ${Style.log(version, { color: Style.TextColor.Cyan })}, new version is ${Style.log(pkg.version, {
33
+ color: Style.TextColor.Cyan,
34
+ })}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, { color: Style.BackgroundColor.Grey })} to update to the latest version.`
35
+ );
36
+ }
37
+ error(message, error) {
38
+ return this.errorLog
39
+ ? console.error(`❗ | ${Style.log('Xernerx', { color: Style.TextColor.Red })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}${error ? ` | ${error.stack}` : ''}`)
40
+ : null;
41
+ }
42
+ ready() {
43
+ if (typeof this.client == 'boolean') return;
44
+ const client = this.client;
45
+ this.client.prependOnceListener('ready', async (synced) => {
46
+ this.info(
47
+ `${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${Style.log('online', { color: Style.TextColor.Green })}, watching ${Style.log(String(client.guilds.cache.size), {
48
+ color: Style.TextColor.Cyan,
49
+ })} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${
50
+ client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local)).name, { color: Style.TextColor.Blue }) : 'none'
51
+ } as local guild.`,
52
+ this.readyLog
53
+ );
54
+ const files = [];
55
+ for (const [id, data] of client.commands.message) {
56
+ files.push(data);
57
+ id;
58
+ }
59
+ for (const [id, data] of client.commands.slash) {
60
+ files.push(data);
61
+ id;
62
+ }
63
+ for (const [id, data] of client.commands.context) {
64
+ files.push(data);
65
+ id;
66
+ }
67
+ for (const [id, data] of client.events) {
68
+ files.push(data);
69
+ id;
70
+ }
71
+ for (const [id, data] of client.inhibitors) {
72
+ files.push(data);
73
+ id;
74
+ }
75
+ if (this.tableLog) {
76
+ console.table(files, this.tableLog);
77
+ }
78
+ });
79
+ }
83
80
  }
84
81
  //# sourceMappingURL=XernerxLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"XernerxLog.js","sourceRoot":"","sources":["../../src/tools/XernerxLog.ts"],"names":[],"mappings":"AACA,O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.js';\nimport { Style } from 'dumfunctions';\nimport XernerxClient from '../client/XernerxClient.js';\n\nexport default class XernerxLog {\n private declare readonly client;\n private declare readonly errorLog;\n private declare readonly infoLog;\n private declare readonly readyLog;\n private declare readonly tableLog;\n private declare readonly time;\n\n constructor(client: XernerxClient | true) {\n this.client = client;\n\n if (client == true) {\n this.errorLog = true;\n\n this.infoLog = true;\n } else {\n this.errorLog = client.settings.log?.error;\n\n this.infoLog = client.settings.log?.info;\n\n this.readyLog = client.settings.log?.ready;\n\n this.tableLog = client.settings.log?.table;\n }\n\n this.time = () => String(new Date()).split(/ +/)[4];\n }\n\n public info(message: string, force: boolean = false) {\n return this.infoLog || force\n ? console.info(`✔️ | ${Style.log('Xernerx', { color: Style.TextColor.Purple })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`)\n : null;\n }\n\n public warn(message: string) {\n return this.infoLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;\n }\n\n public async update(version: string, url: string) {\n const pkg = await fetch(url)\n .then(async (res) => await res.json())\n .catch((pkg) => {\n pkg.version, pkg.name;\n });\n\n if (version != pkg.version)\n new XernerxLog(true).warn(\n `A new version is available, you're using version ${Style.log(version, { color: Style.TextColor.Cyan })}, new version is ${Style.log(pkg.version, {\n color: Style.TextColor.Cyan,\n })}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, { color: Style.BackgroundColor.Grey })} to update to the latest version.`\n );\n }\n\n public error(message: string, error?: XernerxError | unknown) {\n return this.errorLog\n ? console.error(\n `❗ | ${Style.log('Xernerx', { color: Style.TextColor.Red })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}${\n error ? ` | ${(error as Record<string, string>).stack}` : ''\n }`\n )\n : null;\n }\n\n public ready() {\n if (typeof this.client == 'boolean') return;\n\n const client = this.client as XernerxClient;\n\n this.client.prependOnceListener('ready', async (synced) => {\n this.info(\n `${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${Style.log('online', { color: Style.TextColor.Green })}, watching ${Style.log(\n String(client.guilds.cache.size),\n {\n color: Style.TextColor.Cyan,\n }\n )} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${\n client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local)).name, { color: Style.TextColor.Blue }) : 'none'\n } as local guild.`,\n this.readyLog\n );\n\n const files: Array<object> = [];\n\n for (const [id, data] of client.commands.message) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.commands.slash) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.commands.context) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.events) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.inhibitors) {\n files.push(data);\n id;\n }\n\n if (this.tableLog) {\n console.table(files, this.tableLog);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"XernerxLog.js","sourceRoot":"","sources":["../../src/tools/XernerxLog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAGrC,MAAM,CAAC,OAAO,OAAO,UAAU;IAQ3B,YAAY,MAA4B;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,MAAM,IAAI,IAAI,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YAErB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;aAAM;YACH,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;YAE3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;YAEzC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;YAE3C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,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CAAC;gBACjB,EAAE,CAAC;aACN;YAED,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;gBAC9C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjB,EAAE,CAAC;aACN;YAED,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE;gBACpC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjB,EAAE,CAAC;aACN;YAED,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE;gBACxC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjB,EAAE,CAAC;aACN;YAED,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;aACvC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import XernerxError from './XernerxError.js';\nimport { Style } from 'dumfunctions';\nimport XernerxClient from '../client/XernerxClient.js';\n\nexport default class XernerxLog {\n private declare readonly client;\n private declare readonly errorLog;\n private declare readonly infoLog;\n private declare readonly readyLog;\n private declare readonly tableLog;\n private declare readonly time;\n\n constructor(client: XernerxClient | true) {\n this.client = client;\n\n if (client == true) {\n this.errorLog = true;\n\n this.infoLog = true;\n } else {\n this.errorLog = client.settings.log?.error;\n\n this.infoLog = client.settings.log?.info;\n\n this.readyLog = client.settings.log?.ready;\n\n this.tableLog = client.settings.log?.table;\n }\n\n this.time = () => String(new Date()).split(/ +/)[4];\n }\n\n public info(message: string, force: boolean = false) {\n return this.infoLog || force\n ? console.info(`✔️ | ${Style.log('Xernerx', { color: Style.TextColor.Purple })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`)\n : null;\n }\n\n public warn(message: string) {\n return this.infoLog ? console.warn(`⚠️ | ${Style.log('Xernerx', { color: Style.TextColor.Yellow })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}`) : null;\n }\n\n public async update(version: string, url: string) {\n const pkg = await fetch(url)\n .then(async (res) => await res.json())\n .catch((pkg) => {\n pkg.version || version, pkg.name;\n });\n\n if (version != pkg.version)\n new XernerxLog(true).warn(\n `A new version for ${pkg.name} is available, you're using version ${Style.log(version, { color: Style.TextColor.Cyan })}, new version is ${Style.log(pkg.version, {\n color: Style.TextColor.Cyan,\n })}, run ${Style.log(`npm i ${pkg.name}@${pkg.version}`, { color: Style.BackgroundColor.Grey })} to update to the latest version.`\n );\n }\n\n public error(message: string, error?: XernerxError | unknown) {\n return this.errorLog\n ? console.error(\n `❗ | ${Style.log('Xernerx', { color: Style.TextColor.Red })} | ${Style.log(this.time(), { color: Style.TextColor.Cyan })} | ${message}${\n error ? ` | ${(error as Record<string, string>).stack}` : ''\n }`\n )\n : null;\n }\n\n public ready() {\n if (typeof this.client == 'boolean') return;\n\n const client = this.client as XernerxClient;\n\n this.client.prependOnceListener('ready', async (synced) => {\n this.info(\n `${Style.log(synced.user.tag, { color: Style.TextColor.Blue })} is now ${Style.log('online', { color: Style.TextColor.Green })}, watching ${Style.log(\n String(client.guilds.cache.size),\n {\n color: Style.TextColor.Cyan,\n }\n )} guild${client.guilds.cache.size > 1 ? 's' : ''}, using ${\n client.settings.local ? Style.log((await client.guilds.fetch(client.settings.local)).name, { color: Style.TextColor.Blue }) : 'none'\n } as local guild.`,\n this.readyLog\n );\n\n const files: Array<object> = [];\n\n for (const [id, data] of client.commands.message) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.commands.slash) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.commands.context) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.events) {\n files.push(data);\n id;\n }\n\n for (const [id, data] of client.inhibitors) {\n files.push(data);\n id;\n }\n\n if (this.tableLog) {\n console.table(files, this.tableLog);\n }\n });\n }\n}\n"]}
@@ -1,32 +1,34 @@
1
+ /** @format */
2
+
1
3
  import { ChatInputCommandInteraction, DMChannel, Guild, GuildChannel, GuildMember, Message, MessageContextMenuCommandInteraction, User, UserContextMenuCommandInteraction } from 'discord.js';
2
4
  import InteractionUtil from '../utils/InteractionUtil.js';
3
5
  import MessageUtil from '../utils/MessageUtil.js';
4
6
  export interface XernerxUser extends User {
5
- owner: boolean;
6
- voted: boolean | null;
7
+ owner: boolean;
8
+ voted: boolean | null;
7
9
  }
8
10
  export interface XernerxMember extends GuildMember {
9
- username: string;
11
+ username: string;
10
12
  }
11
13
  export interface XernerxGuild extends Guild {}
12
14
  export interface XernerxGuildChannel extends GuildChannel {}
13
15
  export interface XernerxDMChannel extends DMChannel {}
14
16
  interface XernerxCommand {}
15
17
  export interface XernerxMessage extends Message, XernerxCommand {
16
- user: XernerxUser;
17
- util: MessageUtil;
18
+ user: XernerxUser;
19
+ util: MessageUtil;
18
20
  }
19
21
  export interface XernerxSlashInteraction extends ChatInputCommandInteraction, XernerxCommand {
20
- user: XernerxUser;
21
- util: InteractionUtil;
22
+ user: XernerxUser;
23
+ util: InteractionUtil;
22
24
  }
23
25
  export interface XernerxUserContextInteraction extends UserContextMenuCommandInteraction, XernerxCommand {
24
- user: XernerxUser;
25
- util: InteractionUtil;
26
+ user: XernerxUser;
27
+ util: InteractionUtil;
26
28
  }
27
29
  export interface XernerxMessageContextInteraction extends MessageContextMenuCommandInteraction, XernerxCommand {
28
- user: XernerxUser;
29
- util: InteractionUtil;
30
+ user: XernerxUser;
31
+ util: InteractionUtil;
30
32
  }
31
33
  export {};
32
34
  //# sourceMappingURL=extenders.d.ts.map
@@ -1,2 +1,4 @@
1
+ /** @format */
2
+
1
3
  export {};
2
4
  //# sourceMappingURL=extenders.js.map