xernerx 4.4.17 → 4.4.18
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 +23 -31
- package/dist/build/ContextCommandBuilder.js +39 -39
- package/dist/build/EventBuilder.d.ts +1 -1
- package/dist/build/EventBuilder.js +2 -2
- package/dist/build/InhibitorBuilder.d.ts +2 -11
- package/dist/build/InhibitorBuilder.js +2 -2
- package/dist/build/MessageCommandBuilder.d.ts +20 -26
- package/dist/build/MessageCommandBuilder.js +34 -34
- package/dist/build/SlashCommandBuilder.d.ts +25 -39
- package/dist/build/SlashCommandBuilder.js +48 -48
- package/dist/client/XernerxClient.d.ts +22 -30
- package/dist/client/XernerxClient.js +33 -33
- package/dist/client/XernerxShardClient.d.ts +1 -1
- package/dist/client/XernerxShardClient.js +13 -15
- package/dist/functions/delay.d.ts +1 -1
- package/dist/functions/delay.js +1 -1
- package/dist/functions/deploy.d.ts +1 -1
- package/dist/functions/deploy.js +20 -15
- package/dist/functions/isOwner.d.ts +1 -1
- package/dist/functions/isOwner.js +1 -1
- package/dist/functions/isVoter.d.ts +1 -1
- package/dist/functions/isVoter.js +1 -1
- package/dist/functions/load.d.ts +1 -1
- package/dist/functions/load.js +3 -2
- package/dist/functions/reload.d.ts +1 -1
- package/dist/functions/reload.js +12 -9
- package/dist/functions/sendWebhook.d.ts +1 -1
- package/dist/functions/sendWebhook.js +3 -2
- package/dist/functions/setPresence.d.ts +2 -2
- package/dist/functions/setPresence.js +11 -12
- package/dist/functions/xernerxUser.d.ts +1 -1
- package/dist/functions/xernerxUser.js +1 -1
- package/dist/handlers/CommandHandler.d.ts +1 -1
- package/dist/handlers/CommandHandler.js +109 -86
- package/dist/handlers/CommandHandler.js.map +1 -1
- package/dist/handlers/EventHandler.d.ts +1 -1
- package/dist/handlers/EventHandler.js +3 -3
- package/dist/handlers/ExtensionHandler.d.ts +1 -1
- package/dist/handlers/ExtensionHandler.js +5 -3
- package/dist/handlers/Handler.d.ts +1 -1
- package/dist/handlers/Handler.js +16 -6
- package/dist/handlers/InhibitorHandler.d.ts +1 -1
- package/dist/handlers/InhibitorHandler.js +3 -3
- package/dist/handlers/WebhookHandler.d.ts +4 -2
- package/dist/handlers/WebhookHandler.js +6 -9
- 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 +63 -48
- package/dist/tools/XernerxError.d.ts +1 -1
- package/dist/tools/XernerxError.js +1 -1
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +2 -7
- package/dist/types/extenders.d.ts +9 -5
- package/dist/types/extenders.js +1 -1
- package/dist/types/interfaces.d.ts +6 -9
- 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 +4 -4
- package/dist/utils/ClientUtil.js +14 -8
- package/dist/utils/InteractionUtil.d.ts +2 -2
- package/dist/utils/InteractionUtil.js +1 -1
- package/dist/utils/MessageUtil.d.ts +2 -2
- package/dist/utils/MessageUtil.js +9 -5
- package/dist/utils/Util.d.ts +1 -1
- package/dist/utils/Util.js +1 -1
- package/dist/validators/commandValidation.d.ts +2 -5
- package/dist/validators/commandValidation.js +29 -19
- package/dist/validators/inhibitorValidations.d.ts +3 -19
- package/dist/validators/inhibitorValidations.js +2 -2
- package/package.json +1 -1
|
@@ -13,39 +13,39 @@ export default class XernerxClient extends Client {
|
|
|
13
13
|
super(discordOptions);
|
|
14
14
|
this.settings = z
|
|
15
15
|
.object({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
.optional(),
|
|
26
|
-
ignore: z
|
|
27
|
-
.object({
|
|
28
|
-
owner: z.boolean().default(false),
|
|
29
|
-
users: z.array(z.string()).default([]),
|
|
30
|
-
channels: z.array(z.string()).default([]),
|
|
31
|
-
guilds: z.array(z.string()).default([]),
|
|
32
|
-
})
|
|
33
|
-
.optional(),
|
|
34
|
-
log: z
|
|
35
|
-
.object({
|
|
36
|
-
ready: z.boolean().default(false),
|
|
37
|
-
info: z.boolean().default(false),
|
|
38
|
-
error: z.boolean().default(false),
|
|
39
|
-
table: z.array(z.string()).or(z.null()).default(null),
|
|
40
|
-
})
|
|
41
|
-
.optional(),
|
|
42
|
-
cooldown: z
|
|
43
|
-
.object({
|
|
44
|
-
command: z.number().default(0),
|
|
45
|
-
cache: z.number().default(0),
|
|
46
|
-
})
|
|
47
|
-
.optional(),
|
|
16
|
+
local: z.string().or(z.undefined()).optional(),
|
|
17
|
+
global: z.boolean().default(false).optional(),
|
|
18
|
+
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
19
|
+
permissions: z
|
|
20
|
+
.object({
|
|
21
|
+
client: z.array(z.string()).default([]),
|
|
22
|
+
user: z.array(z.string()).default([]),
|
|
23
|
+
dm: z.boolean().default(false),
|
|
48
24
|
})
|
|
25
|
+
.optional(),
|
|
26
|
+
ignore: z
|
|
27
|
+
.object({
|
|
28
|
+
owner: z.boolean().default(false),
|
|
29
|
+
users: z.array(z.string()).default([]),
|
|
30
|
+
channels: z.array(z.string()).default([]),
|
|
31
|
+
guilds: z.array(z.string()).default([]),
|
|
32
|
+
})
|
|
33
|
+
.optional(),
|
|
34
|
+
log: z
|
|
35
|
+
.object({
|
|
36
|
+
ready: z.boolean().default(false),
|
|
37
|
+
info: z.boolean().default(false),
|
|
38
|
+
error: z.boolean().default(false),
|
|
39
|
+
table: z.array(z.string()).or(z.null()).default(null),
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
cooldown: z
|
|
43
|
+
.object({
|
|
44
|
+
command: z.number().default(0),
|
|
45
|
+
cache: z.number().default(0),
|
|
46
|
+
})
|
|
47
|
+
.optional(),
|
|
48
|
+
})
|
|
49
49
|
.parse(xernerxOptions);
|
|
50
50
|
this.config = config || null;
|
|
51
51
|
this.commands = {
|
|
@@ -82,4 +82,4 @@ export default class XernerxClient extends Client {
|
|
|
82
82
|
new XernerxLog(this).ready();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
//# sourceMappingURL=XernerxClient.js.map
|
|
85
|
+
//# sourceMappingURL=XernerxClient.js.map
|
|
@@ -14,4 +14,4 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
14
14
|
constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
17
|
-
//# sourceMappingURL=XernerxShardClient.d.ts.map
|
|
17
|
+
//# sourceMappingURL=XernerxShardClient.d.ts.map
|
|
@@ -8,27 +8,25 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
8
8
|
this.on('shardCreate', async (shard) => {
|
|
9
9
|
shard
|
|
10
10
|
.on('ready', async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const guilds = (await shard.fetchClientValue('guilds.cache'));
|
|
12
|
+
const guildCount = guilds.length;
|
|
13
|
+
const userCount = guilds.map((guild) => guild.memberCount).length ? guilds.map((guild) => guild.memberCount).reduce((a, b) => (a += b)) : 0;
|
|
14
|
+
this.stats.guildCount += Number(guildCount);
|
|
15
|
+
this.stats.userCount += Number(userCount);
|
|
16
|
+
this.stats.shardCount++;
|
|
17
|
+
this.user = (await shard.fetchClientValue('user'));
|
|
18
|
+
await new XernerxLog({ settings: xernerxOptions }).info(`Launched shard ${shard.id} for ${this.user?.tag}!`);
|
|
19
|
+
})
|
|
20
20
|
.on('error', (error) => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
new XernerxLog({ settings: xernerxOptions }).info(`An error occurred in ${shard.id} for ${this.user?.tag}! ${error}`);
|
|
22
|
+
});
|
|
23
23
|
});
|
|
24
24
|
const spawn = this.spawn();
|
|
25
25
|
spawn.then(async (shards) => {
|
|
26
26
|
const collector = setInterval(() => {
|
|
27
27
|
const index = shards.size - 1;
|
|
28
28
|
if (shards.get(index)?.ready) {
|
|
29
|
-
new XernerxLog({ settings: xernerxOptions }).info(
|
|
30
|
-
`Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`
|
|
31
|
-
);
|
|
29
|
+
new XernerxLog({ settings: xernerxOptions }).info(`Launched all ${this.stats.shardCount} shards for ${this.user?.tag}, watching ${this.stats.guildCount} guilds, and ${this.stats.userCount} users!`);
|
|
32
30
|
clearInterval(collector);
|
|
33
31
|
}
|
|
34
32
|
}, 1000);
|
|
@@ -39,4 +37,4 @@ export default class XernerxShardClient extends ShardingManager {
|
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
//# sourceMappingURL=XernerxShardClient.js.map
|
|
40
|
+
//# sourceMappingURL=XernerxShardClient.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default function delay(time: number): Promise<unknown>;
|
|
2
|
-
//# sourceMappingURL=delay.d.ts.map
|
|
2
|
+
//# sourceMappingURL=delay.d.ts.map
|
package/dist/functions/delay.js
CHANGED
package/dist/functions/deploy.js
CHANGED
|
@@ -4,32 +4,37 @@ import XernerxError from '../tools/XernerxError.js';
|
|
|
4
4
|
const commands = [];
|
|
5
5
|
export default function deploy(client) {
|
|
6
6
|
client.prependOnceListener('ready', (client) => {
|
|
7
|
-
if (client.commands.slash.size)
|
|
8
|
-
|
|
9
|
-
if (commands.
|
|
7
|
+
if (client.commands.slash.size)
|
|
8
|
+
client.commands.slash.map((command) => commands.push(command.data.toJSON()));
|
|
9
|
+
if (client.commands.context.size)
|
|
10
|
+
client.commands.context.map((command) => commands.push(command.data.toJSON()));
|
|
11
|
+
if (commands.length <= 0)
|
|
12
|
+
return;
|
|
10
13
|
try {
|
|
11
14
|
if (client.settings.global) {
|
|
12
15
|
put(client, client.settings.global, commands);
|
|
13
16
|
put(client, !client.settings.global, []);
|
|
14
|
-
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
15
19
|
put(client, !client.settings.global, commands);
|
|
16
20
|
put(client, client.settings.global, []);
|
|
17
21
|
}
|
|
18
|
-
}
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
19
24
|
new XernerxLog(client).error(`An error occurred while deploying the interaction commands!`, error);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
client.settings.global ? 'globally' : `locally in ${client.guilds.cache.get(client.settings.local).name}`
|
|
24
|
-
}.`
|
|
25
|
-
);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
new XernerxLog(client).info(`Deployed ${[client.commands.message.size, client.commands.slash.size, client.commands.context.size].reduce((a, b) => (a += b))} Commands ${client.settings.global ? 'globally' : `locally in ${client.guilds.cache.get(client.settings.local).name}`}.`);
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
function put(client, global, body) {
|
|
30
32
|
const rest = new REST({ version: GatewayVersion }).setToken(client.token);
|
|
31
|
-
if (!global && !client.settings?.local)
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
if (!global && !client.settings?.local)
|
|
34
|
+
throw new XernerxError(`No guild ID provided as local guild!`);
|
|
35
|
+
if (!global && client.settings?.local)
|
|
36
|
+
rest.put(Routes.applicationGuildCommands(client.user?.id, client.settings.local), { body });
|
|
37
|
+
else
|
|
38
|
+
rest.put(Routes.applicationCommands(client.user?.id), { body });
|
|
34
39
|
}
|
|
35
|
-
//# sourceMappingURL=deploy.js.map
|
|
40
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxUser } from '../types/extenders.js';
|
|
3
3
|
export default function isOwner(user: Pick<XernerxUser, 'id'>, client: XernerxClient): boolean;
|
|
4
|
-
//# sourceMappingURL=isOwner.d.ts.map
|
|
4
|
+
//# sourceMappingURL=isOwner.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxUser } from '../types/extenders.js';
|
|
3
3
|
export default function isVoter(user: XernerxUser, client: XernerxClient, token: string, host: 'top.gg'): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=isVoter.d.ts.map
|
|
4
|
+
//# sourceMappingURL=isVoter.d.ts.map
|
package/dist/functions/load.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { FileType } from '../types/types.js';
|
|
3
3
|
export default function load(client: XernerxClient, path: string, type: FileType): Promise<any>;
|
|
4
|
-
//# sourceMappingURL=load.d.ts.map
|
|
4
|
+
//# sourceMappingURL=load.d.ts.map
|
package/dist/functions/load.js
CHANGED
|
@@ -7,7 +7,8 @@ export default async function load(client, path, type) {
|
|
|
7
7
|
file.client = client;
|
|
8
8
|
fileSave(client, file, type);
|
|
9
9
|
return file;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
11
12
|
new XernerxLog(client).error(`Couldn't load ${type} ${path.match(/\w*\.js$/gim)?.at(0) || path}`, error);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -30,4 +31,4 @@ function fileSave(client, file, type) {
|
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
//# sourceMappingURL=load.js.map
|
|
34
|
+
//# sourceMappingURL=load.js.map
|
package/dist/functions/reload.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var FileTypes;
|
|
2
2
|
(function (FileTypes) {
|
|
3
|
-
FileTypes[
|
|
4
|
-
FileTypes[
|
|
5
|
-
FileTypes[
|
|
6
|
-
FileTypes[
|
|
7
|
-
FileTypes[
|
|
3
|
+
FileTypes["message"] = "MessageCommand";
|
|
4
|
+
FileTypes["slash"] = "SlashCommand";
|
|
5
|
+
FileTypes["context"] = "ContextCommand";
|
|
6
|
+
FileTypes["event"] = "Event";
|
|
7
|
+
FileTypes["inhibitor"] = "Inhibitor";
|
|
8
8
|
})(FileTypes || (FileTypes = {}));
|
|
9
9
|
export default function reload(client, type) {
|
|
10
10
|
const files = [];
|
|
@@ -31,10 +31,13 @@ export default function reload(client, type) {
|
|
|
31
31
|
filedata.fileType = FileTypes[type];
|
|
32
32
|
filedata.filePath = file;
|
|
33
33
|
filedata.client = client;
|
|
34
|
-
if (type === 'message' || type === 'slash' || type === 'context')
|
|
35
|
-
|
|
36
|
-
if (type === '
|
|
34
|
+
if (type === 'message' || type === 'slash' || type === 'context')
|
|
35
|
+
client.commands[type].set(filedata.name, filedata);
|
|
36
|
+
if (type === 'event')
|
|
37
|
+
client.events.set(filedata.name, filedata);
|
|
38
|
+
if (type === 'inhibitor')
|
|
39
|
+
client.inhibitors.set(filedata.name, filedata);
|
|
37
40
|
return filedata;
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
|
-
//# sourceMappingURL=reload.js.map
|
|
43
|
+
//# sourceMappingURL=reload.js.map
|
|
@@ -6,8 +6,9 @@ export default async function sendWebhook(url, body) {
|
|
|
6
6
|
},
|
|
7
7
|
body: JSON.stringify(body),
|
|
8
8
|
});
|
|
9
|
-
if (response.status === 204)
|
|
9
|
+
if (response.status === 204)
|
|
10
|
+
return true;
|
|
10
11
|
const data = await response.json();
|
|
11
12
|
return data;
|
|
12
13
|
}
|
|
13
|
-
//# sourceMappingURL=sendWebhook.js.map
|
|
14
|
+
//# sourceMappingURL=sendWebhook.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../main.js';
|
|
2
2
|
import { PresenceOptions } from '../types/interfaces.js';
|
|
3
|
-
export default function setPresence(client: XernerxClient, options: PresenceOptions): import(
|
|
4
|
-
//# sourceMappingURL=setPresence.d.ts.map
|
|
3
|
+
export default function setPresence(client: XernerxClient, options: PresenceOptions): import("discord.js").ClientPresence | undefined;
|
|
4
|
+
//# sourceMappingURL=setPresence.d.ts.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
export default function setPresence(client, options) {
|
|
2
|
-
const presence = () =>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
2
|
+
const presence = () => client.user?.setPresence({
|
|
3
|
+
activities: [
|
|
4
|
+
{
|
|
5
|
+
name: options.text,
|
|
6
|
+
type: options.type,
|
|
7
|
+
url: options.url,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
status: options.status,
|
|
11
|
+
});
|
|
13
12
|
let response = presence();
|
|
14
13
|
if (options.interval)
|
|
15
14
|
setInterval(() => {
|
|
@@ -17,4 +16,4 @@ export default function setPresence(client, options) {
|
|
|
17
16
|
}, options.interval);
|
|
18
17
|
return response;
|
|
19
18
|
}
|
|
20
|
-
//# sourceMappingURL=setPresence.js.map
|
|
19
|
+
//# sourceMappingURL=setPresence.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxMessage, XernerxSlashInteraction, XernerxUser, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
3
3
|
export declare function xernerxUser(event: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxUserContextInteraction, client: XernerxClient): Promise<XernerxUser>;
|
|
4
|
-
//# sourceMappingURL=xernerxUser.d.ts.map
|
|
4
|
+
//# sourceMappingURL=xernerxUser.d.ts.map
|