xernerx 4.5.23 → 4.5.26

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 (70) hide show
  1. package/README.md +3 -0
  2. package/dist/build/XernerxContextCommand.d.ts +42 -50
  3. package/dist/build/XernerxContextCommand.js +71 -71
  4. package/dist/build/XernerxEvent.d.ts +15 -15
  5. package/dist/build/XernerxEvent.js +22 -22
  6. package/dist/build/XernerxInhibitor.d.ts +14 -25
  7. package/dist/build/XernerxInhibitor.js +20 -20
  8. package/dist/build/XernerxMessageCommand.d.ts +47 -53
  9. package/dist/build/XernerxMessageCommand.js +70 -70
  10. package/dist/build/XernerxSlashCommand.d.ts +57 -71
  11. package/dist/build/XernerxSlashCommand.js +128 -128
  12. package/dist/client/XernerxClient.d.ts +40 -48
  13. package/dist/client/XernerxClient.js +77 -77
  14. package/dist/client/XernerxShardClient.d.ts +12 -12
  15. package/dist/client/XernerxShardClient.js +39 -47
  16. package/dist/functions/deploy.d.ts +1 -1
  17. package/dist/functions/deploy.js +36 -31
  18. package/dist/functions/load.d.ts +1 -1
  19. package/dist/functions/load.js +29 -28
  20. package/dist/functions/reload.d.ts +1 -1
  21. package/dist/functions/reload.js +38 -35
  22. package/dist/functions/sendWebhook.d.ts +1 -1
  23. package/dist/functions/sendWebhook.js +12 -11
  24. package/dist/functions/setPresence.d.ts +2 -2
  25. package/dist/functions/setPresence.js +17 -18
  26. package/dist/functions/xernerxUser.d.ts +1 -1
  27. package/dist/functions/xernerxUser.js +6 -6
  28. package/dist/handlers/CommandHandler.d.ts +9 -9
  29. package/dist/handlers/CommandHandler.d.ts.map +1 -1
  30. package/dist/handlers/CommandHandler.js +281 -249
  31. package/dist/handlers/CommandHandler.js.map +1 -1
  32. package/dist/handlers/EventHandler.d.ts +3 -3
  33. package/dist/handlers/EventHandler.js +19 -19
  34. package/dist/handlers/ExtensionHandler.d.ts +3 -3
  35. package/dist/handlers/ExtensionHandler.js +20 -18
  36. package/dist/handlers/Handler.d.ts +8 -8
  37. package/dist/handlers/Handler.js +42 -32
  38. package/dist/handlers/InhibitorHandler.d.ts +3 -3
  39. package/dist/handlers/InhibitorHandler.js +19 -19
  40. package/dist/handlers/WebhookHandler.d.ts +6 -4
  41. package/dist/handlers/WebhookHandler.js +44 -47
  42. package/dist/main.d.ts +22 -29
  43. package/dist/main.js +22 -29
  44. package/dist/models/Arguments.d.ts +2 -5
  45. package/dist/models/Arguments.js +150 -135
  46. package/dist/tools/XernerxError.d.ts +5 -5
  47. package/dist/tools/XernerxError.js +9 -9
  48. package/dist/tools/XernerxLog.d.ts +13 -13
  49. package/dist/tools/XernerxLog.js +69 -74
  50. package/dist/tools/XernerxText.d.ts +23 -23
  51. package/dist/tools/XernerxText.js +85 -76
  52. package/dist/types/extenders.d.ts +36 -44
  53. package/dist/types/extenders.js +1 -1
  54. package/dist/types/interfaces.d.ts +182 -185
  55. package/dist/types/interfaces.js +1 -1
  56. package/dist/types/types.d.ts +7 -179
  57. package/dist/types/types.js +1 -1
  58. package/dist/utils/ClientUtil.d.ts +9 -11
  59. package/dist/utils/ClientUtil.js +73 -57
  60. package/dist/utils/InteractionUtil.d.ts +7 -7
  61. package/dist/utils/InteractionUtil.js +98 -96
  62. package/dist/utils/MessageUtil.d.ts +11 -11
  63. package/dist/utils/MessageUtil.js +135 -130
  64. package/dist/utils/Util.d.ts +5 -5
  65. package/dist/utils/Util.js +8 -8
  66. package/dist/validators/commandValidation.d.ts +2 -5
  67. package/dist/validators/commandValidation.js +53 -43
  68. package/dist/validators/inhibitorValidations.d.ts +3 -19
  69. package/dist/validators/inhibitorValidations.js +31 -31
  70. package/package.json +16 -13
