xernerx 4.0.5 → 4.2.0

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 (72) hide show
  1. package/dist/build/SlashCommandBuilder.d.ts +1 -0
  2. package/dist/build/SlashCommandBuilder.js +1 -0
  3. package/dist/client/XernerxClient.d.ts +5 -4
  4. package/dist/client/XernerxClient.js +2 -10
  5. package/dist/functions/deploy.js +20 -16
  6. package/dist/handlers/CommandHandler.js +39 -16
  7. package/dist/handlers/EventHandler.js +1 -1
  8. package/dist/handlers/ExtensionHandler.js +1 -1
  9. package/dist/handlers/InhibitorHandler.js +1 -1
  10. package/dist/main.d.ts +3 -2
  11. package/dist/main.js +3 -2
  12. package/dist/tools/XernerxLog.d.ts +1 -0
  13. package/dist/tools/XernerxLog.js +26 -8
  14. package/dist/types/extenders.d.ts +11 -6
  15. package/dist/types/interfaces.d.ts +23 -19
  16. package/dist/utils/ClientUtil.d.ts +2 -1
  17. package/dist/utils/ClientUtil.js +10 -1
  18. package/dist/utils/MessageUtil.d.ts +4 -1
  19. package/dist/utils/MessageUtil.js +4 -2
  20. package/package.json +1 -1
  21. package/dist/build copy/ContextCommandBuilder.d.ts +0 -37
  22. package/dist/build copy/ContextCommandBuilder.js +0 -88
  23. package/dist/build copy/EventBuilder.d.ts +0 -21
  24. package/dist/build copy/EventBuilder.js +0 -34
  25. package/dist/build copy/InhibitorBuilder.d.ts +0 -19
  26. package/dist/build copy/InhibitorBuilder.js +0 -27
  27. package/dist/build copy/MessageCommandBuilder.d.ts +0 -39
  28. package/dist/build copy/MessageCommandBuilder.js +0 -90
  29. package/dist/build copy/SlashCommandBuilder.d.ts +0 -41
  30. package/dist/build copy/SlashCommandBuilder.js +0 -122
  31. package/dist/client/DBLClient.d.ts +0 -8
  32. package/dist/client/DBLClient.js +0 -15
  33. package/dist/client/Top.ggClient.d.ts +0 -1
  34. package/dist/client/Top.ggClient.js +0 -1
  35. package/dist/events/messageCreate.d.ts +0 -1
  36. package/dist/events/messageCreate.js +0 -1
  37. package/dist/functions/AsyncFunctions.d.ts +0 -1
  38. package/dist/functions/AsyncFunctions.js +0 -1
  39. package/dist/functions/getPermissionBitField.d.ts +0 -2
  40. package/dist/functions/getPermissionBitField.js +0 -17
  41. package/dist/functions/hasVoted.d.ts +0 -1
  42. package/dist/functions/hasVoted.js +0 -1
  43. package/dist/functions/voted.d.ts +0 -1
  44. package/dist/functions/voted.js +0 -1
  45. package/dist/models/CommandArguments.d.ts +0 -17
  46. package/dist/models/CommandArguments.js +0 -101
  47. package/dist/models/Events.d.ts +0 -24
  48. package/dist/models/Events.js +0 -297
  49. package/dist/models/Extensions.d.ts +0 -7
  50. package/dist/models/Extensions.js +0 -23
  51. package/dist/models/XernerxUser.d.ts +0 -2
  52. package/dist/models/XernerxUser.js +0 -9
  53. package/dist/tools/classes.d.ts +0 -6
  54. package/dist/tools/classes.js +0 -10
  55. package/dist/tools/loggers.d.ts +0 -4
  56. package/dist/tools/loggers.js +0 -4
  57. package/dist/tools/package.d.ts +0 -42
  58. package/dist/tools/package.js +0 -41
  59. package/dist/types/enums.d.ts +0 -44
  60. package/dist/types/enums.js +0 -35
  61. package/dist/types/options.d.ts +0 -254
  62. package/dist/types/options.js +0 -1
  63. package/dist/utils/CommandUtil.d.ts +0 -58
  64. package/dist/utils/CommandUtil.js +0 -232
  65. package/dist/utils/InteractionArguments.d.ts +0 -1
  66. package/dist/utils/InteractionArguments.js +0 -1
  67. package/dist/validators/CommandValidations.d.ts +0 -12
  68. package/dist/validators/CommandValidations.js +0 -166
  69. package/dist/validators/commands.d.ts +0 -4
  70. package/dist/validators/commands.js +0 -25
  71. /package/dist/validators/{InhibitorValidations.d.ts → inhibitorValidations.d.ts} +0 -0
  72. /package/dist/validators/{InhibitorValidations.js → inhibitorValidations.js} +0 -0
