xernerx 3.3.7 → 3.4.1
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/dist/build/ContextCommandBuilder.d.ts +3 -1
- package/dist/build/ContextCommandBuilder.js +5 -1
- package/dist/build/EventBuilder.d.ts +1 -1
- package/dist/build/EventBuilder.js +1 -1
- package/dist/build/InhibitorBuilder.d.ts +2 -1
- package/dist/build/InhibitorBuilder.js +1 -1
- package/dist/build/MessageCommandBuilder.d.ts +1 -1
- package/dist/build/MessageCommandBuilder.js +1 -1
- package/dist/build/SlashCommandBuilder.d.ts +6 -2
- package/dist/build/SlashCommandBuilder.js +20 -12
- package/dist/build/XContextCommandBuilder.d.ts +40 -0
- package/dist/build/XContextCommandBuilder.js +84 -0
- package/dist/build/XEventBuilder.d.ts +17 -0
- package/dist/build/XEventBuilder.js +35 -0
- package/dist/build/XInhibitorBuilder.d.ts +20 -0
- package/dist/build/XInhibitorBuilder.js +28 -0
- package/dist/build/XMessageCommandBuilder.d.ts +42 -0
- package/dist/build/XMessageCommandBuilder.js +80 -0
- package/dist/build/XSlashCommandBuilder.d.ts +36 -0
- package/dist/build/XSlashCommandBuilder.js +114 -0
- 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 +6 -11
- package/dist/models/CommandArguments.d.ts +2 -2
- package/dist/models/CommandArguments.js +4 -2
- package/dist/models/Events.d.ts +5 -5
- package/dist/models/Events.js +69 -24
- package/dist/models/Extensions.d.ts +4 -3
- package/dist/models/Extensions.js +5 -3
- package/dist/tools/package.d.ts +3 -3
- package/dist/tools/package.js +31 -35
- package/dist/types/enums.js +4 -4
- package/dist/types/options.d.ts +3 -2
- 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 +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChannelType, ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
-
import { XernerxClient } from '../main.js';
|
|
3
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,6 +9,8 @@ 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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
2
|
import { s } from '@sapphire/shapeshift';
|
|
3
|
-
import
|
|
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;
|
|
@@ -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,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
import { InhibitorType } from '../main.js';
|
|
2
3
|
import { InhibitorOptions, MessageArgOptions, SlashArgOptions } from '../types/options.js';
|
|
3
4
|
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
4
5
|
/**
|
|
@@ -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,15 +1,16 @@
|
|
|
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;
|
|
@@ -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,13 +32,13 @@ 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,
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChannelType, ContextMenuCommandBuilder, Interaction } from 'discord.js';
|
|
2
|
+
import { ContextCommandOptions } from '../types/options.js';
|
|
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 XContextCommandBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
data: ContextMenuCommandBuilder;
|
|
12
|
+
description?: string;
|
|
13
|
+
info?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
owner?: boolean;
|
|
16
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
|
+
cooldown?: number;
|
|
18
|
+
ignoreOwner?: boolean;
|
|
19
|
+
channels?: string[];
|
|
20
|
+
guilds?: string[];
|
|
21
|
+
userPermissions?: bigint[];
|
|
22
|
+
clientPermissions?: bigint[];
|
|
23
|
+
defer?: {
|
|
24
|
+
reply?: boolean;
|
|
25
|
+
ephemeral?: boolean;
|
|
26
|
+
fetchReply?: boolean;
|
|
27
|
+
};
|
|
28
|
+
client: XernerxClient | object;
|
|
29
|
+
constructor(id: string, options: ContextCommandOptions);
|
|
30
|
+
/**
|
|
31
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
32
|
+
* @description make any preconditions here.
|
|
33
|
+
*/
|
|
34
|
+
conditions(interaction: Interaction): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
37
|
+
* @description Make your custom command here.
|
|
38
|
+
*/
|
|
39
|
+
exec(interaction: Interaction): Promise<void>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
+
import { s } from '@sapphire/shapeshift';
|
|
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 XContextCommandBuilder {
|
|
10
|
+
id;
|
|
11
|
+
data;
|
|
12
|
+
description;
|
|
13
|
+
info;
|
|
14
|
+
category;
|
|
15
|
+
owner;
|
|
16
|
+
channelType;
|
|
17
|
+
cooldown;
|
|
18
|
+
ignoreOwner;
|
|
19
|
+
channels;
|
|
20
|
+
guilds;
|
|
21
|
+
userPermissions;
|
|
22
|
+
clientPermissions;
|
|
23
|
+
defer;
|
|
24
|
+
client;
|
|
25
|
+
constructor(id, options) {
|
|
26
|
+
this.id = id;
|
|
27
|
+
this.data = new ContextMenuCommandBuilder();
|
|
28
|
+
if (options.name)
|
|
29
|
+
this.data.setName(options.name);
|
|
30
|
+
if (options.type)
|
|
31
|
+
this.data.setType(options.type);
|
|
32
|
+
if (options.defaultMemberPermissions)
|
|
33
|
+
this.data.setDefaultMemberPermissions(options.defaultMemberPermissions);
|
|
34
|
+
if (options.DMPermission)
|
|
35
|
+
this.data.setDMPermission(options.DMPermission);
|
|
36
|
+
if (options.nameLocalization)
|
|
37
|
+
this.data.setNameLocalization(options.nameLocalization.locale, options.nameLocalization.localizedName);
|
|
38
|
+
if (options.nameLocalizations)
|
|
39
|
+
this.data.setNameLocalizations(options.nameLocalizations);
|
|
40
|
+
s.object({
|
|
41
|
+
description: s.string.optional,
|
|
42
|
+
info: s.string.optional,
|
|
43
|
+
category: s.string.optional,
|
|
44
|
+
owner: s.boolean.optional,
|
|
45
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
46
|
+
cooldown: s.number.optional,
|
|
47
|
+
ignoreOwner: s.boolean.optional,
|
|
48
|
+
channels: s.array(s.string).optional,
|
|
49
|
+
guilds: s.array(s.string).optional,
|
|
50
|
+
userPermissions: s.array(s.bigint).optional,
|
|
51
|
+
clientPermissions: s.array(s.bigint).optional,
|
|
52
|
+
defer: s.object({
|
|
53
|
+
reply: s.boolean.optional,
|
|
54
|
+
ephemeral: s.boolean.optional,
|
|
55
|
+
fetchReply: s.boolean.optional,
|
|
56
|
+
}).optional,
|
|
57
|
+
}).parse(options);
|
|
58
|
+
this.description = options.description;
|
|
59
|
+
this.info = options.info;
|
|
60
|
+
this.category = options.category;
|
|
61
|
+
this.owner = options.owner;
|
|
62
|
+
this.channelType = options.channelType;
|
|
63
|
+
this.cooldown = options.cooldown;
|
|
64
|
+
this.ignoreOwner = options.ignoreOwner;
|
|
65
|
+
this.channels = options.channels;
|
|
66
|
+
this.guilds = options.guilds;
|
|
67
|
+
this.userPermissions = options.userPermissions;
|
|
68
|
+
this.clientPermissions = options.clientPermissions;
|
|
69
|
+
this.defer = options.defer;
|
|
70
|
+
this.client = XernerxClient;
|
|
71
|
+
this.conditions = this.conditions;
|
|
72
|
+
this.exec = this.exec;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
76
|
+
* @description make any preconditions here.
|
|
77
|
+
*/
|
|
78
|
+
async conditions(interaction) { }
|
|
79
|
+
/**
|
|
80
|
+
* @param {Interaction} interaction - The Discord interaction event data.
|
|
81
|
+
* @description Make your custom command here.
|
|
82
|
+
*/
|
|
83
|
+
async exec(interaction) { }
|
|
84
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 XEventBuilder {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
emitter?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
once?: boolean;
|
|
14
|
+
client: XernerxClient | object;
|
|
15
|
+
constructor(id: string, options: EventOptions);
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
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 XEventBuilder {
|
|
9
|
+
id;
|
|
10
|
+
name;
|
|
11
|
+
emitter;
|
|
12
|
+
type;
|
|
13
|
+
once;
|
|
14
|
+
client;
|
|
15
|
+
constructor(id, options) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
s.object({
|
|
18
|
+
name: s.string,
|
|
19
|
+
emitter: s.string.optional,
|
|
20
|
+
type: s.string.optional,
|
|
21
|
+
once: s.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
|
+
this.run = this.run;
|
|
29
|
+
}
|
|
30
|
+
async run() {
|
|
31
|
+
/**
|
|
32
|
+
* @description run your custom event here.
|
|
33
|
+
*/
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
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 XInhibitorBuilder {
|
|
9
|
+
id;
|
|
10
|
+
name;
|
|
11
|
+
type;
|
|
12
|
+
client;
|
|
13
|
+
constructor(id, options) {
|
|
14
|
+
this.id = id;
|
|
15
|
+
s.object({
|
|
16
|
+
name: s.string,
|
|
17
|
+
type: s.string,
|
|
18
|
+
}).parse(options);
|
|
19
|
+
this.name = options.name;
|
|
20
|
+
this.type = options.type;
|
|
21
|
+
this.client = XernerxClient;
|
|
22
|
+
this.check = this.check;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
async check(interaction, args) { }
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Message, ChannelType } from 'discord.js';
|
|
2
|
+
import { MessageArgOptions, MessageCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.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 XMessageCommandBuilder {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
aliases?: string[];
|
|
13
|
+
description?: string;
|
|
14
|
+
info?: string;
|
|
15
|
+
category?: string;
|
|
16
|
+
prefix?: string | string[];
|
|
17
|
+
regex?: string;
|
|
18
|
+
owner?: boolean;
|
|
19
|
+
channelType?: ChannelType | ChannelType[];
|
|
20
|
+
separator?: string;
|
|
21
|
+
cooldown?: number;
|
|
22
|
+
ignoreOwner?: boolean;
|
|
23
|
+
channels?: string[];
|
|
24
|
+
guilds?: string[];
|
|
25
|
+
userPermissions?: bigint[];
|
|
26
|
+
clientPermissions?: bigint[];
|
|
27
|
+
args?: Array<MessageArgOptions>;
|
|
28
|
+
client: XernerxClient | object;
|
|
29
|
+
constructor(id: string, options: MessageCommandOptions);
|
|
30
|
+
/**
|
|
31
|
+
* @param {Message} message - The Discord message event data.
|
|
32
|
+
* @param {object} args - The arguments you created.
|
|
33
|
+
* @description make any preconditions here.
|
|
34
|
+
*/
|
|
35
|
+
conditions(message: Message, args: MessageArgOptions): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* @param {Message} message - The Discord message event data.
|
|
38
|
+
* @param {object} args - The arguments you created.
|
|
39
|
+
* @description Make your custom command here.
|
|
40
|
+
*/
|
|
41
|
+
exec(message: Message, args: MessageArgOptions): Promise<void>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { s } from '@sapphire/shapeshift';
|
|
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 XMessageCommandBuilder {
|
|
9
|
+
id;
|
|
10
|
+
name;
|
|
11
|
+
aliases;
|
|
12
|
+
description;
|
|
13
|
+
info;
|
|
14
|
+
category;
|
|
15
|
+
prefix;
|
|
16
|
+
regex;
|
|
17
|
+
owner;
|
|
18
|
+
channelType;
|
|
19
|
+
separator;
|
|
20
|
+
cooldown;
|
|
21
|
+
ignoreOwner;
|
|
22
|
+
channels;
|
|
23
|
+
guilds;
|
|
24
|
+
userPermissions;
|
|
25
|
+
clientPermissions;
|
|
26
|
+
args;
|
|
27
|
+
client;
|
|
28
|
+
constructor(id, options) {
|
|
29
|
+
this.id = id;
|
|
30
|
+
s.object({
|
|
31
|
+
name: s.string,
|
|
32
|
+
aliases: s.union(s.array(s.string).unique, s.string).optional,
|
|
33
|
+
description: s.string.optional,
|
|
34
|
+
info: s.string.optional,
|
|
35
|
+
category: s.string.optional,
|
|
36
|
+
prefix: s.union(s.array(s.string).unique, s.string).optional,
|
|
37
|
+
owner: s.boolean.optional,
|
|
38
|
+
channelType: s.union(s.number, s.array(s.number)).optional,
|
|
39
|
+
separator: s.string.optional,
|
|
40
|
+
cooldown: s.number.optional,
|
|
41
|
+
ignoreOwner: s.boolean.optional,
|
|
42
|
+
channels: s.array(s.string).unique.optional,
|
|
43
|
+
guilds: s.array(s.string).unique.optional,
|
|
44
|
+
userPermissions: s.array(s.bigint).unique.optional,
|
|
45
|
+
clientPermissions: s.array(s.bigint).unique.optional,
|
|
46
|
+
}).parse(options);
|
|
47
|
+
this.name = options.name;
|
|
48
|
+
this.aliases = options.aliases;
|
|
49
|
+
this.description = options.description;
|
|
50
|
+
this.info = options.info;
|
|
51
|
+
this.category = options.category;
|
|
52
|
+
this.prefix = options.prefix ? (Array.isArray(options.prefix) ? options.prefix : [options.prefix]) : [];
|
|
53
|
+
this.regex = options.regex;
|
|
54
|
+
this.owner = options.owner || false;
|
|
55
|
+
this.channelType = options.channelType;
|
|
56
|
+
this.separator = options.separator || ' ';
|
|
57
|
+
this.cooldown = options.cooldown || 0;
|
|
58
|
+
this.ignoreOwner = options.ignoreOwner || false;
|
|
59
|
+
this.channels = options.channels || [];
|
|
60
|
+
this.guilds = options.guilds || [];
|
|
61
|
+
this.userPermissions = options.userPermissions || [];
|
|
62
|
+
this.clientPermissions = options.clientPermissions || [];
|
|
63
|
+
this.args = options.args || [];
|
|
64
|
+
this.client = XernerxClient;
|
|
65
|
+
this.conditions = this.conditions;
|
|
66
|
+
this.exec = this.exec;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param {Message} message - The Discord message event data.
|
|
70
|
+
* @param {object} args - The arguments you created.
|
|
71
|
+
* @description make any preconditions here.
|
|
72
|
+
*/
|
|
73
|
+
async conditions(message, args) { }
|
|
74
|
+
/**
|
|
75
|
+
* @param {Message} message - The Discord message event data.
|
|
76
|
+
* @param {object} args - The arguments you created.
|
|
77
|
+
* @description Make your custom command here.
|
|
78
|
+
*/
|
|
79
|
+
async exec(message, args) { }
|
|
80
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Discord, { ChannelType, Interaction } from 'discord.js';
|
|
2
|
+
import { SlashCommandOptions } from '../types/options.js';
|
|
3
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
+
/**
|
|
5
|
+
* @description - The command builder for slash commands.
|
|
6
|
+
* @param {String} id - The unique ID of the command.
|
|
7
|
+
* @param {SlashCommandOptions} options - The command options.
|
|
8
|
+
*/
|
|
9
|
+
export default class SlashCommandBuilder {
|
|
10
|
+
#private;
|
|
11
|
+
id: string;
|
|
12
|
+
data: Discord.SlashCommandBuilder;
|
|
13
|
+
info?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
owner?: boolean;
|
|
16
|
+
channelType?: ChannelType | ChannelType[];
|
|
17
|
+
separator?: string;
|
|
18
|
+
cooldown?: number;
|
|
19
|
+
ignoreOwner?: boolean;
|
|
20
|
+
channels?: string[];
|
|
21
|
+
guilds?: string[];
|
|
22
|
+
userPermissions?: bigint[];
|
|
23
|
+
clientPermissions?: bigint[];
|
|
24
|
+
args?: object[];
|
|
25
|
+
subcommands?: object[];
|
|
26
|
+
groups?: object[];
|
|
27
|
+
defer?: {
|
|
28
|
+
reply?: boolean;
|
|
29
|
+
ephemeral?: boolean;
|
|
30
|
+
fetchReply?: boolean;
|
|
31
|
+
};
|
|
32
|
+
client: XernerxClient | object;
|
|
33
|
+
constructor(id: string, options: SlashCommandOptions);
|
|
34
|
+
conditions(interaction: Interaction): Promise<void>;
|
|
35
|
+
exec(interaction: Interaction): Promise<void>;
|
|
36
|
+
}
|