@@ -10,81 +10,81 @@ import ClientUtil from '../utils/ClientUtil.js';
10
10
  import ExtensionHandler from '../handlers/ExtensionHandler.js';
11
11
  import deploy from '../functions/deploy.js';
12
12
  export default class XernerxClient extends Client {
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
- self: z.boolean().default(true),
31
- bots: z.boolean().default(true),
32
- system: z.boolean().default(true),
33
- users: z.array(z.string()).default([]),
34
- channels: z.array(z.string()).default([]),
35
- guilds: z.array(z.string()).default([]),
36
- })
37
- .optional(),
38
- log: z
39
- .object({
40
- ready: z.boolean().default(false),
41
- info: z.boolean().default(false),
42
- error: z.boolean().default(false),
43
- table: z.array(z.string()).or(z.null()).default(null),
44
- })
45
- .optional(),
46
- cooldown: z
47
- .object({
48
- command: z.number().default(0),
49
- cache: z.number().default(0),
50
- })
51
- .optional(),
52
- })
53
- .parse(xernerxOptions);
54
- this.config = config || null;
55
- this.commands = {
56
- message: new Collection(),
57
- slash: new Collection(),
58
- context: new Collection(),
59
- };
60
- this.events = new Collection();
61
- this.inhibitors = new Collection();
62
- this.modules = {
63
- options: {},
64
- commandHandler: new CommandHandler(this),
65
- eventHandler: new EventHandler(this),
66
- inhibitorHandler: new InhibitorHandler(this),
67
- webhookHandler: new WebhookHandler(this),
68
- extensionHandler: new ExtensionHandler(this),
69
- };
70
- this.util = new ClientUtil(this);
71
- this.stats = {
72
- guildCount: this.guilds.cache.size,
73
- userCount: 0,
74
- shardId: 0,
75
- shardCount: 1,
76
- };
77
- this.cache = {
78
- messages: new Collection(),
79
- cooldowns: new Collection(),
80
- };
81
- return this;
82
- }
83
- async connect(token) {
84
- const login = this.login(token);
85
- deploy(this);
86
- new XernerxLog(this).ready();
87
- return login;
88
- }
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
+ self: z.boolean().default(true),
31
+ bots: z.boolean().default(true),
32
+ system: z.boolean().default(true),
33
+ users: z.array(z.string()).default([]),
34
+ channels: z.array(z.string()).default([]),
35
+ guilds: z.array(z.string()).default([]),
36
+ })
37
+ .optional(),
38
+ log: z
39
+ .object({
40
+ ready: z.boolean().default(false),
41
+ info: z.boolean().default(false),
42
+ error: z.boolean().default(false),
43
+ table: z.array(z.string()).or(z.null()).default(null),
44
+ })
45
+ .optional(),
46
+ cooldown: z
47
+ .object({
48
+ command: z.number().default(0),
49
+ cache: z.number().default(0),
50
+ })
51
+ .optional(),
52
+ })
53
+ .parse(xernerxOptions);
54
+ this.config = config || null;
55
+ this.commands = {
56
+ message: new Collection(),
57
+ slash: new Collection(),
58
+ context: new Collection(),
59
+ };
60
+ this.events = new Collection();
61
+ this.inhibitors = new Collection();
62
+ this.modules = {
63
+ options: {},
64
+ commandHandler: new CommandHandler(this),
65
+ eventHandler: new EventHandler(this),
66
+ inhibitorHandler: new InhibitorHandler(this),
67
+ webhookHandler: new WebhookHandler(this),
68
+ extensionHandler: new ExtensionHandler(this),
69
+ };
70
+ this.util = new ClientUtil(this);
71
+ this.stats = {
72
+ guildCount: this.guilds.cache.size,
73
+ userCount: 0,
74
+ shardId: 0,
75
+ shardCount: 1,
76
+ };
77
+ this.cache = {
78
+ messages: new Collection(),
79
+ cooldowns: new Collection(),
80
+ };
81
+ return this;
82
+ }
83
+ async connect(token) {
84
+ const login = this.login(token);
85
+ deploy(this);
86
+ new XernerxLog(this).ready();
87
+ return login;
88
+ }
89
89
  }