@@ -1,88 +0,0 @@
1
- import { ContextMenuCommandBuilder } from 'discord.js';
2
- import { z } from 'zod';
3
- import XernerxClient from '../client/XernerxClient.js';
4
- /**
5
- * @description The command builder for context commands.
6
- * @param {String} id - The unique ID of the command.
7
- * @param {ContextCommandOptions} options - The command options.
8
- */
9
- export default class ContextCommandBuilder {
10
- id;
11
- data;
12
- name;
13
- type;
14
- description;
15
- info;
16
- category;
17
- channelType;
18
- cooldown;
19
- ignore;
20
- strict;
21
- permissions;
22
- defer;
23
- client;
24
- constructor(id, options) {
25
- this.id = id;
26
- this.data = new ContextMenuCommandBuilder();
27
- if (options.name) this.data.setName(options.name);
28
- if (options.type) this.data.setType(options.type);
29
- if (options.permissions?.users) this.data.setDefaultMemberPermissions(options.permissions?.users);
30
- if (options.permissions?.dm === false) this.data.setDMPermission(options.permissions?.dm);
31
- if (options.nameLocalizations) this.data.setNameLocalizations(options.nameLocalizations);
32
- z.object({
33
- description: z.string(),
34
- info: z.string(),
35
- category: z.string(),
36
- channelType: z.array(z.number()).or(z.number()),
37
- cooldown: z.number(),
38
- ignore: z.object({
39
- owner: z.boolean(),
40
- users: z.array(z.string()),
41
- channels: z.array(z.string()),
42
- guilds: z.array(z.string()),
43
- }),
44
- strict: z.object({
45
- owner: z.boolean(),
46
- users: z.array(z.string()),
47
- channels: z.array(z.string()),
48
- guilds: z.array(z.string()),
49
- }),
50
- permissions: z.object({
51
- client: z.array(z.string()),
52
- users: z.array(z.string()),
53
- dm: z.boolean(),
54
- }),
55
- defer: z.object({
56
- reply: z.boolean(),
57
- ephemeral: z.boolean(),
58
- fetch: z.boolean(),
59
- }),
60
- })
61
- .deepPartial()
62
- .parse(options);
63
- this.name = options.name;
64
- this.type = options.type;
65
- this.description = options.description;
66
- this.info = options.info;
67
- this.category = options.category;
68
- this.channelType = options.channelType;
69
- this.cooldown = options.cooldown;
70
- this.ignore = options.ignore;
71
- this.strict = options.strict;
72
- this.permissions = options.permissions;
73
- this.defer = options.defer;
74
- this.client = XernerxClient;
75
- }
76
- /**
77
- * @param {Interaction} interaction - The Discord interaction event data.
78
- * @description make any preconditions here.
79
- * TODO - update description
80
- */
81
- async conditions(interaction, args) {}
82
- /**
83
- * @param {Interaction} interaction - The Discord interaction event data.
84
- * @description Make your custom command here.
85
- * TODO - update description
86
- */
87
- async exec(interaction, args) {}
88
- }
@@ -1,21 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { EventOptions } from '../types/options.js';
3
- /**
4
- * @description - The event builder for events.
5
- * @param {String} id - The unique ID of the event.
6
- * @param {EventOptions} options - The event options.
7
- */
8
- export default class EventBuilder {
9
- id: string;
10
- name: any;
11
- emitter: any;
12
- type: any;
13
- once: any;
14
- client: typeof XernerxClient;
15
- constructor(id: string, options: EventOptions);
16
- /**
17
- * @description run your custom event here.
18
- * TODO - update description
19
- */
20
- run(): Promise<void>;
21
- }
@@ -1,34 +0,0 @@
1
- import { z } from 'zod';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- /**
4
- * @description - The event builder for events.
5
- * @param {String} id - The unique ID of the event.
6
- * @param {EventOptions} options - The event options.
7
- */
8
- export default class EventBuilder {
9
- id;
10
- name;
11
- emitter;
12
- type;
13
- once;
14
- client;
15
- constructor(id, options) {
16
- this.id = id;
17
- z.object({
18
- name: z.string(),
19
- emitter: z.string().optional(),
20
- type: z.string().optional(),
21
- once: z.boolean().optional(),
22
- }).parse(options);
23
- this.name = options.name;
24
- this.emitter = options.emitter || 'client';
25
- this.type = options.type || 'discord';
26
- this.once = options.once || false;
27
- this.client = XernerxClient;
28
- }
29
- /**
30
- * @description run your custom event here.
31
- * TODO - update description
32
- */
33
- async run() {}
34
- }
@@ -1,19 +0,0 @@
1
- import XernerxClient from '../client/XernerxClient.js';
2
- import { InhibitorOptions, MessageArgumentOptions, SlashArgumentOptions } from '../types/options.js';
3
- import { XernerxInteraction, XernerxMessage } from '../types/types.js';
4
- /**
5
- * @description - The inhibitor builder for inhibitors.
6
- * @param {String} id - The unique ID of the inhibitor.
7
- * @param {InhibitorOptions} options - The inhibitor options.
8
- */
9
- export default class InhibitorBuilder {
10
- id: string;
11
- name: any;
12
- type: any;
13
- client: typeof XernerxClient;
14
- constructor(id: string, options: InhibitorOptions);
15
- /**
16
- * TODO - update description
17
- */
18
- check(interaction: XernerxInteraction | XernerxMessage, args: SlashArgumentOptions | MessageArgumentOptions): Promise<void>;
19
- }
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- /**
4
- * @description - The inhibitor builder for inhibitors.
5
- * @param {String} id - The unique ID of the inhibitor.
6
- * @param {InhibitorOptions} options - The inhibitor options.
7
- */
8
- export default class InhibitorBuilder {
9
- id;
10
- name;
11
- type;
12
- client;
13
- constructor(id, options) {
14
- this.id = id;
15
- z.object({
16
- name: z.string(),
17
- type: z.string(),
18
- }).parse(options);
19
- this.name = options.name;
20
- this.type = options.type;
21
- this.client = XernerxClient;
22
- }
23
- /**
24
- * TODO - update description
25
- */
26
- async check(interaction, args) {}
27
- }
@@ -1,39 +0,0 @@
1
- import { MessageArgumentOptions, MessageCommandOptions } from '../types/options.js';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- import { XernerxMessage } from '../types/types.js';
4
- /**
5
- * @description - The command builder for message commands.
6
- * @param {String} id - The unique ID of the command.
7
- * @param {MessageCommandOptions} options - The command options.
8
- */
9
- export default class MessageCommandBuilder {
10
- id: string;
11
- name: any;
12
- aliases: any;
13
- separator: any;
14
- description: any;
15
- info: any;
16
- category: any;
17
- prefix: any;
18
- regex: any;
19
- channelType: any;
20
- ignore: any;
21
- strict: any;
22
- permissions: any;
23
- cooldown: any;
24
- args: any;
25
- client: typeof XernerxClient;
26
- constructor(id: string, options: MessageCommandOptions);
27
- /**
28
- * @param {Message} message - The Discord message event data.
29
- * @param {object} args - The arguments you created.
30
- * @description make any preconditions here.
31
- */
32
- conditions(message: XernerxMessage, args: MessageArgumentOptions): Promise<void>;
33
- /**
34
- * @param {Message} message - The Discord message event data.
35
- * @param {object} args - The arguments you created.
36
- * @description Make your custom command here.
37
- */
38
- exec(message: XernerxMessage, args: MessageArgumentOptions): Promise<void>;
39
- }
@@ -1,90 +0,0 @@
1
- import { z } from 'zod';
2
- import XernerxClient from '../client/XernerxClient.js';
3
- /**
4
- * @description - The command builder for message commands.
5
- * @param {String} id - The unique ID of the command.
6
- * @param {MessageCommandOptions} options - The command options.
7
- */
8
- export default class MessageCommandBuilder {
9
- id;
10
- name;
11
- aliases;
12
- separator;
13
- description;
14
- info;
15
- category;
16
- prefix;
17
- regex;
18
- channelType;
19
- ignore;
20
- strict;
21
- permissions;
22
- cooldown;
23
- args;
24
- client;
25
- constructor(id, options) {
26
- this.id = id;
27
- z.object({
28
- name: z.string(),
29
- aliases: z.array(z.string()).optional(),
30
- separator: z.string().min(1).max(1).optional(),
31
- description: z.string().optional(),
32
- info: z.string().optional(),
33
- category: z.string().optional(),
34
- prefix: z.array(z.string()).or(z.string()).optional(),
35
- regex: z.unknown(),
36
- channelType: z.array(z.number()).or(z.number()).optional(),
37
- cooldown: z.number().optional(),
38
- ignore: z
39
- .object({
40
- owners: z.boolean().optional(),
41
- users: z.array(z.string()).or(z.string()).optional(),
42
- channels: z.array(z.string()).or(z.string()).optional(),
43
- guilds: z.array(z.string()).or(z.string()).optional(),
44
- })
45
- .optional(),
46
- strict: z
47
- .object({
48
- owners: z.boolean().optional(),
49
- users: z.array(z.string()).or(z.string()).optional(),
50
- channels: z.array(z.string()).or(z.string()).optional(),
51
- guilds: z.array(z.string()).or(z.string()).optional(),
52
- })
53
- .optional(),
54
- permissions: z
55
- .object({
56
- client: z.array(z.string()).optional(),
57
- users: z.array(z.string()).optional(),
58
- dm: z.boolean().optional(),
59
- })
60
- .optional(),
61
- }).parse(options);
62
- this.name = options.name;
63
- this.aliases = options.aliases;
64
- this.separator = options.separator || ' ';
65
- this.description = options.description;
66
- this.info = options.info;
67
- this.category = options.category;
68
- this.prefix = options.prefix ? (Array.isArray(options.prefix) ? options.prefix : [options.prefix]) : [];
69
- this.regex = options.regex;
70
- this.channelType = options.channelType;
71
- this.ignore = options.ignore;
72
- this.strict = options.strict;
73
- this.permissions = options.permissions;
74
- this.cooldown = options.cooldown || 0;
75
- this.args = options.args || [];
76
- this.client = XernerxClient;
77
- }
78
- /**
79
- * @param {Message} message - The Discord message event data.
80
- * @param {object} args - The arguments you created.
81
- * @description make any preconditions here.
82
- */
83
- async conditions(message, args) {}
84
- /**
85
- * @param {Message} message - The Discord message event data.
86
- * @param {object} args - The arguments you created.
87
- * @description Make your custom command here.
88
- */
89
- async exec(message, args) {}
90
- }
@@ -1,41 +0,0 @@
1
- import * as Discord from 'discord.js';
2
- import { Interaction } from 'discord.js';
3
- import { SlashCommandOptions } from '../types/options.js';
4
- import XernerxClient from '../client/XernerxClient.js';
5
- /**
6
- * @description - The command builder for slash commands.
7
- * @param {String} id - The unique ID of the command.
8
- * @param {SlashCommandOptions} options - The command options.
9
- */
10
- export default class SlashCommandBuilder {
11
- id: string;
12
- data: Discord.SlashCommandBuilder;
13
- name: any;
14
- description: any;
15
- info: any;
16
- category: any;
17
- channelType: any;
18
- cooldown: any;
19
- ignore: any;
20
- strict: any;
21
- permissions: any;
22
- args?: object[];
23
- subcommands?: object[];
24
- groups?: object[];
25
- defer: any;
26
- client: typeof XernerxClient;
27
- constructor(id: string, options: SlashCommandOptions);
28
- /**
29
- * TODO - update description
30
- * @param interaction
31
- */
32
- conditions(interaction: Interaction): Promise<void>;
33
- /**
34
- * TODO - update description
35
- * @param interaction
36
- */
37
- exec(interaction: Interaction): Promise<void>;
38
- private addArgs;
39
- private addSubcommands;
40
- private addSubcommandGroups;
41
- }
@@ -1,122 +0,0 @@
1
- import * as Discord from 'discord.js';
2
- import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from 'discord.js';
3
- import { z } from 'zod';
4
- import XernerxError from '../tools/XernerxError.js';
5
- import XernerxClient from '../client/XernerxClient.js';
6
- /**
7
- * @description - The command builder for slash commands.
8
- * @param {String} id - The unique ID of the command.
9
- * @param {SlashCommandOptions} options - The command options.
10
- */
11
- export default class SlashCommandBuilder {
12
- id;
13
- data;
14
- name;
15
- description;
16
- info;
17
- category;
18
- channelType;
19
- cooldown;
20
- ignore;
21
- strict;
22
- permissions;
23
- args;
24
- subcommands;
25
- groups;
26
- defer;
27
- client;
28
- constructor(id, options) {
29
- this.id = id;
30
- this.data = new Discord.SlashCommandBuilder().setName(options.name).setDescription(options.description);
31
- if (options.args && options?.args?.length > 0) {
32
- this.addArgs(this.data, options.args);
33
- }
34
- if (options.subcommands && options?.subcommands?.length > 0) {
35
- this.addSubcommands(this.data, options.subcommands);
36
- }
37
- if (options.groups && options?.groups?.length > 0) {
38
- this.addSubcommandGroups(options.groups);
39
- }
40
- z.object({
41
- description: z.string(),
42
- info: z.string(),
43
- category: z.string(),
44
- channelType: z.array(z.number()).or(z.number()),
45
- cooldown: z.number(),
46
- ignore: z.object({
47
- owner: z.boolean(),
48
- users: z.array(z.string()),
49
- channels: z.array(z.string()),
50
- guilds: z.array(z.string()),
51
- }),
52
- strict: z.object({
53
- owner: z.boolean(),
54
- users: z.array(z.string()),
55
- channels: z.array(z.string()),
56
- guilds: z.array(z.string()),
57
- }),
58
- permissions: z.object({
59
- client: z.array(z.string()),
60
- users: z.array(z.string()),
61
- dm: z.boolean(),
62
- }),
63
- defer: z.object({
64
- reply: z.boolean(),
65
- ephemeral: z.boolean(),
66
- fetch: z.boolean(),
67
- }),
68
- })
69
- .deepPartial()
70
- .parse(options);
71
- this.name = options.name;
72
- this.description = options.description;
73
- this.info = options.info;
74
- this.category = options.category;
75
- this.channelType = options.channelType;
76
- this.cooldown = options.cooldown;
77
- this.ignore = options.ignore;
78
- this.strict = options.strict;
79
- this.permissions = options.permissions;
80
- this.defer = options.defer;
81
- this.client = XernerxClient;
82
- }
83
- /**
84
- * TODO - update description
85
- * @param interaction
86
- */
87
- async conditions(interaction) {}
88
- /**
89
- * TODO - update description
90
- * @param interaction
91
- */
92
- async exec(interaction) {}
93
- addArgs(command, args) {
94
- const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
95
- for (const argument of args) {
96
- if (!types.includes(argument.type.toLowerCase())) throw new XernerxError(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
97
- let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
98
- command[`add${slashArgumentType}Option`]((option) => {
99
- option
100
- .setName(argument.name)
101
- .setDescription(argument.description)
102
- .setRequired(argument.required || false);
103
- if (argument.choices) option.setChoices(...argument?.choices);
104
- return option;
105
- });
106
- }
107
- }
108
- addSubcommands(method, subcommands) {
109
- for (const subcommand of subcommands) {
110
- let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
111
- if (subcommand.args?.length > 0) this.addArgs(sub, subcommand.args);
112
- method.addSubcommand(sub);
113
- }
114
- }
115
- addSubcommandGroups(groups) {
116
- for (const group of groups) {
117
- let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
118
- if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
119
- this.data.addSubcommandGroup(subcommandGroup);
120
- }
121
- }
122
- }
@@ -1,8 +0,0 @@
1
- import { DBL } from 'dbl-sdk';
2
- import XernerxClient from './XernerxClient.js';
3
- import { DBLOptions } from '../types/interfaces.js';
4
- export default class DBLClient {
5
- dbl: DBL | null;
6
- readonly client: XernerxClient;
7
- constructor(client: any, options: DBLOptions);
8
- }
@@ -1,15 +0,0 @@
1
- import { DBL, hasVoted } from 'dbl-sdk';
2
- import XernerxLog from '../tools/XernerxLog.js';
3
- export default class DBLClient {
4
- dbl;
5
- client;
6
- constructor(client, options) {
7
- this.dbl = null;
8
- this.client = client;
9
- this.client.once('ready', (client) => {
10
- this.dbl = new DBL(client, options);
11
- new XernerxLog(this.client).info(`Loaded webhooks!`);
12
- this.client.util.hasVoted = (userId) => hasVoted(userId, client.user.id, this.dbl?.options.topgg?.token, 'top.gg');
13
- });
14
- }
15
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { PermissionNames } from '../types/types.js';
2
- export default function getPermissionBitField(...permissions: Array<PermissionNames | bigint>): bigint;
@@ -1,17 +0,0 @@
1
- import { PermissionFlagsBits } from 'discord.js';
2
- export default function getPermissionBitField(...permissions) {
3
- const bigIntPerms = [0n];
4
- permissions.map((permission) => {
5
- if (typeof permission === 'string') {
6
- permission =
7
- PermissionFlagsBits[
8
- permission
9
- .split(/ +/)
10
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
11
- .join('')
12
- ];
13
- }
14
- bigIntPerms.push(permission);
15
- });
16
- return bigIntPerms.reduce((a, b) => (a += b));
17
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
2
- import { XernerxInteraction, XernerxMessage } from '../types/types.js';
3
- export declare class InteractionArguments {
4
- interaction: XernerxInteraction;
5
- constructor(interaction: XernerxInteraction);
6
- group(): string | undefined;
7
- subcommand(): string | undefined;
8
- arguments(): Record<string, object>;
9
- }
10
- interface Flag {
11
- flags: Record<string, string | boolean>;
12
- }
13
- interface Argument {
14
- [index: string]: string | number | null;
15
- }
16
- export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<import('discord.js').Message<boolean> | Flag | Argument | undefined>;
17
- export {};