xernerx 4.5.22 → 4.5.26
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/README.md +3 -0
- package/dist/build/XernerxContextCommand.d.ts +42 -50
- package/dist/build/XernerxContextCommand.js +71 -71
- package/dist/build/XernerxEvent.d.ts +15 -15
- package/dist/build/XernerxEvent.js +22 -22
- package/dist/build/XernerxInhibitor.d.ts +14 -25
- package/dist/build/XernerxInhibitor.js +20 -20
- package/dist/build/XernerxMessageCommand.d.ts +47 -53
- package/dist/build/XernerxMessageCommand.js +70 -70
- package/dist/build/XernerxSlashCommand.d.ts +57 -71
- package/dist/build/XernerxSlashCommand.js +128 -128
- package/dist/client/XernerxClient.d.ts +40 -48
- package/dist/client/XernerxClient.js +77 -77
- package/dist/client/XernerxShardClient.d.ts +12 -12
- package/dist/client/XernerxShardClient.js +39 -47
- package/dist/functions/deploy.d.ts +1 -1
- package/dist/functions/deploy.js +36 -31
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +29 -28
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +38 -35
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +12 -11
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +17 -18
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +6 -6
- package/dist/handlers/CommandHandler.d.ts +9 -9
- package/dist/handlers/CommandHandler.d.ts.map +1 -1
- package/dist/handlers/CommandHandler.js +281 -249
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +3 -3
- package/dist/handlers/EventHandler.js +19 -19
- package/dist/handlers/ExtensionHandler.d.ts +3 -3
- package/dist/handlers/ExtensionHandler.js +20 -18
- package/dist/handlers/Handler.d.ts +8 -8
- package/dist/handlers/Handler.js +42 -32
- package/dist/handlers/InhibitorHandler.d.ts +3 -3
- package/dist/handlers/InhibitorHandler.js +19 -19
- package/dist/handlers/WebhookHandler.d.ts +6 -4
- package/dist/handlers/WebhookHandler.js +44 -47
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +2 -5
- package/dist/models/Arguments.js +150 -135
- package/dist/tools/XernerxError.d.ts +5 -5
- package/dist/tools/XernerxError.js +9 -9
- package/dist/tools/XernerxLog.d.ts +13 -13
- package/dist/tools/XernerxLog.js +69 -74
- package/dist/tools/XernerxText.d.ts +23 -23
- package/dist/tools/XernerxText.js +85 -76
- package/dist/types/extenders.d.ts +36 -44
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +182 -185
- package/dist/types/interfaces.js +1 -1
- package/dist/types/types.d.ts +7 -179
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +9 -11
- package/dist/utils/ClientUtil.js +73 -57
- package/dist/utils/InteractionUtil.d.ts +7 -7
- package/dist/utils/InteractionUtil.js +98 -96
- package/dist/utils/MessageUtil.d.ts +11 -11
- package/dist/utils/MessageUtil.js +135 -130
- package/dist/utils/Util.d.ts +5 -5
- package/dist/utils/Util.js +8 -8
- package/dist/validators/commandValidation.d.ts +2 -5
- package/dist/validators/commandValidation.js +53 -43
- package/dist/validators/inhibitorValidations.d.ts +3 -19
- package/dist/validators/inhibitorValidations.js +31 -31
- package/package.json +16 -13
|
@@ -1,136 +1,141 @@
|
|
|
1
1
|
/** @format */
|
|
2
|
-
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, StringSelectMenuBuilder } from 'discord.js';
|
|
2
|
+
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, StringSelectMenuBuilder, } from 'discord.js';
|
|
3
3
|
import Util from './Util.js';
|
|
4
4
|
import sendWebhook from '../functions/sendWebhook.js';
|
|
5
5
|
import XernerxError from '../tools/XernerxError.js';
|
|
6
6
|
export default class MessageUtil extends Util {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
7
|
+
message;
|
|
8
|
+
constructor(client, message) {
|
|
9
|
+
super(client);
|
|
10
|
+
this.message = message;
|
|
11
|
+
this.parsed = {
|
|
12
|
+
alias: null,
|
|
13
|
+
prefix: null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async send(content) {
|
|
17
|
+
if (this.client.cache.messages.has(this.message.id) && this.client.modules.options.message?.handleEdits) {
|
|
18
|
+
const id = this.client.cache.messages.get(this.message.id);
|
|
19
|
+
if (!id)
|
|
20
|
+
return null;
|
|
21
|
+
const msg = await this.message.channel.messages.fetch(id);
|
|
22
|
+
msg.edit(content);
|
|
23
|
+
return msg;
|
|
24
|
+
}
|
|
25
|
+
const msg = await this.message.channel.send(content);
|
|
26
|
+
this.client.cache.messages.set(this.message.id, msg.id);
|
|
27
|
+
return msg;
|
|
28
|
+
}
|
|
29
|
+
async reply(content) {
|
|
30
|
+
if (this.client.cache.messages.has(this.message.id) && this.client.modules.options.message?.handleEdits) {
|
|
31
|
+
const id = this.client.cache.messages.get(this.message.id);
|
|
32
|
+
if (!id)
|
|
33
|
+
return null;
|
|
34
|
+
const msg = await this.message.channel.messages.fetch(id);
|
|
35
|
+
msg.edit(content);
|
|
36
|
+
return msg;
|
|
37
|
+
}
|
|
38
|
+
const msg = await this.message.reply(content);
|
|
39
|
+
this.client.cache.messages.set(this.message.id, msg.id);
|
|
40
|
+
return msg;
|
|
41
|
+
}
|
|
42
|
+
async webhookReply(content, url, user) {
|
|
43
|
+
if (this.message.channel.type === ChannelType.DM)
|
|
44
|
+
throw new XernerxError(`Can't use this method in DM Channels`);
|
|
45
|
+
const channel = this.message.channel;
|
|
46
|
+
let webhook;
|
|
47
|
+
if (!url) {
|
|
48
|
+
webhook = await channel.createWebhook({
|
|
49
|
+
name: user?.username || this.client.user?.username,
|
|
50
|
+
avatar: user?.avatarURL() || this.client.user?.avatarURL(),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (!webhook)
|
|
54
|
+
webhook = { url };
|
|
55
|
+
await sendWebhook(webhook.url, content);
|
|
56
|
+
if (!url)
|
|
57
|
+
webhook.delete();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
async paginator(embeds, options = {}) {
|
|
61
|
+
let buttonRow, menuRow;
|
|
62
|
+
if (embeds.length <= 0)
|
|
63
|
+
throw new XernerxError(`Can't make a paginator without embeds`);
|
|
64
|
+
options = {
|
|
65
|
+
type: options.type ?? 'combined',
|
|
66
|
+
buttons: options.buttons ?? ['⏪', '◀️', '⏹️', '▶️', '⏩'],
|
|
67
|
+
description: options.description ?? false,
|
|
68
|
+
placeholder: options.placeholder ?? 'Change page',
|
|
69
|
+
index: options.index ?? 0,
|
|
70
|
+
send: options.send ?? false,
|
|
71
|
+
filter: options.filter ?? (() => true),
|
|
72
|
+
time: options.time ?? 300000,
|
|
73
|
+
};
|
|
74
|
+
if (options.type == 'button' || options.type == 'combined') {
|
|
75
|
+
if (!options.buttons)
|
|
76
|
+
throw new XernerxError(`¯\\_(ツ)_/¯ Somehow there are no buttons? ¯\\_(ツ)_/¯`);
|
|
77
|
+
buttonRow = new ActionRowBuilder().addComponents(...options.buttons.map((button, i) => new ButtonBuilder().setCustomId(`${this.message.id}-${i}`).setEmoji(button).setStyle(ButtonStyle.Primary)));
|
|
78
|
+
}
|
|
79
|
+
if (options.type == 'select-menu' || options.type == 'combined') {
|
|
80
|
+
menuRow = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder()
|
|
81
|
+
.setCustomId(`${this.message.id}-select-menu`)
|
|
82
|
+
.setPlaceholder(options.placeholder)
|
|
83
|
+
.addOptions(...embeds.map((embed, i) => ({ label: embed.data.title || 'No Title', description: (options.description ? embed.data.description : undefined) || undefined, value: `${i}` }))));
|
|
84
|
+
}
|
|
85
|
+
let index = options.index || 0;
|
|
86
|
+
return options.send
|
|
87
|
+
? await this.message.util.send({
|
|
88
|
+
embeds: [embeds[index]],
|
|
89
|
+
components: [options.type == 'combined' || options.type == 'button' ? buttonRow : null, options.type == 'combined' || options.type == 'select-menu' ? menuRow : null].filter((x) => x),
|
|
90
|
+
})
|
|
91
|
+
: await this.message.util
|
|
92
|
+
.reply({
|
|
93
|
+
embeds: [embeds[index]],
|
|
94
|
+
components: [options.type == 'combined' || options.type == 'button' ? buttonRow : null, options.type == 'combined' || options.type == 'select-menu' ? menuRow : null].filter((x) => x),
|
|
95
|
+
})
|
|
96
|
+
.then(async (msg) => {
|
|
97
|
+
const collector = this.message.channel
|
|
98
|
+
?.createMessageComponentCollector({ time: options.time })
|
|
99
|
+
.on('collect', (collect) => {
|
|
100
|
+
if (!collect.customId.startsWith(this.message.id))
|
|
101
|
+
return;
|
|
102
|
+
if (collect.customId.endsWith('select-menu')) {
|
|
103
|
+
index = Number(collect.values[0]);
|
|
104
|
+
collect.update({ embeds: [embeds[index]] });
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const option = Number(collect.customId.split(/-/)[1]);
|
|
108
|
+
let embed = embeds[index];
|
|
109
|
+
if (option == 0) {
|
|
110
|
+
index = 0;
|
|
111
|
+
embed = embeds[index];
|
|
112
|
+
collect.update({ embeds: [embed] });
|
|
113
|
+
}
|
|
114
|
+
if (option == 1) {
|
|
115
|
+
index = embeds.indexOf(embed) >= 1 ? embeds.indexOf(embed) - 1 : 0;
|
|
116
|
+
embed = embeds[index];
|
|
117
|
+
collect.update({ embeds: [embed] });
|
|
118
|
+
}
|
|
119
|
+
if (option == 2) {
|
|
120
|
+
collect.update({ components: [] });
|
|
121
|
+
collector?.stop();
|
|
122
|
+
}
|
|
123
|
+
if (option == 3) {
|
|
124
|
+
index = embeds.indexOf(embed) < embeds.length - 1 ? embeds.indexOf(embed) + 1 : embeds.length - 1;
|
|
125
|
+
embed = embeds[index];
|
|
126
|
+
collect.update({ embeds: [embed] });
|
|
127
|
+
}
|
|
128
|
+
if (option == 4) {
|
|
129
|
+
index = embeds.length - 1;
|
|
130
|
+
embed = embeds[index];
|
|
131
|
+
collect.update({ embeds: [embed] });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
.on('end', async () => {
|
|
136
|
+
await msg?.edit({ components: [] });
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
135
140
|
}
|
|
136
|
-
//# sourceMappingURL=MessageUtil.js.map
|
|
141
|
+
//# sourceMappingURL=MessageUtil.js.map
|
package/dist/utils/Util.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
import XernerxText from '../tools/XernerxText.js';
|
|
4
4
|
export default class Util {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
readonly client: XernerxClient<unknown>;
|
|
6
|
+
readonly text: XernerxText;
|
|
7
|
+
constructor(client: XernerxClient);
|
|
8
|
+
delay(time: number): Promise<unknown>;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=Util.d.ts.map
|
|
10
|
+
//# sourceMappingURL=Util.d.ts.map
|
package/dist/utils/Util.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import XernerxText from '../tools/XernerxText.js';
|
|
3
3
|
export default class Util {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.text = new XernerxText();
|
|
7
|
+
}
|
|
8
|
+
async delay(time) {
|
|
9
|
+
return await new Promise((resolve) => setTimeout(resolve, time));
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=Util.js.map
|
|
12
|
+
//# sourceMappingURL=Util.js.map
|
|
@@ -4,8 +4,5 @@ import MessageCommandBuilder from '../build/XernerxMessageCommand.js';
|
|
|
4
4
|
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
5
5
|
import { XernerxMessage, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
6
6
|
import { XernerxInteraction } from '../types/types.js';
|
|
7
|
-
export default function commandValidation(
|
|
8
|
-
|
|
9
|
-
command: MessageCommandBuilder | XernerxSlashCommand | XernerxContextCommand
|
|
10
|
-
): Promise<boolean>;
|
|
11
|
-
//# sourceMappingURL=commandValidation.d.ts.map
|
|
7
|
+
export default function commandValidation(event: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction> | XernerxMessage, command: MessageCommandBuilder | XernerxSlashCommand | XernerxContextCommand): Promise<boolean>;
|
|
8
|
+
//# sourceMappingURL=commandValidation.d.ts.map
|
|
@@ -1,51 +1,61 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import { ChannelType, PermissionFlagsBits } from 'discord.js';
|
|
3
3
|
export default async function commandValidation(event, command) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
4
|
+
const client = event.client;
|
|
5
|
+
if (command.ignore?.owner && client.settings.ownerId.includes(event.user.id))
|
|
6
|
+
return false;
|
|
7
|
+
if (!client.cache.cooldowns.has(`${event.user.id}-${command.name}`)) {
|
|
8
|
+
client.cache.cooldowns.set(`${event.user.id}-${command.name}`, {
|
|
9
|
+
id: event.user.id,
|
|
10
|
+
command: command.name,
|
|
11
|
+
createdTimestamp: Number(Date.now()) + (command.cooldown || 0),
|
|
12
|
+
});
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
client.cache.cooldowns.delete(`${event.user.id}-${command.name}`);
|
|
15
|
+
}, command.cooldown || 0);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const user = client.cache.cooldowns.get(`${event.user.id}-${command.name}`);
|
|
19
|
+
const time = (user?.createdTimestamp || 0) - Number(Date.now());
|
|
20
|
+
return emit(event, `Command on cooldown, ${time}`);
|
|
21
|
+
}
|
|
22
|
+
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
|
|
23
|
+
return true;
|
|
24
|
+
if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id))
|
|
25
|
+
return true;
|
|
26
|
+
if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id))
|
|
27
|
+
return true;
|
|
28
|
+
if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id))
|
|
29
|
+
return await emit(event, 'Command is a developer command');
|
|
30
|
+
if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id))
|
|
31
|
+
return await emit(event, 'Command cannot be ran in this channel');
|
|
32
|
+
if ((command.strict?.guilds?.length || 0) > 0 && !command.strict?.guilds?.includes(event.guild?.id))
|
|
33
|
+
return await emit(event, 'Command cannot be ran in this guild');
|
|
34
|
+
if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id))
|
|
35
|
+
return await emit(event, 'Command cannot be ran by you');
|
|
36
|
+
if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM)
|
|
37
|
+
return await emit(event, "Can't use in a DM Channel");
|
|
38
|
+
if (command.permissions?.user) {
|
|
39
|
+
if (!(event.member?.permissions).has(toBigInt(command.permissions.user)))
|
|
40
|
+
return await emit(event, 'Missing User Permissions');
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
32
43
|
}
|
|
33
44
|
async function emit(event, reason) {
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
event.client.emit('commandBlock', event, reason);
|
|
46
|
+
return true;
|
|
36
47
|
}
|
|
37
48
|
function toBigInt(permissions) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return bigIntPermissions;
|
|
49
|
+
let bigIntPermissions = 0n;
|
|
50
|
+
permissions.map((permission) => {
|
|
51
|
+
permission =
|
|
52
|
+
PermissionFlagsBits[permission
|
|
53
|
+
.split(/ +/)
|
|
54
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
55
|
+
.join('')];
|
|
56
|
+
if (typeof permission === 'bigint')
|
|
57
|
+
bigIntPermissions += permission;
|
|
58
|
+
});
|
|
59
|
+
return bigIntPermissions;
|
|
50
60
|
}
|
|
51
|
-
//# sourceMappingURL=commandValidation.js.map
|
|
61
|
+
//# sourceMappingURL=commandValidation.js.map
|
|
@@ -2,22 +2,6 @@
|
|
|
2
2
|
import { XernerxContextCommand, XernerxMessageCommand, XernerxSlashCommand } from '../main.js';
|
|
3
3
|
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
4
|
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
5
|
-
export declare function inhibitorValidation(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
): Promise<boolean>;
|
|
9
|
-
export declare function inhibitorArguments(
|
|
10
|
-
event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
11
|
-
cmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null,
|
|
12
|
-
type: InhibitorType
|
|
13
|
-
):
|
|
14
|
-
| import('../main.js').XernerxUser
|
|
15
|
-
| import('discord.js').GuildMember
|
|
16
|
-
| import('discord.js').Guild
|
|
17
|
-
| import('discord.js').TextBasedChannel
|
|
18
|
-
| XernerxMessageCommand
|
|
19
|
-
| XernerxSlashCommand
|
|
20
|
-
| XernerxContextCommand
|
|
21
|
-
| import('../main.js').APIInteractionGuildMember
|
|
22
|
-
| null;
|
|
23
|
-
//# sourceMappingURL=inhibitorValidations.d.ts.map
|
|
5
|
+
export declare function inhibitorValidation(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, cmd?: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand): Promise<boolean>;
|
|
6
|
+
export declare function inhibitorArguments(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, cmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null, type: InhibitorType): import("../main.js").XernerxUser | import("discord.js").GuildMember | import("discord.js").Guild | import("discord.js").TextBasedChannel | XernerxMessageCommand | XernerxSlashCommand | XernerxContextCommand | import("../main.js").APIInteractionGuildMember | null;
|
|
7
|
+
//# sourceMappingURL=inhibitorValidations.d.ts.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
export async function inhibitorValidation(event, cmd) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const client = event.client;
|
|
4
|
+
const inhibits = [];
|
|
5
|
+
for (const [name, inhibitor] of client.inhibitors) {
|
|
6
|
+
if (Boolean(await inhibitor.check(event, (await inhibitorArguments(event, cmd || null, inhibitor.type))))) {
|
|
7
|
+
inhibits.push(name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return !!inhibits.length;
|
|
11
11
|
}
|
|
12
12
|
export function inhibitorArguments(event, cmd, type) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'channel':
|
|
15
|
+
return event.channel || null;
|
|
16
|
+
case 'command':
|
|
17
|
+
return cmd;
|
|
18
|
+
case 'contextCommand':
|
|
19
|
+
return cmd;
|
|
20
|
+
case 'guild':
|
|
21
|
+
return event.guild || null;
|
|
22
|
+
case 'interaction':
|
|
23
|
+
return null;
|
|
24
|
+
case 'member':
|
|
25
|
+
return event.member || null;
|
|
26
|
+
case 'message':
|
|
27
|
+
return null;
|
|
28
|
+
case 'messageCommand':
|
|
29
|
+
return cmd;
|
|
30
|
+
case 'slashCommand':
|
|
31
|
+
return cmd;
|
|
32
|
+
case 'user':
|
|
33
|
+
return event.user;
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=inhibitorValidations.js.map
|
|
36
|
+
//# sourceMappingURL=inhibitorValidations.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.26",
|
|
4
4
|
"description": "A bot framework for discord.js.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,15 +17,18 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"homepage": "https://xernerx.github.io/xernerx",
|
|
19
19
|
"packageManager": "npm@8.5.5",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": "20.3.0"
|
|
22
|
+
},
|
|
20
23
|
"scripts": {
|
|
21
24
|
"start": "npm i && npm fund && npm audit fix --force && npm link && tsc -w",
|
|
22
25
|
"commit": "npm run write && git add . && node ./.github/scripts/message.js",
|
|
23
26
|
"tag": "node ./.github/scripts/tag.js",
|
|
24
|
-
"patch": "npm run commit && npm version patch && npm run tag &&
|
|
25
|
-
"minor": "npm run commit && npm version minor && npm run tag &&
|
|
26
|
-
"major": "npm run commit && npm version major && npm run tag &&
|
|
27
|
+
"patch": "npm run commit && npm version patch && npm run tag && git push",
|
|
28
|
+
"minor": "npm run commit && npm version minor && npm run tag && git push",
|
|
29
|
+
"major": "npm run commit && npm version major && npm run tag && git push",
|
|
27
30
|
"site": "git add docs && npm run commit && git push",
|
|
28
|
-
"write": "npm run build && npm run format",
|
|
31
|
+
"write": "npm i && npm run build && npm run format",
|
|
29
32
|
"format": "npx prettier --write src dist",
|
|
30
33
|
"build": "tsc && npm run format"
|
|
31
34
|
},
|
|
@@ -37,15 +40,15 @@
|
|
|
37
40
|
"url": "https://github.com/xernerx/xernerx/issues"
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"dbl-sdk": "
|
|
41
|
-
"discord.js": "
|
|
42
|
-
"dumfunctions": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"zod": "^3.21.4"
|
|
43
|
+
"dbl-sdk": "1.2.0",
|
|
44
|
+
"discord.js": "14.11.0",
|
|
45
|
+
"dumfunctions": "2.1.2",
|
|
46
|
+
"xernerx-extension-builder": "0.0.16",
|
|
47
|
+
"zod": "3.21.4"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
|
-
"prettier": "
|
|
49
|
-
"
|
|
50
|
+
"prettier": "3.0.0",
|
|
51
|
+
"readline": "1.3.0",
|
|
52
|
+
"typescript": "5.1.6"
|
|
50
53
|
}
|
|
51
54
|
}
|