90
- //# sourceMappingURL=XernerxClient.js.map
90
+ //# sourceMappingURL=XernerxClient.js.map
@@ -1,19 +1,19 @@
1
1
  /** @format */
2
2
  import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
3
3
  interface XernerxOptions {
4
- log?: {
5
- info?: boolean;
6
- };
7
- timeout?: number;
4
+ log?: {
5
+ info?: boolean;
6
+ };
7
+ timeout?: number;
8
8
  }
9
9
  export default class XernerxShardClient extends ShardingManager {
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);
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);
17
17
  }
18
18
  export {};
19
- //# sourceMappingURL=XernerxShardClient.d.ts.map
19
+ //# sourceMappingURL=XernerxShardClient.d.ts.map
@@ -3,51 +3,43 @@ import { ShardingManager } from 'discord.js';
3
3
  import XernerxLog from '../tools/XernerxLog.js';
4
4
  import { Style } from 'dumfunctions';
5
5
  export default class XernerxShardClient extends ShardingManager {
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
- if (xernerxOptions?.timeout) setTimeout(() => shard.kill(), xernerxOptions.timeout);
30
- });
31
- const spawn = this.spawn();
32
- spawn.then(async (shards) => {
33
- const collector = setInterval(() => {
34
- const index = shards.size - 1;
35
- if (shards.get(index)?.ready) {
36
- new XernerxLog({ settings: xernerxOptions }).info(
37
- `All Shards launched for ${Style.log(String(this.user?.tag), {
38
- color: Style.TextColor.Blue,
39
- })} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(
40
- String(this.stats.guildCount),
41
- {
42
- color: Style.TextColor.Cyan,
43
- }
44
- )} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`
45
- );
46
- clearInterval(collector);
47
- }
48
- }, 1000);
49
- });
50
- return this;
51
- }
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(`Launched shard ${Style.log(String(shard.id), { color: Style.TextColor.Cyan })} for ${Style.log(this.user?.tag, { color: Style.TextColor.Blue })}!`);
21
+ })
22
+ .on('error', (error) => {
23
+ new XernerxLog({ settings: xernerxOptions }).info(`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}`);
24
+ });
25
+ if (xernerxOptions?.timeout)
26
+ setTimeout(() => shard.kill(), xernerxOptions.timeout);
27
+ });
28
+ const spawn = this.spawn();
29
+ spawn.then(async (shards) => {
30
+ const collector = setInterval(() => {
31
+ const index = shards.size - 1;
32
+ if (shards.get(index)?.ready) {
33
+ new XernerxLog({ settings: xernerxOptions }).info(`All Shards launched for ${Style.log(String(this.user?.tag), {
34
+ color: Style.TextColor.Blue,
35
+ })} with a total of ${Style.log(String(this.stats.shardCount), { color: Style.TextColor.Cyan })} shard${this.stats.shardCount > 1 ? 's' : ''}, watching ${Style.log(String(this.stats.guildCount), {
36
+ color: Style.TextColor.Cyan,
37
+ })} guild${this.stats.guildCount > 1 ? 's' : ''}, and ${Style.log(String(this.stats.userCount), { color: Style.TextColor.Cyan })} user${this.stats.userCount > 1 ? 's' : ''}!`);
38
+ clearInterval(collector);
39
+ }
40
+ }, 1000);
41
+ });
42
+ return this;
43
+ }
52
44
  }
53
- //# sourceMappingURL=XernerxShardClient.js.map
45
+ //# sourceMappingURL=XernerxShardClient.js.map
@@ -1,4 +1,4 @@
1
1
  /** @format */
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
3
  export default function deploy(client: XernerxClient): void;
4
- //# sourceMappingURL=deploy.d.ts.map
4
+ //# sourceMappingURL=deploy.d.ts.map
@@ -5,37 +5,42 @@ import XernerxError from '../tools/XernerxError.js';
5
5
  import { Style } from 'dumfunctions';
