xernerx 4.17.6 → 4.17.9
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/XernerxContextCommand.d.ts +47 -75
- package/dist/build/XernerxContextCommand.js +115 -119
- package/dist/build/XernerxEvent.d.ts +10 -10
- package/dist/build/XernerxEvent.js +17 -17
- package/dist/build/XernerxInhibitor.d.ts +15 -39
- package/dist/build/XernerxInhibitor.js +18 -18
- package/dist/build/XernerxMessageCommand.d.ts +52 -78
- package/dist/build/XernerxMessageCommand.js +114 -118
- package/dist/build/XernerxSlashCommand.d.ts +63 -97
- package/dist/build/XernerxSlashCommand.js +173 -177
- package/dist/client/XernerxClient.d.ts +55 -61
- package/dist/client/XernerxClient.js +94 -91
- package/dist/client/XernerxShardClient.d.ts +14 -14
- package/dist/client/XernerxShardClient.js +48 -61
- package/dist/functions/deploy.js +52 -45
- package/dist/functions/load.js +29 -28
- package/dist/functions/reload.js +24 -23
- package/dist/functions/setPresence.d.ts +1 -1
- package/dist/functions/setPresence.js +16 -17
- package/dist/handlers/CommandHandler.d.ts +10 -10
- package/dist/handlers/CommandHandler.js +337 -312
- package/dist/handlers/EventHandler.d.ts +5 -3
- package/dist/handlers/EventHandler.js +76 -48
- package/dist/handlers/ExtensionHandler.d.ts +3 -3
- package/dist/handlers/ExtensionHandler.js +23 -23
- package/dist/handlers/Handler.d.ts +17 -22
- package/dist/handlers/Handler.js +57 -45
- package/dist/handlers/InhibitorHandler.d.ts +3 -3
- package/dist/handlers/InhibitorHandler.js +23 -25
- package/dist/handlers/IntegrationHandler.d.ts +6 -6
- package/dist/handlers/IntegrationHandler.js +20 -20
- package/dist/main.d.ts +22 -29
- package/dist/main.js +22 -29
- package/dist/models/Arguments.d.ts +1 -4
- package/dist/models/Arguments.js +149 -134
- package/dist/models/Cooldowns.d.ts +6 -6
- package/dist/models/Cooldowns.js +29 -25
- package/dist/models/XernerxEntitlement.d.ts +45 -0
- package/dist/models/XernerxEntitlement.js +57 -0
- package/dist/models/XernerxUser.d.ts +14 -0
- package/dist/models/XernerxUser.js +13 -0
- package/dist/tools/XernerxError.d.ts +4 -4
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/XernerxIntents.d.ts +2 -2
- package/dist/tools/XernerxIntents.js +21 -21
- package/dist/tools/XernerxLog.d.ts +25 -25
- package/dist/tools/XernerxLog.js +131 -140
- package/dist/tools/XernerxText.d.ts +23 -23
- package/dist/tools/XernerxText.js +89 -79
- package/dist/types/extenders.d.ts +47 -55
- package/dist/types/interfaces.d.ts +190 -195
- package/dist/types/types.d.ts +5 -104
- package/dist/utils/ClientUtil.d.ts +10 -12
- package/dist/utils/ClientUtil.js +117 -96
- package/dist/utils/InteractionUtil.d.ts +13 -13
- package/dist/utils/InteractionUtil.js +147 -148
- package/dist/utils/MessageUtil.d.ts +14 -14
- package/dist/utils/MessageUtil.js +161 -162
- package/dist/utils/Util.d.ts +7 -7
- package/dist/utils/Util.js +7 -7
- package/dist/validators/commandValidation.d.ts +1 -4
- package/dist/validators/commandValidation.js +114 -157
- package/dist/validators/inhibitorValidations.d.ts +2 -21
- package/dist/validators/inhibitorValidations.js +39 -39
- package/package.json +6 -5
- package/tsup.config.ts +19 -0
- package/dist/functions/xernerxUser.d.ts +0 -4
- package/dist/functions/xernerxUser.js +0 -10
|
@@ -3,165 +3,122 @@ import { ChannelType } from 'discord.js';
|
|
|
3
3
|
import { Style } from 'dumfunctions';
|
|
4
4
|
var CommandTypes;
|
|
5
5
|
(function (CommandTypes) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
CommandTypes["SlashCommand"] = "slash";
|
|
7
|
+
CommandTypes["MessageCommand"] = "message";
|
|
8
|
+
CommandTypes["ContextCommand"] = "context";
|
|
9
9
|
})(CommandTypes || (CommandTypes = {}));
|
|
10
10
|
export default async function commandValidation(event, command) {
|
|
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
|
-
command
|
|
122
|
-
);
|
|
123
|
-
if (userPermissions.length) {
|
|
124
|
-
const missing = [];
|
|
125
|
-
userPermissions.map((permission) => (event.guild?.members.me?.permissionsIn(event.channel?.id).has(Style.pascalCase(permission, true)) ? null : missing.push(permission)));
|
|
126
|
-
if (missing.length)
|
|
127
|
-
return await emit(
|
|
128
|
-
event,
|
|
129
|
-
{
|
|
130
|
-
reason: 'missingUserPermissions',
|
|
131
|
-
message: `You are missing the following permissions to run \`${command.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
132
|
-
required: userPermissions,
|
|
133
|
-
missing,
|
|
134
|
-
},
|
|
135
|
-
command
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
if (clientPermissions.length) {
|
|
139
|
-
const missing = [];
|
|
140
|
-
clientPermissions.map((permission) => (event.guild?.members.me?.permissionsIn(event.channel?.id).has(Style.pascalCase(permission, true)) ? null : missing.push(permission)));
|
|
141
|
-
if (missing.length)
|
|
142
|
-
return await emit(
|
|
143
|
-
event,
|
|
144
|
-
{
|
|
145
|
-
reason: 'missingClientPermissions',
|
|
146
|
-
message: `I am missing the following permissions to run \`${command.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
147
|
-
required: clientPermissions,
|
|
148
|
-
missing,
|
|
149
|
-
},
|
|
150
|
-
command
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
if ((!command.global || !client.settings.global) && client.settings.local !== event.guild?.id)
|
|
154
|
-
return await emit(
|
|
155
|
-
event,
|
|
156
|
-
{
|
|
157
|
-
reason: 'local',
|
|
158
|
-
message: `\`${command.name}\` is not globally deployed`,
|
|
159
|
-
},
|
|
160
|
-
command
|
|
161
|
-
);
|
|
162
|
-
return false;
|
|
11
|
+
const client = event.client;
|
|
12
|
+
if (command.ignore?.owner && client.settings.ownerId?.includes(event.user.id))
|
|
13
|
+
return false;
|
|
14
|
+
const cooldownTime = command.cooldown || client.modules.options?.[CommandTypes[command.filetype]]?.cooldown || client.cooldown?.default || 0;
|
|
15
|
+
const cooldown = {
|
|
16
|
+
id: event.user.id,
|
|
17
|
+
command: command.name,
|
|
18
|
+
createdTimestamp: Number(Date.now()) + cooldownTime,
|
|
19
|
+
};
|
|
20
|
+
const clientPermissions = command.permissions?.client || client.modules.options?.[CommandTypes[command.filetype]]?.permissions?.client || client.settings.permissions?.client || [];
|
|
21
|
+
const userPermissions = command.permissions?.user || client.modules.options?.[CommandTypes[command.filetype]]?.permissions?.user || client.settings.permissions?.user || [];
|
|
22
|
+
if (!client.cooldowns.collections.commands.has(`${event.user.id}-${command.name}`)) {
|
|
23
|
+
client.cooldowns.collections.commands.set(`${event.user.id}-${command.name}`, cooldown);
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
client.cooldowns.collections.commands.delete(`${event.user.id}-${command.name}`);
|
|
26
|
+
}, cooldownTime);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const user = client.cooldowns.collections.commands.get(`${event.user.id}-${command.name}`);
|
|
30
|
+
const time = (user?.createdTimestamp || 0) - Number(Date.now());
|
|
31
|
+
return emit(event, {
|
|
32
|
+
reason: 'cooldown',
|
|
33
|
+
message: `You are on cooldown for \`${command.name}\`, wait another \`${Math.round(time / 10) / 100}s\``,
|
|
34
|
+
startedAt: user.createdTimestamp,
|
|
35
|
+
endsAt: user.createdTimestamp + time,
|
|
36
|
+
time,
|
|
37
|
+
}, command);
|
|
38
|
+
}
|
|
39
|
+
if (command.channel && event.channel?.type !== undefined && event.channel?.type >= 0) {
|
|
40
|
+
if (!command.channel.includes(ChannelType[event.channel?.type]))
|
|
41
|
+
return await emit(event, {
|
|
42
|
+
reason: 'invalidChannel',
|
|
43
|
+
message: `\`${command.name}\` can only be used in ${command.channel.join(', ')} channels`,
|
|
44
|
+
channels: command.channel,
|
|
45
|
+
}, command);
|
|
46
|
+
}
|
|
47
|
+
if ((command.ignore?.channels?.length || 0) > 0 && command.ignore?.channels?.includes(event.channel?.id))
|
|
48
|
+
return true;
|
|
49
|
+
if ((command.ignore?.guilds?.length || 0) > 0 && command.ignore?.guilds?.includes(event.guild?.id))
|
|
50
|
+
return true;
|
|
51
|
+
if ((command.ignore?.users?.length || 0) > 0 && command.ignore?.users?.includes(event.user.id))
|
|
52
|
+
return true;
|
|
53
|
+
if (command.ignore?.voice && event.member?.voice?.channel)
|
|
54
|
+
return await emit(event, {
|
|
55
|
+
reason: 'inVoice',
|
|
56
|
+
message: `\`${command.name}\` cannot be ran while in voice chat`,
|
|
57
|
+
}, command);
|
|
58
|
+
if (command.strict?.owner && !client.settings.ownerId.includes(event.user.id))
|
|
59
|
+
return await emit(event, {
|
|
60
|
+
reason: 'notADeveloper',
|
|
61
|
+
message: `\`${command.name}\` is a developer command`,
|
|
62
|
+
owners: client.settings.ownerId,
|
|
63
|
+
}, command);
|
|
64
|
+
if ((command.strict?.channels?.length || 0) > 0 && !command.strict?.channels?.includes(event.channel?.id))
|
|
65
|
+
return await emit(event, {
|
|
66
|
+
reason: 'channelRestricted',
|
|
67
|
+
message: `\`${command.name}\` cannot be ran in this channel`,
|
|
68
|
+
channels: command.strict?.channels,
|
|
69
|
+
}, command);
|
|
70
|
+
if ((command.strict?.guilds?.length || 0) > 0 && !command.strict?.guilds?.includes(event.guild?.id))
|
|
71
|
+
return await emit(event, {
|
|
72
|
+
reason: 'guildRestricted',
|
|
73
|
+
message: `\`${command.name}\` cannot be ran in this guild`,
|
|
74
|
+
guilds: command.strict?.guilds,
|
|
75
|
+
}, command);
|
|
76
|
+
if ((command.strict?.users?.length || 0) > 0 && !command.strict?.users?.includes(event.user.id))
|
|
77
|
+
return await emit(event, {
|
|
78
|
+
reason: 'userRestricted',
|
|
79
|
+
message: `\`${command.name}\` cannot be ran by you`,
|
|
80
|
+
users: command.strict?.users,
|
|
81
|
+
}, command);
|
|
82
|
+
if (command.strict?.voice && !event.member?.voice?.channel)
|
|
83
|
+
return await emit(event, {
|
|
84
|
+
reason: 'voiceRestricted',
|
|
85
|
+
message: `\`${command.name}\` cannot be ran while not in voice chat`,
|
|
86
|
+
}, command);
|
|
87
|
+
if (command.permissions?.dm == false && event.channel?.type === ChannelType.DM)
|
|
88
|
+
return await emit(event, {
|
|
89
|
+
reason: 'DMRestricted',
|
|
90
|
+
message: `\`${command.name}\` can't be used in a DM Channel`,
|
|
91
|
+
}, command);
|
|
92
|
+
if (userPermissions.length) {
|
|
93
|
+
const missing = [];
|
|
94
|
+
userPermissions.map((permission) => ((event.member?.permissions).toArray().includes(Style.pascalCase(permission, true)) ? null : missing.push(permission)));
|
|
95
|
+
if (missing.length)
|
|
96
|
+
return await emit(event, {
|
|
97
|
+
reason: 'missingUserPermissions',
|
|
98
|
+
message: `You are missing the following permissions to run \`${command.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
99
|
+
required: userPermissions,
|
|
100
|
+
missing,
|
|
101
|
+
}, command);
|
|
102
|
+
}
|
|
103
|
+
if (clientPermissions.length) {
|
|
104
|
+
const missing = [];
|
|
105
|
+
clientPermissions.map((permission) => event.guild?.members.me?.permissionsIn(event.channel?.id).has(Style.pascalCase(permission, true)) ? null : missing.push(permission));
|
|
106
|
+
if (missing.length)
|
|
107
|
+
return await emit(event, {
|
|
108
|
+
reason: 'missingClientPermissions',
|
|
109
|
+
message: `I am missing the following permissions to run \`${command.name}\`:\n${missing.map((permission) => `> - ${permission}`).join('\n')}`,
|
|
110
|
+
required: clientPermissions,
|
|
111
|
+
missing,
|
|
112
|
+
}, command);
|
|
113
|
+
}
|
|
114
|
+
if ((!command.global || !client.settings.global) && client.settings.local !== event.guild?.id)
|
|
115
|
+
return await emit(event, {
|
|
116
|
+
reason: 'local',
|
|
117
|
+
message: `\`${command.name}\` is not globally deployed`,
|
|
118
|
+
}, command);
|
|
119
|
+
return false;
|
|
163
120
|
}
|
|
164
121
|
async function emit(event, info, command) {
|
|
165
|
-
|
|
166
|
-
|
|
122
|
+
event.client.emit('commandBlock', event, info, command);
|
|
123
|
+
return true;
|
|
167
124
|
}
|
|
@@ -5,24 +5,5 @@ import XernerxMessageCommand from '../build/XernerxMessageCommand.js';
|
|
|
5
5
|
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
6
6
|
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
7
7
|
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
8
|
-
export declare function inhibitorValidation(
|
|
9
|
-
|
|
10
|
-
args?: SlashCommandArguments | MessageCommandArguments | ContextCommandArguments<'user' | 'message'> | null,
|
|
11
|
-
cmd?: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand,
|
|
12
|
-
type?: 'pre' | 'check' | 'post'
|
|
13
|
-
): Promise<boolean>;
|
|
14
|
-
export declare function inhibitorArguments(
|
|
15
|
-
event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
16
|
-
cmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null,
|
|
17
|
-
type: InhibitorType
|
|
18
|
-
):
|
|
19
|
-
| import('../types/extenders.js').XernerxUser
|
|
20
|
-
| import('discord.js').GuildMember
|
|
21
|
-
| import('discord.js').Guild
|
|
22
|
-
| import('discord.js').TextBasedChannel
|
|
23
|
-
| XernerxSlashCommand
|
|
24
|
-
| XernerxContextCommand
|
|
25
|
-
| XernerxMessageCommand
|
|
26
|
-
| import('discord.js').APIInteractionGuildMember
|
|
27
|
-
| null
|
|
28
|
-
| undefined;
|
|
8
|
+
export declare function inhibitorValidation(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, args?: SlashCommandArguments | MessageCommandArguments | ContextCommandArguments<'user' | 'message'> | null, cmd?: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand, type?: 'pre' | 'check' | 'post'): Promise<boolean>;
|
|
9
|
+
export declare function inhibitorArguments(event: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, cmd: XernerxContextCommand | XernerxMessageCommand | XernerxSlashCommand | null, type: InhibitorType): import("../types/extenders.js").XernerxUser | import("discord.js").GuildMember | import("discord.js").Guild | import("discord.js").TextBasedChannel | XernerxSlashCommand | XernerxContextCommand | import("discord.js").APIInteractionGuildMember | XernerxMessageCommand | null | undefined;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
export async function inhibitorValidation(event, args, cmd, type) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
const client = event.client;
|
|
4
|
+
const inhibits = [];
|
|
5
|
+
for (const [name, inhibitor] of client.inhibitors) {
|
|
6
|
+
if (type == 'pre')
|
|
7
|
+
if (Boolean(await inhibitor.pre(event, (await inhibitorArguments(event, cmd || null, inhibitor.type))))) {
|
|
8
|
+
inhibits.push(name);
|
|
9
|
+
}
|
|
10
|
+
if (type == 'check')
|
|
11
|
+
if (Boolean(await inhibitor.check(event, args || null, (await inhibitorArguments(event, cmd || null, inhibitor.type))))) {
|
|
12
|
+
inhibits.push(name);
|
|
13
|
+
}
|
|
14
|
+
if (type == 'post')
|
|
15
|
+
if (Boolean(await inhibitor.post(event, args || null, (await inhibitorArguments(event, cmd || null, inhibitor.type))))) {
|
|
16
|
+
inhibits.push(name);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return !!inhibits.length;
|
|
20
20
|
}
|
|
21
21
|
export function inhibitorArguments(event, cmd, type) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'channel':
|
|
24
|
+
return event.channel || null;
|
|
25
|
+
case 'command':
|
|
26
|
+
return cmd || null;
|
|
27
|
+
case 'contextCommand':
|
|
28
|
+
return cmd || null;
|
|
29
|
+
case 'guild':
|
|
30
|
+
return event.guild || null;
|
|
31
|
+
case 'interaction':
|
|
32
|
+
return null;
|
|
33
|
+
case 'member':
|
|
34
|
+
return event.member || null;
|
|
35
|
+
case 'message':
|
|
36
|
+
return null;
|
|
37
|
+
case 'messageCommand':
|
|
38
|
+
return cmd || null;
|
|
39
|
+
case 'slashCommand':
|
|
40
|
+
return cmd || null;
|
|
41
|
+
case 'user':
|
|
42
|
+
return event.user || null;
|
|
43
|
+
}
|
|
44
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"version": "4.17.
|
|
3
|
+
"version": "4.17.9",
|
|
4
4
|
"description": "A bot framework for discord.js.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -43,17 +43,18 @@
|
|
|
43
43
|
"url": "https://github.com/xernerx/xernerx/issues"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@clack/prompts": "^0.
|
|
46
|
+
"@clack/prompts": "^0.9.1",
|
|
47
47
|
"dbl-sdk": "^2.0.3",
|
|
48
|
-
"discord.js": "^14.
|
|
48
|
+
"discord.js": "^14.17.3",
|
|
49
49
|
"dumfunctions": "^2.1.6",
|
|
50
50
|
"xernerx-extension-builder": "0.0.16",
|
|
51
|
-
"zod": "^3.
|
|
51
|
+
"zod": "^3.24.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"jest": "^29.7.0",
|
|
55
55
|
"prettier": "3.0.0",
|
|
56
56
|
"ts-node": "^10.9.2",
|
|
57
|
-
"
|
|
57
|
+
"tsup": "^8.3.5",
|
|
58
|
+
"typescript": "^5.7.3"
|
|
58
59
|
}
|
|
59
60
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'tsup';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
entry: ['src/main.ts'],
|
|
7
|
+
splitting: true,
|
|
8
|
+
sourcemap: true,
|
|
9
|
+
dts: true,
|
|
10
|
+
clean: true,
|
|
11
|
+
format: ['esm', 'cjs'],
|
|
12
|
+
tsconfig: 'tsconfig.json',
|
|
13
|
+
treeshake: true,
|
|
14
|
+
shims: true,
|
|
15
|
+
keepNames: true,
|
|
16
|
+
target: 'es2022',
|
|
17
|
+
skipNodeModulesBundle: true,
|
|
18
|
+
platform: 'node',
|
|
19
|
+
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
import { XernerxMessage, XernerxSlashInteraction, XernerxUser, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
|
-
export declare function xernerxUser(event: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction, client: XernerxClient): Promise<XernerxUser>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
export async function xernerxUser(event, client) {
|
|
3
|
-
const author = event.author || event.user;
|
|
4
|
-
author.owner = isOwner(client, author);
|
|
5
|
-
if (client.dbl.validate) author.voted = await client?.dbl?.validate(author);
|
|
6
|
-
return author;
|
|
7
|
-
}
|
|
8
|
-
function isOwner(client, user) {
|
|
9
|
-
return client.settings.ownerId.includes(user.id);
|
|
10
|
-
}
|