xernerx 2.7.5 → 3.0.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/LICENSE +21 -21
- package/README.md +0 -0
- package/dist/build/ContextCommand.d.ts +39 -0
- package/dist/build/ContextCommand.js +86 -0
- package/dist/build/Event.d.ts +15 -0
- package/dist/build/Event.js +31 -0
- package/dist/build/Inhibitor.d.ts +12 -0
- package/dist/build/Inhibitor.js +20 -0
- package/dist/build/MessageCommand.d.ts +39 -0
- package/dist/build/MessageCommand.js +77 -0
- package/dist/build/SlashCommand.d.ts +32 -0
- package/dist/build/SlashCommand.js +119 -0
- package/dist/client/XernerxClient.d.ts +22 -0
- package/dist/client/XernerxClient.js +76 -0
- package/dist/handlers/CommandHandler.d.ts +27 -0
- package/dist/handlers/CommandHandler.js +42 -0
- package/dist/handlers/EventHandler.d.ts +13 -0
- package/dist/handlers/EventHandler.js +16 -0
- package/dist/handlers/Handler.d.ts +37 -0
- package/dist/handlers/Handler.js +242 -0
- package/dist/handlers/InhibitorHandler.d.ts +18 -0
- package/dist/handlers/InhibitorHandler.js +21 -0
- package/dist/interfaces/ClientInterfaces.d.ts +58 -0
- package/dist/interfaces/ClientInterfaces.js +1 -0
- package/dist/interfaces/CommandInterfaces.d.ts +94 -0
- package/dist/interfaces/CommandInterfaces.js +1 -0
- package/dist/interfaces/HandlerInterfaces.d.ts +70 -0
- package/dist/interfaces/HandlerInterfaces.js +1 -0
- package/dist/main.d.ts +26 -0
- package/dist/main.js +40 -0
- package/dist/models/CommandArguments.d.ts +9 -0
- package/dist/models/CommandArguments.js +128 -0
- package/dist/models/CommandValidations.d.ts +3 -0
- package/dist/models/CommandValidations.js +193 -0
- package/dist/models/Events.d.ts +23 -0
- package/dist/models/Events.js +328 -0
- package/dist/models/Functions.d.ts +1 -0
- package/dist/models/Functions.js +30 -0
- package/dist/models/InhibitorValidations.d.ts +17 -0
- package/dist/models/InhibitorValidations.js +42 -0
- package/dist/types/EventTypes.d.ts +1 -0
- package/dist/types/EventTypes.js +1 -0
- package/dist/types/InhibitorTypes.d.ts +12 -0
- package/dist/types/InhibitorTypes.js +13 -0
- package/dist/types/Types.d.ts +24 -0
- package/dist/types/Types.js +21 -0
- package/dist/utils/ClientUtil.d.ts +25 -0
- package/dist/utils/ClientUtil.js +232 -0
- package/dist/utils/CommandUtil.d.ts +38 -0
- package/dist/utils/CommandUtil.js +238 -0
- package/package.json +5 -8
- package/main.js +0 -49
- package/models/Client.js +0 -60
- package/models/commands/ContextMenuCommand.js +0 -68
- package/models/commands/Event.js +0 -33
- package/models/commands/Inhibitor.js +0 -31
- package/models/commands/InteractionCommand.js +0 -142
- package/models/commands/MessageCommand.js +0 -86
- package/models/data/colors.json +0 -16
- package/models/data/options.json +0 -27
- package/models/events/interactionCreate.js +0 -84
- package/models/events/messageCreate.js +0 -84
- package/models/events/messageUpdate.js +0 -83
- package/models/events/readyOnce.js +0 -58
- package/models/handlers/CommandHandler.js +0 -37
- package/models/handlers/EventHandler.js +0 -67
- package/models/handlers/Handler.js +0 -111
- package/models/handlers/InhibitorHandler.js +0 -16
- package/models/handlers/LanguageHandler.js +0 -37
- package/models/utils/Arguments.js +0 -120
- package/models/utils/CommandValidation.js +0 -96
- package/models/utils/CommandsUtil.js +0 -70
- package/models/utils/Functions.js +0 -266
- package/models/utils/InhibitorsUtil.js +0 -24
- package/models/utils/InhibitorsValidation.js +0 -40
- package/models/utils/Util.js +0 -96
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const { s } = require('@sapphire/shapeshift');
|
|
2
|
-
const Discord = require('discord.js');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {String} name - The name of the context menu;
|
|
6
|
-
* @param {String || Number} type - The type of the context menu 1 || 2 - user || message
|
|
7
|
-
*/
|
|
8
|
-
class ContextMenuCommand {
|
|
9
|
-
constructor(id, options = {}) {
|
|
10
|
-
|
|
11
|
-
s.object({
|
|
12
|
-
name: s.string,
|
|
13
|
-
type: s.string || s.number,
|
|
14
|
-
inVoice: s.boolean.optional,
|
|
15
|
-
owner: s.boolean.optional,
|
|
16
|
-
admin: s.boolean.optional,
|
|
17
|
-
info: s.string.optional,
|
|
18
|
-
category: s.string.optional,
|
|
19
|
-
channels: s.array(s.string).optional,
|
|
20
|
-
guilds: s.array(s.string).optional,
|
|
21
|
-
userPermissions: s.array(s.string).optional,
|
|
22
|
-
clientPermissions: s.array(s.string).optional,
|
|
23
|
-
description: s.string.optional
|
|
24
|
-
}).parse(options)
|
|
25
|
-
|
|
26
|
-
this.data = new Discord.ContextMenuCommandBuilder()
|
|
27
|
-
.setName(options.name)
|
|
28
|
-
.setType(this.types(options.type))
|
|
29
|
-
|
|
30
|
-
this.inVoice = options.inVoice || false;
|
|
31
|
-
|
|
32
|
-
this.category = options.category || undefined;
|
|
33
|
-
|
|
34
|
-
this.owner = options.owner || false;
|
|
35
|
-
|
|
36
|
-
this.admin = options.admin || false;
|
|
37
|
-
|
|
38
|
-
this.info = options.info || undefined;
|
|
39
|
-
|
|
40
|
-
this.channels = options.channels || [];
|
|
41
|
-
|
|
42
|
-
this.guilds = options.guilds || [];
|
|
43
|
-
|
|
44
|
-
this.userPermissions = options.userPermissions || [];
|
|
45
|
-
|
|
46
|
-
this.clientPermissions = options.clientPermissions || [];
|
|
47
|
-
|
|
48
|
-
this.config = options.config;
|
|
49
|
-
|
|
50
|
-
this.description = options.description || undefined;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
exec(interaction) {
|
|
54
|
-
/*
|
|
55
|
-
* Make your custom command here.
|
|
56
|
-
*/
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
types(str) {
|
|
60
|
-
if (String(str)?.toLowerCase() == "message") str = 3;
|
|
61
|
-
|
|
62
|
-
if (String(str)?.toLowerCase() == "user") str = 2;
|
|
63
|
-
|
|
64
|
-
return str;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = { ContextMenuCommand };
|
package/models/commands/Event.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const { s } = require('@sapphire/shapeshift')
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {String} id - The id of the event. @required
|
|
5
|
-
* @param {object} options - of the event. @required
|
|
6
|
-
* @param {string} name - The name of the event. @required
|
|
7
|
-
* @param {boolean} once - Whether the event should be ran once or continuously.
|
|
8
|
-
*/
|
|
9
|
-
class Event {
|
|
10
|
-
constructor(id, options = {}) {
|
|
11
|
-
s.object({
|
|
12
|
-
name: s.string,
|
|
13
|
-
once: s.boolean.optional,
|
|
14
|
-
type: s.string.optional
|
|
15
|
-
}).parse(options)
|
|
16
|
-
|
|
17
|
-
this.name = options.name;
|
|
18
|
-
|
|
19
|
-
this.once = options.once || false;
|
|
20
|
-
|
|
21
|
-
this.type = options.type || 'client';
|
|
22
|
-
|
|
23
|
-
this.config = options.config;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
run(event) {
|
|
27
|
-
/*
|
|
28
|
-
* Make your custom event here.
|
|
29
|
-
*/
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = { Event };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const { s } = require('@sapphire/shapeshift')
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {String} id - The id of the event. @required
|
|
5
|
-
* @param {object} options - of the event. @required
|
|
6
|
-
* @param {string} name - The name of the event. @required
|
|
7
|
-
* @param {boolean} once - Whether the event should be ran once or continuously.
|
|
8
|
-
*/
|
|
9
|
-
class Inhibitor {
|
|
10
|
-
constructor(id, options = {}) {
|
|
11
|
-
s.object({
|
|
12
|
-
name: s.string,
|
|
13
|
-
type: s.string
|
|
14
|
-
}).parse(options)
|
|
15
|
-
|
|
16
|
-
this.id = id;
|
|
17
|
-
|
|
18
|
-
this.name = options.name;
|
|
19
|
-
|
|
20
|
-
this.type = options.type || undefined;
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
check(event) {
|
|
25
|
-
/*
|
|
26
|
-
* Make your custom event here.
|
|
27
|
-
*/
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = { Inhibitor };
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
const { s } = require('@sapphire/shapeshift');
|
|
2
|
-
const { SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandBuilder, SlashCommandBuilder } = require('discord.js');
|
|
3
|
-
const { toTitleCase } = require('dumfunctions');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {string} name - The name of the command. @required
|
|
7
|
-
* @param {string} description - The brief description of the command. @required
|
|
8
|
-
* @param {string} detailedDescription - The detailed description of the command.
|
|
9
|
-
* @param {boolean} owner - Wether the command can be executed by the bot owner only or not.
|
|
10
|
-
* @param {boolean} admin - Wether the command can be executed by the guild admins only or not.
|
|
11
|
-
* @param {string} channel - Wheter the command can only be executed in a DM, a Guild, or both.
|
|
12
|
-
*/
|
|
13
|
-
class InteractionCommand {
|
|
14
|
-
constructor(id, options = {}) {
|
|
15
|
-
|
|
16
|
-
s.object({
|
|
17
|
-
name: s.string,
|
|
18
|
-
description: s.string,
|
|
19
|
-
info: s.string.optional,
|
|
20
|
-
owner: s.boolean.optional,
|
|
21
|
-
admin: s.boolean.optional,
|
|
22
|
-
channel: s.string.optional,
|
|
23
|
-
category: s.string.optional,
|
|
24
|
-
cooldown: s.number.optional,
|
|
25
|
-
ignoreOwner: s.boolean.optional,
|
|
26
|
-
inVoice: s.boolean.optional,
|
|
27
|
-
channels: s.array(s.string).optional,
|
|
28
|
-
guilds: s.array(s.string).optional,
|
|
29
|
-
userPermissions: s.array(s.string).optional,
|
|
30
|
-
clientPermissions: s.array(s.string).optional,
|
|
31
|
-
defer: s.object({
|
|
32
|
-
reply: s.boolean.optional,
|
|
33
|
-
ephemeral: s.boolean.optional
|
|
34
|
-
}).optional
|
|
35
|
-
}).parse(options);
|
|
36
|
-
|
|
37
|
-
this.data = new SlashCommandBuilder()
|
|
38
|
-
.setName(options.name)
|
|
39
|
-
.setDescription(options.description)
|
|
40
|
-
|
|
41
|
-
if (["args", "subcommands", "groups"].map(x => options[x]?.length).filter(x => x).length > 1) throw new Error("Args, subs, and groups are mutually exclusive");
|
|
42
|
-
|
|
43
|
-
if (options?.args?.length > 0) {
|
|
44
|
-
this.addOptions(this.data, options.args);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
else if (options?.subs?.length > 0) {
|
|
48
|
-
this.addSubcommands(this.data, options.subs);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
else if (options?.groups?.length > 0) {
|
|
52
|
-
this.addSubcommandGroups(options.groups);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this.id = id;
|
|
56
|
-
|
|
57
|
-
this.owner = options.owner || false;
|
|
58
|
-
|
|
59
|
-
this.admin = options.admin || false;
|
|
60
|
-
|
|
61
|
-
this.channel = options.channel || undefined;
|
|
62
|
-
|
|
63
|
-
this.category = options.category || undefined;
|
|
64
|
-
|
|
65
|
-
this.config = options.config;
|
|
66
|
-
|
|
67
|
-
this.cooldown = options.cooldown || 0;
|
|
68
|
-
|
|
69
|
-
this.ignoreOwner = options.ignoreOwner || false;
|
|
70
|
-
|
|
71
|
-
this.inVoice = options.inVoice || false;
|
|
72
|
-
|
|
73
|
-
this.info = options.info || undefined;
|
|
74
|
-
|
|
75
|
-
this.channels = options.channels || [];
|
|
76
|
-
|
|
77
|
-
this.guilds = options.guilds || [];
|
|
78
|
-
|
|
79
|
-
this.userPermissions = options.userPermissions || [];
|
|
80
|
-
|
|
81
|
-
this.clientPermissions = options.clientPermissions || [];
|
|
82
|
-
|
|
83
|
-
this.defer = {
|
|
84
|
-
reply: options?.defer?.reply === undefined ? null : options?.defer?.reply,
|
|
85
|
-
ephemeral: options?.defer?.ephemeral === undefined ? null : options?.defer?.ephemeral
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
exec(interaction) {
|
|
90
|
-
/*
|
|
91
|
-
* Make your custom command here.
|
|
92
|
-
*/
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
addOptions(where, args) {
|
|
96
|
-
const types = ["boolean", "integer", "number", "string", "user", "role", "channel", "mentionable"];
|
|
97
|
-
|
|
98
|
-
for (const argument of args) {
|
|
99
|
-
if (!types.includes(argument.type.toLowerCase())) throw new Error(`Expected one of ${types.join(', ')}, received ${argument.type} instead.`);
|
|
100
|
-
|
|
101
|
-
where[`add${toTitleCase(argument.type, true)}Option`](option => {
|
|
102
|
-
option
|
|
103
|
-
.setName(argument.name)
|
|
104
|
-
.setDescription(argument.description)
|
|
105
|
-
.setRequired(argument.required || false)
|
|
106
|
-
if (argument.choices) option.setChoices(...argument?.choices);
|
|
107
|
-
|
|
108
|
-
return option;
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
addSubcommands(where, subs) {
|
|
114
|
-
for (const sub of subs) {
|
|
115
|
-
let subCommand = new SlashCommandSubcommandBuilder()
|
|
116
|
-
.setName(sub.name)
|
|
117
|
-
.setDescription(sub.description);
|
|
118
|
-
if (sub?.args?.length > 0) {
|
|
119
|
-
this.addOptions(subCommand, sub.args)
|
|
120
|
-
}
|
|
121
|
-
where.addSubcommand(subCommand);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
addSubcommandGroups(groups) {
|
|
126
|
-
for (const group of groups) {
|
|
127
|
-
let subcommandGroup = new SlashCommandSubcommandGroupBuilder()
|
|
128
|
-
.setName(group.name)
|
|
129
|
-
.setDescription(group.description)
|
|
130
|
-
|
|
131
|
-
if (group?.subs?.length > 0) {
|
|
132
|
-
this.addSubcommands(subcommandGroup, group.subs)
|
|
133
|
-
if (group?.subs?.args) {
|
|
134
|
-
this.addOptions(group.subs, group.subs.args)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
this.data.addSubcommandGroup(subcommandGroup);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
module.exports = { InteractionCommand };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const { s } = require('@sapphire/shapeshift');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} name - The name of the command. @required
|
|
5
|
-
* @param {string} aliases - Optional aliases of the command.
|
|
6
|
-
* @param {string} description - The brief description of the command. @required
|
|
7
|
-
* @param {string} detailedDescription - The detailed description of the command.
|
|
8
|
-
* @param {boolean} owner - Wether the command can be executed by the bot owner only or not.
|
|
9
|
-
* @param {boolean} admin - Wether the command can be executed by the guild admins only or not.
|
|
10
|
-
* @param {string} channel - Whether the command can only be executed in a DM, a Guild, or both.
|
|
11
|
-
* @param {string} separator - A string used to separate arguments.
|
|
12
|
-
*/
|
|
13
|
-
class MessageCommand {
|
|
14
|
-
constructor(id, options = {}) {
|
|
15
|
-
|
|
16
|
-
s.object({
|
|
17
|
-
name: s.string,
|
|
18
|
-
aliases: s.array(s.string).optional,
|
|
19
|
-
description: s.string,
|
|
20
|
-
prefix: s.array(s.string).optional,
|
|
21
|
-
info: s.string.optional,
|
|
22
|
-
owner: s.boolean.optional,
|
|
23
|
-
admin: s.boolean.optional,
|
|
24
|
-
channel: s.string.optional,
|
|
25
|
-
separator: s.string.optional,
|
|
26
|
-
category: s.string.optional,
|
|
27
|
-
cooldown: s.number.optional,
|
|
28
|
-
ignoreOwner: s.boolean.optional,
|
|
29
|
-
inVoice: s.boolean.optional,
|
|
30
|
-
channels: s.array(s.string).optional,
|
|
31
|
-
guilds: s.array(s.string).optional,
|
|
32
|
-
userPermissions: s.array(s.string).optional,
|
|
33
|
-
clientPermissions: s.array(s.string).optional
|
|
34
|
-
}).parse(options);
|
|
35
|
-
|
|
36
|
-
this.id = id;
|
|
37
|
-
|
|
38
|
-
this.name = options.name;
|
|
39
|
-
|
|
40
|
-
this.aliases = [options.name, ...(options.aliases ? options.aliases : [])];
|
|
41
|
-
|
|
42
|
-
this.regex = options.regex instanceof RegExp ? String(options.regex) : undefined;
|
|
43
|
-
|
|
44
|
-
this.prefix = options.prefix || [];
|
|
45
|
-
|
|
46
|
-
this.description = options.description || undefined;
|
|
47
|
-
|
|
48
|
-
this.owner = options.owner || undefined;
|
|
49
|
-
|
|
50
|
-
this.admin = options.admin || undefined;
|
|
51
|
-
|
|
52
|
-
this.channel = options.channel || undefined;
|
|
53
|
-
|
|
54
|
-
this.separator = options.separator || ' '
|
|
55
|
-
|
|
56
|
-
this.args = options.args;
|
|
57
|
-
|
|
58
|
-
this.category = options.category || undefined;
|
|
59
|
-
|
|
60
|
-
this.config = options.config;
|
|
61
|
-
|
|
62
|
-
this.cooldown = options.cooldown || 0;
|
|
63
|
-
|
|
64
|
-
this.ignoreOwner = options.ignoreOwner || false;
|
|
65
|
-
|
|
66
|
-
this.inVoice = options.inVoice || false;
|
|
67
|
-
|
|
68
|
-
this.info = options.info || undefined;
|
|
69
|
-
|
|
70
|
-
this.channels = options.channels || [];
|
|
71
|
-
|
|
72
|
-
this.guilds = options.guilds || [];
|
|
73
|
-
|
|
74
|
-
this.userPermissions = options.userPermissions || [];
|
|
75
|
-
|
|
76
|
-
this.clientPermissions = options.clientPermissions || [];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
exec(message) {
|
|
80
|
-
/*
|
|
81
|
-
* Make your custom command here.
|
|
82
|
-
*/
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
module.exports = { MessageCommand };
|
package/models/data/colors.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"red": "#ff0000",
|
|
3
|
-
"orange": "#ff8000",
|
|
4
|
-
"yellow": "#ffff00",
|
|
5
|
-
"chartreuse": "#80ff00",
|
|
6
|
-
"green": "#00ff00",
|
|
7
|
-
"springGreen": "#00ff80",
|
|
8
|
-
"cyan": "#00ffff",
|
|
9
|
-
"dodgerBlue": "#0080ff",
|
|
10
|
-
"blue": "#0000ff",
|
|
11
|
-
"purple": "#8000ff",
|
|
12
|
-
"violet": "#ff00ff",
|
|
13
|
-
"magenta": "#ff0080",
|
|
14
|
-
"black": "#000000",
|
|
15
|
-
"white": "#FFFFFF"
|
|
16
|
-
}
|
package/models/data/options.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
"one",
|
|
3
|
-
"two",
|
|
4
|
-
"three",
|
|
5
|
-
"four",
|
|
6
|
-
"five",
|
|
7
|
-
"six",
|
|
8
|
-
"seven",
|
|
9
|
-
"eight",
|
|
10
|
-
"nine",
|
|
11
|
-
"ten",
|
|
12
|
-
"eleven",
|
|
13
|
-
"twelve",
|
|
14
|
-
"thirteen",
|
|
15
|
-
"fourteen",
|
|
16
|
-
"fifteen",
|
|
17
|
-
"sixteen",
|
|
18
|
-
"seventeen",
|
|
19
|
-
"eighteen",
|
|
20
|
-
"nineteen",
|
|
21
|
-
"twenty",
|
|
22
|
-
"twentyone",
|
|
23
|
-
"twentytwo",
|
|
24
|
-
"twentythree",
|
|
25
|
-
"twentyfour",
|
|
26
|
-
"twentyfive"
|
|
27
|
-
]
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const { Event } = require('../commands/Event.js');
|
|
2
|
-
const { interactionArgs } = require('./../utils/Arguments.js');
|
|
3
|
-
const { InteractionType } = require('discord.js')
|
|
4
|
-
const { commandValidation } = require('./../utils/CommandValidation.js');
|
|
5
|
-
const { interactionUtil } = require('./../utils/Util.js');
|
|
6
|
-
const { inhibitorsValidation } = require('../utils/InhibitorsValidation.js');
|
|
7
|
-
/**
|
|
8
|
-
* @returns interaction command executor.
|
|
9
|
-
*/
|
|
10
|
-
class BuildInInteractionEvent extends Event {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('interactionCreate', {
|
|
13
|
-
name: 'interactionCreate',
|
|
14
|
-
type: 'client',
|
|
15
|
-
once: false,
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async run(interaction) {
|
|
20
|
-
await interactionUtil(interaction);
|
|
21
|
-
|
|
22
|
-
if (interaction.type == InteractionType.ApplicationCommand) {
|
|
23
|
-
if (interaction.client.commands.interaction.has(interaction.commandName)) {
|
|
24
|
-
let command = interaction.client.commands.interaction.get(interaction.commandName);
|
|
25
|
-
|
|
26
|
-
if (await inhibitorsValidation(interaction, command)) return;
|
|
27
|
-
|
|
28
|
-
await this.defer(interaction, command);
|
|
29
|
-
|
|
30
|
-
command.client = interaction.client;
|
|
31
|
-
|
|
32
|
-
const group = interactionArgs(interaction).group;
|
|
33
|
-
|
|
34
|
-
const subcommand = interactionArgs(interaction).sub;
|
|
35
|
-
|
|
36
|
-
const args = interactionArgs(interaction).options;
|
|
37
|
-
|
|
38
|
-
if (commandValidation(interaction, command)) return;
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
if (command.conditions && await command.conditions(interaction, { group, subcommand, args })) return;
|
|
42
|
-
|
|
43
|
-
await command.exec(interaction, { group, subcommand, args });
|
|
44
|
-
|
|
45
|
-
return interaction.client.emit('commandRun', interaction, "interaction", command)
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
return interaction.client.emit("error", interaction, error);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (interaction.client.commands.contextMenu.has(interaction.commandName)) {
|
|
53
|
-
let command = interaction.client.commands.contextMenu.get(interaction.commandName);
|
|
54
|
-
|
|
55
|
-
if (await inhibitorsValidation(interaction, command)) return;
|
|
56
|
-
|
|
57
|
-
await this.defer(interaction, command);
|
|
58
|
-
|
|
59
|
-
command.client = interaction.client;
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
if (command.conditions && await command.conditions(interaction)) return;
|
|
63
|
-
|
|
64
|
-
await command.exec(interaction);
|
|
65
|
-
|
|
66
|
-
return interaction.client.emit('commandRun', interaction, 'contextMenu', command);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
return interaction.client.emit("error", interaction, error);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async defer(interaction, command) {
|
|
76
|
-
if (command?.defer?.reply) return await interaction.deferReply({ ephemeral: command?.defer?.ephemeral });
|
|
77
|
-
|
|
78
|
-
else if (command?.defer?.reply === false && interaction.client?.settings?.defer?.reply) return;
|
|
79
|
-
|
|
80
|
-
else if (interaction.client?.settings?.defer?.reply) return await interaction.deferReply({ ephemeral: interaction.client?.settings?.defer?.ephemeral || command?.defer?.ephemeral });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
module.exports = BuildInInteractionEvent;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const { Event } = require('../commands/Event.js');
|
|
2
|
-
const { messageArgs } = require("./../utils/Arguments.js");
|
|
3
|
-
const { commandValidation } = require('./../utils/CommandValidation.js');
|
|
4
|
-
const { messageUtil } = require('../utils/Util.js');
|
|
5
|
-
const { inhibitorsValidation } = require('../utils/InhibitorsValidation.js');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @returns message command executor.
|
|
9
|
-
*/
|
|
10
|
-
class BuildInMessageEvent extends Event {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('messageCreate', {
|
|
13
|
-
name: 'messageCreate',
|
|
14
|
-
type: 'client',
|
|
15
|
-
once: false,
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async run(message) {
|
|
20
|
-
if (!message.author.bot) {
|
|
21
|
-
await messageUtil(message, "create");
|
|
22
|
-
|
|
23
|
-
let commands = message.client.commands.message;
|
|
24
|
-
|
|
25
|
-
commands.filter(c => c.regex).map(async command => {
|
|
26
|
-
let regex = command.regex.split(/\//).slice(1);
|
|
27
|
-
|
|
28
|
-
regex = RegExp(...regex);
|
|
29
|
-
|
|
30
|
-
if (message.content.match(regex)) {
|
|
31
|
-
try {
|
|
32
|
-
if (command.conditions && (await command.conditions(message))) return;
|
|
33
|
-
|
|
34
|
-
return await command.exec(message);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
message.client.emit("error", message, error);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
if (message?.client?.settings?.prefix?.length <= 0 && !message.client.settings.mentionPrefix) return;
|
|
43
|
-
|
|
44
|
-
commands.filter(c => !c.regex).map(async command => {
|
|
45
|
-
command?.prefix?.map(prefix => {
|
|
46
|
-
this.commandCheck(message, prefix, command);
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
if (message.client.settings.mentionPrefix && !message.client.settings.prefix.includes(`<@${message.client.user.id}>`)) message.client.settings.prefix.push(`<@${message.client.user.id}>`)
|
|
50
|
-
|
|
51
|
-
message.client.settings.prefix.map(prefix => {
|
|
52
|
-
this.commandCheck(message, prefix, command);
|
|
53
|
-
});
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async commandCheck(message, prefix, command) {
|
|
59
|
-
for (const alias of command.aliases) {
|
|
60
|
-
if (message.content.split(/ +/)[0] !== prefix + alias) continue;
|
|
61
|
-
|
|
62
|
-
if (await inhibitorsValidation(message, command)) break;
|
|
63
|
-
|
|
64
|
-
const args = await messageArgs({ message: message, command: command });
|
|
65
|
-
|
|
66
|
-
if (commandValidation(message, command)) break;
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
if (command.conditions && (await command.conditions(message, args))) break;
|
|
70
|
-
|
|
71
|
-
await command.exec(message, args);
|
|
72
|
-
|
|
73
|
-
return message.client.emit('commandRun', message, 'message', command);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
message.client.emit("error", message, error);
|
|
77
|
-
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
module.exports = BuildInMessageEvent;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const { Event } = require('../commands/Event.js');
|
|
2
|
-
const { messageArgs } = require("./../utils/Arguments.js");
|
|
3
|
-
const { commandValidation } = require('./../utils/CommandValidation.js');
|
|
4
|
-
const { messageUtil } = require('../utils/Util.js');
|
|
5
|
-
const { inhibitorsValidation } = require('../utils/InhibitorsValidation.js');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @returns message command executor.
|
|
9
|
-
*/
|
|
10
|
-
class BuildInMessageUpdateEvent extends Event {
|
|
11
|
-
constructor() {
|
|
12
|
-
super('messageUpdate', {
|
|
13
|
-
name: 'messageUpdate',
|
|
14
|
-
type: 'client',
|
|
15
|
-
once: false,
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async run(oldMessage, newMessage) {
|
|
20
|
-
if (!oldMessage.author.bot && !newMessage.author.bot) {
|
|
21
|
-
await messageUtil(newMessage, "edit");
|
|
22
|
-
|
|
23
|
-
let commands = newMessage.client.commands.message;
|
|
24
|
-
|
|
25
|
-
commands.filter(c => c.regex).map(async command => {
|
|
26
|
-
let regex = command.regex.split(/\//).slice(1);
|
|
27
|
-
|
|
28
|
-
regex = RegExp(...regex);
|
|
29
|
-
|
|
30
|
-
if (newMessage.content.match(regex)) {
|
|
31
|
-
try {
|
|
32
|
-
if (command.conditions && (await command.conditions(newMessage))) return;
|
|
33
|
-
|
|
34
|
-
return await command.exec(newMessage);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
newMessage.client.emit("error", newMessage, error);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
if (newMessage?.client?.settings?.prefix?.length <= 0) return;
|
|
43
|
-
|
|
44
|
-
if (!newMessage.client.data.messages[newMessage.id] === undefined) return;
|
|
45
|
-
|
|
46
|
-
commands.filter(c => !c.regex).map(async command => {
|
|
47
|
-
command?.prefix?.map(prefix => {
|
|
48
|
-
this.commandCheck(newMessage, prefix, command);
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
newMessage.client.settings.prefix.map(prefix => {
|
|
52
|
-
this.commandCheck(newMessage, prefix, command);
|
|
53
|
-
});
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async commandCheck(message, prefix, command) {
|
|
59
|
-
for (const alias of command.aliases) {
|
|
60
|
-
if (message.content.split(/ +/)[0] !== prefix + alias) continue;
|
|
61
|
-
|
|
62
|
-
if (await inhibitorsValidation(message, command)) break;
|
|
63
|
-
|
|
64
|
-
const args = await messageArgs({ message: message, command: command });
|
|
65
|
-
|
|
66
|
-
if (commandValidation(message, command)) break;
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
if (command.conditions && (await command.conditions(message, args))) break;
|
|
70
|
-
|
|
71
|
-
await command.exec(message, args);
|
|
72
|
-
|
|
73
|
-
return message.client.emit('commandRun', message, 'message', command);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
message.client.emit("error", message, error);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
module.exports = BuildInMessageUpdateEvent;
|