6
6
  const commands = [];
7
7
  export default function deploy(client) {
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
- });
8
+ client.prependOnceListener('ready', (client) => {
9
+ if (client.commands.slash.size)
10
+ client.commands.slash.map((command) => commands.push(command.data.toJSON()));
11
+ if (client.commands.context.size)
12
+ client.commands.context.map((command) => commands.push(command.data.toJSON()));
13
+ if (commands.length <= 0)
14
+ return;
15
+ try {
16
+ if (client.settings.global) {
17
+ put(client, client.settings.global, commands);
18
+ put(client, !client.settings.global, []);
19
+ }
20
+ else {
21
+ put(client, !client.settings.global, commands);
22
+ put(client, client.settings.global, []);
23
+ }
24
+ }
25
+ catch (error) {
26
+ new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
27
+ }
28
+ finally {
29
+ new XernerxLog(client).info(`Deployed ${Style.log(String([client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))), {
30
+ color: Style.TextColor.Cyan,
31
+ })} Commands ${client.settings.global
32
+ ? Style.log('globally', { color: Style.TextColor.Green })
33
+ : `${Style.log('locally', { color: Style.TextColor.Red })} in ${Style.log(client.guilds.cache.get(client.settings.local).name, { color: Style.TextColor.Blue })}`}.`);
34
+ }
35
+ });
34
36
  }
35
37
  function put(client, global, 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 });
38
+ const rest = new REST({ version: GatewayVersion }).setToken(client.token);
39
+ if (!global && !client.settings?.local)
40
+ throw new XernerxError(`No guild ID provided as local guild!`);
41
+ if (!global && client.settings?.local)
42
+ rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
43
+ else
44
+ rest.put(Routes.applicationCommands(client.user?.id), { body });
40
45
  }
41
- //# sourceMappingURL=deploy.js.map
46
+ //# sourceMappingURL=deploy.js.map
@@ -2,4 +2,4 @@
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
3
  import { filetype } from '../types/types.js';
4
4
  export default function load(client: XernerxClient, path: string, type: filetype): Promise<any>;
5
- //# sourceMappingURL=load.d.ts.map
5
+ //# sourceMappingURL=load.d.ts.map
@@ -1,34 +1,35 @@
1
1
  /** @format */
2
2
  import XernerxLog from '../tools/XernerxLog.js';
3
3
  export default async function load(client, path, type) {
4
- try {
5
- let file = new (await import(`file://${path}`)).default();
6
- file.filetype = type;
7
- file.filepath = path;
8
- file.client = client;
9
- fileSave(client, file, type);
10
- return file;
11
- } catch (error) {
12
- new XernerxLog(client).error(`Couldn't load ${type} ${path.match(/\w*\.js$/gim)?.at(0) || path}`, error);
13
- }
4
+ try {
5
+ let file = new (await import(`file://${path}`)).default();
6
+ file.filetype = type;
7
+ file.filepath = path;
8
+ file.client = client;
9
+ fileSave(client, file, type);
10
+ return file;
11
+ }
12
+ catch (error) {
13
+ new XernerxLog(client).error(`Couldn't load ${type} ${path.match(/\w*\.js$/gim)?.at(0) || path}`, error);
14
+ }
14
15
  }
15
16
  function fileSave(client, file, type) {
16
- switch (type) {
17
- case 'MessageCommand':
18
- client.commands.message.set(file.name, file);
19
- break;
20
- case 'SlashCommand':
21
- client.commands.slash.set(file.name, file);
22
- break;
23
- case 'ContextCommand':
24
- client.commands.context.set(file.name, file);
25
- break;
26
- case 'Inhibitor':
27
- client.inhibitors.set(file.name, file);
28
- break;
29
- case 'Event':
30
- client.events.set(file.name, file);
31
- break;
32
- }
17
+ switch (type) {
18
+ case 'MessageCommand':
19
+ client.commands.message.set(file.name, file);
20
+ break;
21
+ case 'SlashCommand':
22
+ client.commands.slash.set(file.name, file);
23
+ break;
24
+ case 'ContextCommand':
25
+ client.commands.context.set(file.name, file);
26
+ break;
27
+ case 'Inhibitor':
28
+ client.inhibitors.set(file.name, file);
29
+ break;
30
+ case 'Event':
31
+ client.events.set(file.name, file);
32
+ break;
33
+ }
33
34
  }
