xernerx 2.6.0 → 2.6.3
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/main.js
CHANGED
|
@@ -12,9 +12,9 @@ const { Client } = require('./models/Client.js'),
|
|
|
12
12
|
Discord = require('discord.js'),
|
|
13
13
|
i18next = require('i18next');
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const exp = {
|
|
16
16
|
// Client
|
|
17
|
-
Client,
|
|
17
|
+
XernerxClient: Client,
|
|
18
18
|
|
|
19
19
|
// Handlers
|
|
20
20
|
CommandHandler,
|
|
@@ -38,4 +38,10 @@ module.exports = {
|
|
|
38
38
|
|
|
39
39
|
// Details
|
|
40
40
|
version: pkg.version,
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (const [key, val] of Object.entries(Discord)) {
|
|
44
|
+
exp[key] = val;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = exp;
|
|
@@ -23,7 +23,7 @@ class BuildInInteractionEvent extends Event {
|
|
|
23
23
|
if (interaction.client.commands.interaction.has(interaction.commandName)) {
|
|
24
24
|
let command = interaction.client.commands.interaction.get(interaction.commandName);
|
|
25
25
|
|
|
26
|
-
if (inhibitorsValidation(interaction, command)) return;
|
|
26
|
+
if (await inhibitorsValidation(interaction, command)) return;
|
|
27
27
|
|
|
28
28
|
await this.defer(interaction, command);
|
|
29
29
|
|
|
@@ -42,7 +42,7 @@ class BuildInMessageEvent extends Event {
|
|
|
42
42
|
if (message?.client?.settings?.prefix?.length <= 0) return;
|
|
43
43
|
|
|
44
44
|
commands.filter(c => !c.regex).map(async command => {
|
|
45
|
-
command
|
|
45
|
+
command?.prefix?.map(prefix => {
|
|
46
46
|
this.commandCheck(message, prefix, command);
|
|
47
47
|
})
|
|
48
48
|
|
|
@@ -57,7 +57,7 @@ class BuildInMessageEvent extends Event {
|
|
|
57
57
|
for (const alias of command.aliases) {
|
|
58
58
|
if (message.content.split(/ +/)[0] !== prefix + alias) continue;
|
|
59
59
|
|
|
60
|
-
if (inhibitorsValidation(message, command)) break;
|
|
60
|
+
if (await inhibitorsValidation(message, command)) break;
|
|
61
61
|
|
|
62
62
|
const args = await messageArgs({ message: message, command: command });
|
|
63
63
|
|
|
@@ -44,7 +44,7 @@ class BuildInMessageUpdateEvent extends Event {
|
|
|
44
44
|
if (!newMessage.client.data.messages[newMessage.id] === undefined) return;
|
|
45
45
|
|
|
46
46
|
commands.filter(c => !c.regex).map(async command => {
|
|
47
|
-
command
|
|
47
|
+
command?.prefix?.map(prefix => {
|
|
48
48
|
this.commandCheck(newMessage, prefix, command);
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -59,7 +59,7 @@ class BuildInMessageUpdateEvent extends Event {
|
|
|
59
59
|
for (const alias of command.aliases) {
|
|
60
60
|
if (message.content.split(/ +/)[0] !== prefix + alias) continue;
|
|
61
61
|
|
|
62
|
-
if (inhibitorsValidation(message, command)) break;
|
|
62
|
+
if (await inhibitorsValidation(message, command)) break;
|
|
63
63
|
|
|
64
64
|
const args = await messageArgs({ message: message, command: command });
|
|
65
65
|
|
|
@@ -58,13 +58,13 @@ module.exports = new class CommandValidation {
|
|
|
58
58
|
if (!event?.member?.permissions?.has(Discord.PermissionFlagsBits[toPascalCase(permission)])) missingPerms.push(toPascalCase(permission));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
if (missingPerms
|
|
61
|
+
if (missingPerms?.length >= 1) {
|
|
62
62
|
res = true;
|
|
63
63
|
return emit("missing user permissions", missingPerms);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
if (event?.guild && command?.clientPermissions
|
|
67
|
+
if (event?.guild && command?.clientPermissions?.length >= 1 || event?.client?.settings?.clientPermissions?.length >= 1) {
|
|
68
68
|
let missingPerms = [];
|
|
69
69
|
|
|
70
70
|
for (const permission of command?.clientPermissions) {
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
module.exports = new class InhibitorValidation {
|
|
2
|
-
inhibitorsValidation(event, command) {
|
|
2
|
+
async inhibitorsValidation(event, command) {
|
|
3
3
|
let inhibited = {};
|
|
4
4
|
|
|
5
5
|
if (event.client.inhibitors.has(command.runType)) {
|
|
6
6
|
let inhibitor = event.client.inhibitors.get(command.runType);
|
|
7
7
|
|
|
8
|
-
inhibited[command.runType] = inhibitor.check(event);
|
|
8
|
+
inhibited[command.runType] = await inhibitor.check(event);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
if (event.client.inhibitors.has("member")) {
|
|
12
12
|
|
|
13
13
|
let inhibitor = event.client.inhibitors.get("member");
|
|
14
14
|
|
|
15
|
-
inhibited["member"] = inhibitor.check(event, event.member);
|
|
15
|
+
inhibited["member"] = await inhibitor.check(event, event.member);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (event.client.inhibitors.has("guild")) {
|
|
19
19
|
let inhibitor = event.client.inhibitors.get("guild");
|
|
20
20
|
|
|
21
|
-
inhibited["guild"] = inhibitor.check(event, event.guild);
|
|
21
|
+
inhibited["guild"] = await inhibitor.check(event, event.guild);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (event.client.inhibitors.has("user")) {
|
|
25
25
|
let inhibitor = event.client.inhibitors.get("user");
|
|
26
26
|
|
|
27
|
-
inhibited["user"] = inhibitor.check(event, event.user || event.author);
|
|
27
|
+
inhibited["user"] = await inhibitor.check(event, event.user || event.author);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (event.client.inhibitors.has("channel")) {
|
|
31
31
|
let inhibitor = event.client.inhibitors.get("channel");
|
|
32
32
|
|
|
33
|
-
inhibited["channel"] = inhibitor.check(event);
|
|
33
|
+
inhibited["channel"] = await inhibitor.check(event);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
for (const inhibit of Object.values(inhibited)) {
|