xernerx 3.3.6 → 3.4.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.
- package/LICENSE +21 -21
- package/README.md +21 -21
- package/dist/build/ContextCommandBuilder.d.ts +6 -4
- package/dist/build/ContextCommandBuilder.js +8 -4
- package/dist/build/EventBuilder.d.ts +2 -2
- package/dist/build/EventBuilder.js +4 -4
- package/dist/build/InhibitorBuilder.d.ts +4 -3
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +1 -1
- package/dist/build/MessageCommandBuilder.js +2 -2
- package/dist/build/SlashCommandBuilder.d.ts +7 -3
- package/dist/build/SlashCommandBuilder.js +21 -13
- package/dist/build/{ContextCommand.d.ts → XContextCommandBuilder.d.ts} +5 -5
- package/dist/build/{ContextCommand.js → XContextCommandBuilder.js} +5 -5
- package/dist/build/{Event.d.ts → XEventBuilder.d.ts} +3 -3
- package/dist/build/{Event.js → XEventBuilder.js} +5 -5
- package/dist/build/XInhibitorBuilder.d.ts +20 -0
- package/dist/build/{Inhibitor.js → XInhibitorBuilder.js} +4 -4
- package/dist/build/{MessageCommand.d.ts → XMessageCommandBuilder.d.ts} +8 -7
- package/dist/build/{MessageCommand.js → XMessageCommandBuilder.js} +9 -11
- package/dist/build/{SlashCommand.d.ts → XSlashCommandBuilder.d.ts} +4 -4
- package/dist/build/{SlashCommand.js → XSlashCommandBuilder.js} +13 -24
- package/dist/client/XernerxClient.d.ts +1 -1
- package/dist/client/XernerxClient.js +1 -2
- package/dist/handlers/CommandHandler.d.ts +4 -5
- package/dist/handlers/CommandHandler.js +2 -2
- package/dist/handlers/EventHandler.d.ts +4 -5
- package/dist/handlers/EventHandler.js +1 -1
- package/dist/handlers/Handler.d.ts +25 -6
- package/dist/handlers/Handler.js +41 -36
- package/dist/handlers/InhibitorHandler.d.ts +2 -3
- package/dist/main.d.ts +5 -71
- package/dist/main.js +7 -12
- package/dist/models/CommandArguments.d.ts +2 -2
- package/dist/models/CommandArguments.js +4 -2
- package/dist/models/CommandValidations.d.ts +3 -3
- package/dist/models/CommandValidations.js +26 -28
- package/dist/models/Events.d.ts +5 -5
- package/dist/models/Events.js +77 -30
- package/dist/models/Extensions.d.ts +4 -3
- package/dist/models/Extensions.js +5 -3
- package/dist/tools/package.d.ts +38 -0
- package/dist/tools/package.js +37 -0
- package/dist/types/enums.js +4 -4
- package/dist/types/options.d.ts +3 -2
- package/dist/types/{Types.d.ts → types.d.ts} +0 -0
- package/dist/{interfaces/ClientInterfaces.js → types/types.js} +0 -0
- package/dist/utils/ClientUtil.d.ts +1 -1
- package/dist/utils/ClientUtil.js +0 -11
- package/dist/utils/CommandUtil.d.ts +12 -6
- package/dist/utils/CommandUtil.js +26 -14
- package/dist/validators/CommandValidations.d.ts +7 -0
- package/dist/validators/CommandValidations.js +185 -0
- package/dist/validators/InhibitorValidations.d.ts +11 -0
- package/dist/validators/InhibitorValidations.js +42 -0
- package/package.json +7 -6
- package/dist/build/ExtensionBuilder.d.ts +0 -7
- package/dist/build/ExtensionBuilder.js +0 -9
- package/dist/build/Inhibitor.d.ts +0 -18
- package/dist/build/XernerxExtension.d.ts +0 -7
- package/dist/build/XernerxExtension.js +0 -9
- package/dist/handlers/WebhookHandler.d.ts +0 -12
- package/dist/handlers/WebhookHandler.js +0 -36
- package/dist/interfaces/ClientInterfaces.d.ts +0 -65
- package/dist/interfaces/CommandInterfaces.d.ts +0 -94
- package/dist/interfaces/CommandInterfaces.js +0 -1
- package/dist/interfaces/HandlerInterfaces.d.ts +0 -62
- package/dist/interfaces/HandlerInterfaces.js +0 -1
- package/dist/models/Functions.d.ts +0 -1
- package/dist/models/Functions.js +0 -1
- package/dist/types/EventTypes.d.ts +0 -1
- package/dist/types/EventTypes.js +0 -1
- package/dist/types/InhibitorTypes.d.ts +0 -12
- package/dist/types/InhibitorTypes.js +0 -13
- package/dist/types/Types.js +0 -1
- package/dist/types/objects.d.ts +0 -18
- package/dist/types/objects.js +0 -1
- package/scripts/package.d.ts +0 -1
- package/scripts/package.js +0 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Dummi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Dummi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# xernerx
|
|
2
|
-
|
|
3
|
-
Xernerx is a class based discord.js framework. \[BETA\]
|
|
4
|
-
|
|
5
|
-
## Includes
|
|
6
|
-
|
|
7
|
-
> - Slash command handler
|
|
8
|
-
> - Message command handler
|
|
9
|
-
> - Context command handler
|
|
10
|
-
> - Event handler (with custom Events)
|
|
11
|
-
> - Inhibitor handler
|
|
12
|
-
> - Custom utilities
|
|
13
|
-
> - Message command handles
|
|
14
|
-
> - Extension support
|
|
15
|
-
|
|
16
|
-
You can checkout the docs [here](https://
|
|
17
|
-
|
|
18
|
-
## Notes
|
|
19
|
-
|
|
20
|
-
- Only compatible with ESM
|
|
21
|
-
- TypeScript and JavaScript support
|
|
1
|
+
# xernerx
|
|
2
|
+
|
|
3
|
+
Xernerx is a class based discord.js framework. \[BETA\]
|
|
4
|
+
|
|
5
|
+
## Includes
|
|
6
|
+
|
|
7
|
+
> - Slash command handler
|
|
8
|
+
> - Message command handler
|
|
9
|
+
> - Context command handler
|
|
10
|
+
> - Event handler (with custom Events)
|
|
11
|
+
> - Inhibitor handler
|
|
12
|
+
> - Custom utilities
|
|
13
|
+
> - Message command handles
|
|
14
|
+
> - Extension support
|
|
15
|
+
|
|
16
|
+
You can checkout the docs [here](https://xernerx.github.io/xernerx/home.html)
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
|
|
20
|
+
- Only compatible with ESM
|
|
21
|
+
- TypeScript and JavaScript support
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChannelType, ContextMenuCommandBuilder, Interaction } from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { ChannelType, ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
+
import { ContextCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -9,11 +9,13 @@ import { ContextCommandOptions } from "../types/options.js";
|
|
|
9
9
|
export default class ContextCommandBuilder {
|
|
10
10
|
id: string;
|
|
11
11
|
data: ContextMenuCommandBuilder;
|
|
12
|
+
name: string;
|
|
13
|
+
type: number;
|
|
12
14
|
description?: string;
|
|
13
15
|
info?: string;
|
|
14
16
|
category?: string;
|
|
15
17
|
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
18
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
19
|
cooldown?: number;
|
|
18
20
|
ignoreOwner?: boolean;
|
|
19
21
|
channels?: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder
|
|
2
|
-
import { s } from
|
|
3
|
-
import
|
|
1
|
+
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
+
import { s } from '@sapphire/shapeshift';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -9,6 +9,8 @@ import { XernerxClient } from "../main.js";
|
|
|
9
9
|
export default class ContextCommandBuilder {
|
|
10
10
|
id;
|
|
11
11
|
data;
|
|
12
|
+
name;
|
|
13
|
+
type;
|
|
12
14
|
description;
|
|
13
15
|
info;
|
|
14
16
|
category;
|
|
@@ -42,7 +44,7 @@ export default class ContextCommandBuilder {
|
|
|
42
44
|
info: s.string.optional,
|
|
43
45
|
category: s.string.optional,
|
|
44
46
|
owner: s.boolean.optional,
|
|
45
|
-
|
|
47
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
48
|
cooldown: s.number.optional,
|
|
47
49
|
ignoreOwner: s.boolean.optional,
|
|
48
50
|
channels: s.array(s.string).optional,
|
|
@@ -55,6 +57,8 @@ export default class ContextCommandBuilder {
|
|
|
55
57
|
fetchReply: s.boolean.optional,
|
|
56
58
|
}).optional,
|
|
57
59
|
}).parse(options);
|
|
60
|
+
this.name = options.name;
|
|
61
|
+
this.type = options.type;
|
|
58
62
|
this.description = options.description;
|
|
59
63
|
this.info = options.info;
|
|
60
64
|
this.category = options.category;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { EventOptions } from
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { EventOptions } from '../types/options.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
@@ -21,8 +21,8 @@ export default class EventBuilder {
|
|
|
21
21
|
once: s.boolean.optional,
|
|
22
22
|
}).parse(options);
|
|
23
23
|
this.name = options.name;
|
|
24
|
-
this.emitter = options.emitter ||
|
|
25
|
-
this.type = options.type ||
|
|
24
|
+
this.emitter = options.emitter || 'client';
|
|
25
|
+
this.type = options.type || 'discord';
|
|
26
26
|
this.once = options.once || false;
|
|
27
27
|
this.client = XernerxClient;
|
|
28
28
|
this.run = this.run;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { InhibitorType } from '../main.js';
|
|
3
|
+
import { InhibitorOptions, MessageArgOptions, SlashArgOptions } from '../types/options.js';
|
|
4
|
+
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* @description - The inhibitor builder for inhibitors.
|
|
6
7
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The inhibitor builder for inhibitors.
|
|
5
5
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Message, ChannelType } from 'discord.js';
|
|
2
|
-
import { XernerxClient } from '../main.js';
|
|
3
2
|
import { MessageArgOptions, MessageCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description - The command builder for message commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s } from '@sapphire/shapeshift';
|
|
2
|
-
import
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The command builder for message commands.
|
|
5
5
|
* @param {String} id - The unique ID of the command.
|
|
@@ -35,7 +35,7 @@ export default class MessageCommandBuilder {
|
|
|
35
35
|
category: s.string.optional,
|
|
36
36
|
prefix: s.union(s.array(s.string).unique, s.string).optional,
|
|
37
37
|
owner: s.boolean.optional,
|
|
38
|
-
|
|
38
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
39
39
|
separator: s.string.optional,
|
|
40
40
|
cooldown: s.number.optional,
|
|
41
41
|
ignoreOwner: s.boolean.optional,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import Discord, { ChannelType, Interaction } from 'discord.js';
|
|
2
|
-
import { XernerxClient } from '../main.js';
|
|
3
2
|
import { SlashCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description - The command builder for slash commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
7
7
|
* @param {SlashCommandOptions} options - The command options.
|
|
8
8
|
*/
|
|
9
9
|
export default class SlashCommandBuilder {
|
|
10
|
-
#private;
|
|
11
10
|
id: string;
|
|
12
11
|
data: Discord.SlashCommandBuilder;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
13
14
|
info?: string;
|
|
14
15
|
category?: string;
|
|
15
16
|
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
17
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
18
|
separator?: string;
|
|
18
19
|
cooldown?: number;
|
|
19
20
|
ignoreOwner?: boolean;
|
|
@@ -33,4 +34,7 @@ export default class SlashCommandBuilder {
|
|
|
33
34
|
constructor(id: string, options: SlashCommandOptions);
|
|
34
35
|
conditions(interaction: Interaction): Promise<void>;
|
|
35
36
|
exec(interaction: Interaction): Promise<void>;
|
|
37
|
+
private addArgs;
|
|
38
|
+
private addSubcommands;
|
|
39
|
+
private addSubcommandGroups;
|
|
36
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from 'discord.js';
|
|
1
|
+
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, } from 'discord.js';
|
|
2
2
|
import { s } from '@sapphire/shapeshift';
|
|
3
|
-
import { XernerxClient } from '../main.js';
|
|
4
3
|
import XernerxError from '../tools/XernerxError.js';
|
|
4
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
5
5
|
/**
|
|
6
6
|
* @description - The command builder for slash commands.
|
|
7
7
|
* @param {String} id - The unique ID of the command.
|
|
@@ -10,6 +10,8 @@ import XernerxError from '../tools/XernerxError.js';
|
|
|
10
10
|
export default class SlashCommandBuilder {
|
|
11
11
|
id;
|
|
12
12
|
data;
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
13
15
|
info;
|
|
14
16
|
category;
|
|
15
17
|
owner;
|
|
@@ -30,19 +32,19 @@ export default class SlashCommandBuilder {
|
|
|
30
32
|
this.id = id;
|
|
31
33
|
this.data = new Discord.SlashCommandBuilder().setName(options.name).setDescription(options.description);
|
|
32
34
|
if (options.args && options?.args?.length > 0) {
|
|
33
|
-
this
|
|
35
|
+
this.addArgs(this.data, options.args);
|
|
34
36
|
}
|
|
35
37
|
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
36
|
-
this
|
|
38
|
+
this.addSubcommands(this.data, options.subcommands);
|
|
37
39
|
}
|
|
38
40
|
if (options.groups && options?.groups?.length > 0) {
|
|
39
|
-
this
|
|
41
|
+
this.addSubcommandGroups(options.groups);
|
|
40
42
|
}
|
|
41
43
|
s.object({
|
|
42
44
|
info: s.string.optional,
|
|
43
45
|
category: s.string.optional,
|
|
44
46
|
owner: s.boolean.optional,
|
|
45
|
-
|
|
47
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
48
|
separator: s.string.optional,
|
|
47
49
|
cooldown: s.number.optional,
|
|
48
50
|
ignoreOwner: s.boolean.optional,
|
|
@@ -56,6 +58,8 @@ export default class SlashCommandBuilder {
|
|
|
56
58
|
fetchReply: s.boolean.optional,
|
|
57
59
|
}).optional,
|
|
58
60
|
});
|
|
61
|
+
this.name = options.name;
|
|
62
|
+
this.description = options.description;
|
|
59
63
|
this.info = options.info;
|
|
60
64
|
this.category = options.category;
|
|
61
65
|
this.owner = options.owner;
|
|
@@ -74,12 +78,14 @@ export default class SlashCommandBuilder {
|
|
|
74
78
|
}
|
|
75
79
|
async conditions(interaction) { }
|
|
76
80
|
async exec(interaction) { }
|
|
77
|
-
|
|
81
|
+
addArgs(command, args) {
|
|
78
82
|
const types = ['boolean', 'integer', 'number', 'string', 'user', 'role', 'channel', 'mentionable'];
|
|
79
83
|
for (const argument of args) {
|
|
80
84
|
if (!types.includes(argument.type.toLowerCase()))
|
|
81
85
|
throw new XernerxError(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
|
|
82
|
-
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type
|
|
86
|
+
let slashArgumentType = `${argument.type.slice(0, 1).toUpperCase()}${argument.type
|
|
87
|
+
.slice(1)
|
|
88
|
+
.toLowerCase()}`;
|
|
83
89
|
command[`add${slashArgumentType}Option`]((option) => {
|
|
84
90
|
option
|
|
85
91
|
.setName(argument.name)
|
|
@@ -91,19 +97,21 @@ export default class SlashCommandBuilder {
|
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
|
-
|
|
100
|
+
addSubcommands(method, subcommands) {
|
|
95
101
|
for (const subcommand of subcommands) {
|
|
96
102
|
let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
97
103
|
if (subcommand.args?.length > 0)
|
|
98
|
-
this
|
|
104
|
+
this.addArgs(sub, subcommand.args);
|
|
99
105
|
method.addSubcommand(sub);
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
|
|
108
|
+
addSubcommandGroups(groups) {
|
|
103
109
|
for (const group of groups) {
|
|
104
|
-
let subcommandGroup = new SlashCommandSubcommandGroupBuilder()
|
|
110
|
+
let subcommandGroup = new SlashCommandSubcommandGroupBuilder()
|
|
111
|
+
.setName(group.name)
|
|
112
|
+
.setDescription(group.description);
|
|
105
113
|
if (group.subcommands?.length > 0)
|
|
106
|
-
this
|
|
114
|
+
this.addSubcommands(subcommandGroup, group.subcommands);
|
|
107
115
|
this.data.addSubcommandGroup(subcommandGroup);
|
|
108
116
|
}
|
|
109
117
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ChannelType, ContextMenuCommandBuilder, Interaction } from
|
|
2
|
-
import { ContextCommandOptions } from
|
|
3
|
-
import
|
|
1
|
+
import { ChannelType, ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
+
import { ContextCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
7
7
|
* @param {ContextCommandOptions} options - The command options.
|
|
8
8
|
*/
|
|
9
|
-
export default class
|
|
9
|
+
export default class XContextCommandBuilder {
|
|
10
10
|
id: string;
|
|
11
11
|
data: ContextMenuCommandBuilder;
|
|
12
12
|
description?: string;
|
|
13
13
|
info?: string;
|
|
14
14
|
category?: string;
|
|
15
15
|
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
16
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
17
|
cooldown?: number;
|
|
18
18
|
ignoreOwner?: boolean;
|
|
19
19
|
channels?: string[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder
|
|
2
|
-
import { s } from
|
|
3
|
-
import
|
|
1
|
+
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
+
import { s } from '@sapphire/shapeshift';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description The command builder for context commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
7
7
|
* @param {ContextCommandOptions} options - The command options.
|
|
8
8
|
*/
|
|
9
|
-
export default class
|
|
9
|
+
export default class XContextCommandBuilder {
|
|
10
10
|
id;
|
|
11
11
|
data;
|
|
12
12
|
description;
|
|
@@ -42,7 +42,7 @@ export default class ContextCommandBuilder {
|
|
|
42
42
|
info: s.string.optional,
|
|
43
43
|
category: s.string.optional,
|
|
44
44
|
owner: s.boolean.optional,
|
|
45
|
-
|
|
45
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
46
|
cooldown: s.number.optional,
|
|
47
47
|
ignoreOwner: s.boolean.optional,
|
|
48
48
|
channels: s.array(s.string).optional,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { EventOptions } from '../types/options.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
6
6
|
* @param {EventOptions} options - The event options.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export default class XEventBuilder {
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
emitter?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The event builder for events.
|
|
5
5
|
* @param {String} id - The unique ID of the event.
|
|
6
6
|
* @param {EventOptions} options - The event options.
|
|
7
7
|
*/
|
|
8
|
-
export class
|
|
8
|
+
export default class XEventBuilder {
|
|
9
9
|
id;
|
|
10
10
|
name;
|
|
11
11
|
emitter;
|
|
@@ -21,8 +21,8 @@ export class Event {
|
|
|
21
21
|
once: s.boolean.optional,
|
|
22
22
|
}).parse(options);
|
|
23
23
|
this.name = options.name;
|
|
24
|
-
this.emitter = options.emitter ||
|
|
25
|
-
this.type = options.type ||
|
|
24
|
+
this.emitter = options.emitter || 'client';
|
|
25
|
+
this.type = options.type || 'discord';
|
|
26
26
|
this.once = options.once || false;
|
|
27
27
|
this.client = XernerxClient;
|
|
28
28
|
this.run = this.run;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { InhibitorType } from '../main.js';
|
|
3
|
+
import { InhibitorOptions, MessageArgOptions, SlashArgOptions } from '../types/options.js';
|
|
4
|
+
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* @description - The inhibitor builder for inhibitors.
|
|
7
|
+
* @param {String} id - The unique ID of the inhibitor.
|
|
8
|
+
* @param {InhibitorOptions} options - The inhibitor options.
|
|
9
|
+
*/
|
|
10
|
+
export default class XInhibitorBuilder {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: InhibitorType;
|
|
14
|
+
client: XernerxClient | object;
|
|
15
|
+
constructor(id: string, options: InhibitorOptions);
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
check(interaction: XernerxInteraction | XernerxMessage, args: SlashArgOptions | MessageArgOptions): Promise<void>;
|
|
20
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The inhibitor builder for inhibitors.
|
|
5
5
|
* @param {String} id - The unique ID of the inhibitor.
|
|
6
6
|
* @param {InhibitorOptions} options - The inhibitor options.
|
|
7
7
|
*/
|
|
8
|
-
export class
|
|
8
|
+
export default class XInhibitorBuilder {
|
|
9
9
|
id;
|
|
10
10
|
name;
|
|
11
11
|
type;
|
|
@@ -24,5 +24,5 @@ export class Inhibitor {
|
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
|
-
async check() { }
|
|
27
|
+
async check(interaction, args) { }
|
|
28
28
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Message, ChannelType } from 'discord.js';
|
|
2
|
+
import { MessageArgOptions, MessageCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description - The command builder for message commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
7
7
|
* @param {MessageCommandOptions} options - The command options.
|
|
8
8
|
*/
|
|
9
|
-
export default class
|
|
9
|
+
export default class XMessageCommandBuilder {
|
|
10
10
|
id: string;
|
|
11
11
|
name: string;
|
|
12
12
|
aliases?: string[];
|
|
@@ -14,6 +14,7 @@ export default class MessageCommandBuilder {
|
|
|
14
14
|
info?: string;
|
|
15
15
|
category?: string;
|
|
16
16
|
prefix?: string | string[];
|
|
17
|
+
regex?: string;
|
|
17
18
|
owner?: boolean;
|
|
18
19
|
channelType?: ChannelType | ChannelType[];
|
|
19
20
|
separator?: string;
|
|
@@ -23,7 +24,7 @@ export default class MessageCommandBuilder {
|
|
|
23
24
|
guilds?: string[];
|
|
24
25
|
userPermissions?: bigint[];
|
|
25
26
|
clientPermissions?: bigint[];
|
|
26
|
-
args?:
|
|
27
|
+
args?: Array<MessageArgOptions>;
|
|
27
28
|
client: XernerxClient | object;
|
|
28
29
|
constructor(id: string, options: MessageCommandOptions);
|
|
29
30
|
/**
|
|
@@ -31,11 +32,11 @@ export default class MessageCommandBuilder {
|
|
|
31
32
|
* @param {object} args - The arguments you created.
|
|
32
33
|
* @description make any preconditions here.
|
|
33
34
|
*/
|
|
34
|
-
conditions(message: Message, args:
|
|
35
|
+
conditions(message: Message, args: MessageArgOptions): Promise<void>;
|
|
35
36
|
/**
|
|
36
37
|
* @param {Message} message - The Discord message event data.
|
|
37
38
|
* @param {object} args - The arguments you created.
|
|
38
39
|
* @description Make your custom command here.
|
|
39
40
|
*/
|
|
40
|
-
exec(message: Message, args:
|
|
41
|
+
exec(message: Message, args: MessageArgOptions): Promise<void>;
|
|
41
42
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { s } from
|
|
2
|
-
import
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
2
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* @description - The command builder for message commands.
|
|
5
5
|
* @param {String} id - The unique ID of the command.
|
|
6
6
|
* @param {MessageCommandOptions} options - The command options.
|
|
7
7
|
*/
|
|
8
|
-
export default class
|
|
8
|
+
export default class XMessageCommandBuilder {
|
|
9
9
|
id;
|
|
10
10
|
name;
|
|
11
11
|
aliases;
|
|
@@ -13,6 +13,7 @@ export default class MessageCommandBuilder {
|
|
|
13
13
|
info;
|
|
14
14
|
category;
|
|
15
15
|
prefix;
|
|
16
|
+
regex;
|
|
16
17
|
owner;
|
|
17
18
|
channelType;
|
|
18
19
|
separator;
|
|
@@ -34,7 +35,7 @@ export default class MessageCommandBuilder {
|
|
|
34
35
|
category: s.string.optional,
|
|
35
36
|
prefix: s.union(s.array(s.string).unique, s.string).optional,
|
|
36
37
|
owner: s.boolean.optional,
|
|
37
|
-
|
|
38
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
38
39
|
separator: s.string.optional,
|
|
39
40
|
cooldown: s.number.optional,
|
|
40
41
|
ignoreOwner: s.boolean.optional,
|
|
@@ -48,21 +49,18 @@ export default class MessageCommandBuilder {
|
|
|
48
49
|
this.description = options.description;
|
|
49
50
|
this.info = options.info;
|
|
50
51
|
this.category = options.category;
|
|
51
|
-
this.prefix = options.prefix
|
|
52
|
-
|
|
53
|
-
? options.prefix
|
|
54
|
-
: [options.prefix]
|
|
55
|
-
: [];
|
|
52
|
+
this.prefix = options.prefix ? (Array.isArray(options.prefix) ? options.prefix : [options.prefix]) : [];
|
|
53
|
+
this.regex = options.regex;
|
|
56
54
|
this.owner = options.owner || false;
|
|
57
55
|
this.channelType = options.channelType;
|
|
58
|
-
this.separator = options.separator ||
|
|
56
|
+
this.separator = options.separator || ' ';
|
|
59
57
|
this.cooldown = options.cooldown || 0;
|
|
60
58
|
this.ignoreOwner = options.ignoreOwner || false;
|
|
61
59
|
this.channels = options.channels || [];
|
|
62
60
|
this.guilds = options.guilds || [];
|
|
63
61
|
this.userPermissions = options.userPermissions || [];
|
|
64
62
|
this.clientPermissions = options.clientPermissions || [];
|
|
65
|
-
this.args = options.args;
|
|
63
|
+
this.args = options.args || [];
|
|
66
64
|
this.client = XernerxClient;
|
|
67
65
|
this.conditions = this.conditions;
|
|
68
66
|
this.exec = this.exec;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import Discord, { ChannelType, Interaction } from 'discord.js';
|
|
2
|
+
import { SlashCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
4
|
/**
|
|
5
5
|
* @description - The command builder for slash commands.
|
|
6
6
|
* @param {String} id - The unique ID of the command.
|
|
@@ -13,7 +13,7 @@ export default class SlashCommandBuilder {
|
|
|
13
13
|
info?: string;
|
|
14
14
|
category?: string;
|
|
15
15
|
owner?: boolean;
|
|
16
|
-
channelType?: ChannelType;
|
|
16
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
17
|
separator?: string;
|
|
18
18
|
cooldown?: number;
|
|
19
19
|
ignoreOwner?: boolean;
|