34
- //# sourceMappingURL=load.js.map
35
+ //# sourceMappingURL=load.js.map
@@ -1,4 +1,4 @@
1
1
  /** @format */
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
3
  export default function reload(client: XernerxClient, type: 'message' | 'slash' | 'context' | 'event' | 'inhibitor'): Promise<any>[];
4
- //# sourceMappingURL=reload.d.ts.map
4
+ //# sourceMappingURL=reload.d.ts.map
@@ -1,41 +1,44 @@
1
1
  /** @format */
2
2
  var filetypes;
3
3
  (function (filetypes) {
4
- filetypes['message'] = 'MessageCommand';
5
- filetypes['slash'] = 'SlashCommand';
6
- filetypes['context'] = 'ContextCommand';
7
- filetypes['event'] = 'Event';
8
- filetypes['inhibitor'] = 'Inhibitor';
4
+ filetypes["message"] = "MessageCommand";
5
+ filetypes["slash"] = "SlashCommand";
6
+ filetypes["context"] = "ContextCommand";
7
+ filetypes["event"] = "Event";
8
+ filetypes["inhibitor"] = "Inhibitor";
9
9
  })(filetypes || (filetypes = {}));
10
10
  export default function reload(client, type) {
11
- const files = [];
12
- if (type === 'message' || type === 'slash' || type === 'context') {
13
- for (const [name] of client.commands[type]) {
14
- files.push(client.commands[type].get(name).filepath);
15
- }
16
- client.commands[type].sweep(() => true);
17
- }
18
- if (type === 'event') {
19
- for (const [name] of client.events) {
20
- files.push(client.events.get(name).filepath);
21
- }
22
- client.events.sweep(() => true);
23
- }
24
- if (type === 'inhibitor') {
25
- for (const [name] of client.inhibitors) {
26
- files.push(client.inhibitors.get(name).filepath);
27
- }
28
- client.inhibitors.sweep(() => true);
29
- }
30
- return files.map(async (file) => {
31
- let filedata = new (await import(`file://${file}`)).default();
32
- filedata.filetype = filetypes[type];
33
- filedata.filepath = file;
34
- filedata.client = client;
35
- if (type === 'message' || type === 'slash' || type === 'context') client.commands[type].set(filedata.name, filedata);
36
- if (type === 'event') client.events.set(filedata.name, filedata);
37
- if (type === 'inhibitor') client.inhibitors.set(filedata.name, filedata);
38
- return filedata;
39
- });
11
+ const files = [];
12
+ if (type === 'message' || type === 'slash' || type === 'context') {
13
+ for (const [name] of client.commands[type]) {
14
+ files.push(client.commands[type].get(name).filepath);
15
+ }
16
+ client.commands[type].sweep(() => true);
17
+ }
18
+ if (type === 'event') {
19
+ for (const [name] of client.events) {
20
+ files.push(client.events.get(name).filepath);
21
+ }
22
+ client.events.sweep(() => true);
23
+ }
24
+ if (type === 'inhibitor') {
25
+ for (const [name] of client.inhibitors) {
26
+ files.push(client.inhibitors.get(name).filepath);
27
+ }
28
+ client.inhibitors.sweep(() => true);
29
+ }
30
+ return files.map(async (file) => {
31
+ let filedata = new (await import(`file://${file}`)).default();
32
+ filedata.filetype = filetypes[type];
33
+ filedata.filepath = file;
34
+ filedata.client = client;
35
+ if (type === 'message' || type === 'slash' || type === 'context')
36
+ client.commands[type].set(filedata.name, filedata);
37
+ if (type === 'event')
38
+ client.events.set(filedata.name, filedata);
39
+ if (type === 'inhibitor')
40
+ client.inhibitors.set(filedata.name, filedata);
41
+ return filedata;
42
+ });
40
43
  }
41
- //# sourceMappingURL=reload.js.map
44
+ //# sourceMappingURL=reload.js.map
@@ -1,4 +1,4 @@
1
1
  /** @format */
2
2
  import { MessagePayload } from 'discord.js';
3
3
  export default function sendWebhook(url: URL, body: MessagePayload): Promise<any>;
4
- //# sourceMappingURL=sendWebhook.d.ts.map
4
+ //# sourceMappingURL=sendWebhook.d.ts.map
@@ -1,14 +1,15 @@
1
1
  /** @format */
2
2
  export default async function sendWebhook(url, body) {
3
- const response = await fetch(url, {
4
- method: 'POST',
5
- headers: {
6
- 'Content-Type': 'application/json',
7
- },
8
- body: JSON.stringify(body),
9
- });
10
- if (response.status === 204) return true;
11
- const data = await response.json();
12
- return data;
3
+ const response = await fetch(url, {
4
+ method: 'POST',
5
+ headers: {
6
+ 'Content-Type': 'application/json',
7
+ },
8
+ body: JSON.stringify(body),
9
+ });
10
+ if (response.status === 204)
11
+ return true;
12
+ const data = await response.json();
13
+ return data;
13
14
  }
14
- //# sourceMappingURL=sendWebhook.js.map
15
+ //# sourceMappingURL=sendWebhook.js.map
@@ -1,5 +1,5 @@
1
1
  /** @format */
2
2
  import XernerxClient from '../main.js';
3
3
  import { PresenceOptions } from '../types/interfaces.js';
4
- export default function setPresence(client: XernerxClient, options: PresenceOptions): import('discord.js').ClientPresence | undefined;
5
- //# sourceMappingURL=setPresence.d.ts.map
4
+ export default function setPresence(client: XernerxClient, options: PresenceOptions): import("discord.js").ClientPresence | undefined;
5
+ //# sourceMappingURL=setPresence.d.ts.map
@@ -1,21 +1,20 @@
1
1
  /** @format */
2
2
  export default function setPresence(client, options) {
3
- const presence = () =>
4
- client.user?.setPresence({
5
- activities: [
6
- {
7
- name: options.text,
8
- type: options.type,
9
- url: options.url,
10
- },
11
- ],
12
- status: options.status,
13
- });
14
- let response = presence();
15
- if (options.interval)
16
- setInterval(() => {
17
- response = presence();
18
- }, options.interval);
19
- return response;
3
+ const presence = () => client.user?.setPresence({
4
+ activities: [
5
+ {
6
+ name: options.text,
7
+ type: options.type,
8
+ url: options.url,
9
+ },
10
+ ],
11
+ status: options.status,
12
+ });
13
+ let response = presence();
14
+ if (options.interval)
15
+ setInterval(() => {
16
+ response = presence();
17
+ }, options.interval);
18
+ return response;
20
19
  }
21
- //# sourceMappingURL=setPresence.js.map
20
+ //# sourceMappingURL=setPresence.js.map
@@ -2,4 +2,4 @@
2
2
  import XernerxClient from '../client/XernerxClient.js';
3
3
  import { XernerxMessage, XernerxSlashInteraction, XernerxUser, XernerxUserContextInteraction } from '../types/extenders.js';
4
4
  export declare function xernerxUser(event: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction, client: XernerxClient): Promise<XernerxUser>;
5
- //# sourceMappingURL=xernerxUser.d.ts.map
5
+ //# sourceMappingURL=xernerxUser.d.ts.map
@@ -1,11 +1,11 @@
1
1
  /** @format */
2
2
  export async function xernerxUser(event, client) {
3
- const author = event.author || event.user;
4
- author.owner = isOwner(client, author);
5
- author.voted = client.util.hasVoted ? await client.util.hasVoted(author.id) : null;
6
- return author;
3
+ const author = event.author || event.user;
4
+ author.owner = isOwner(client, author);
5
+ author.voted = client.util.hasVoted ? await client.util.hasVoted(author.id) : null;
6
+ return author;
7
7
  }
8
8
  function isOwner(client, user) {
9
- return client.settings.ownerId.includes(user.id);
9
+ return client.settings.ownerId.includes(user.id);
10
10
  }
11
- //# sourceMappingURL=xernerxUser.js.map
11
+ //# sourceMappingURL=xernerxUser.js.map