xernerx 4.4.2 → 4.4.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/package.json +2 -2
- package/dist/build/ContextCommandBuilder.d.ts +0 -48
- package/dist/build/ContextCommandBuilder.js +0 -67
- package/dist/build/EventBuilder.d.ts +0 -22
- package/dist/build/EventBuilder.js +0 -29
- package/dist/build/InhibitorBuilder.d.ts +0 -17
- package/dist/build/InhibitorBuilder.js +0 -22
- package/dist/build/MessageCommandBuilder.d.ts +0 -45
- package/dist/build/MessageCommandBuilder.js +0 -60
- package/dist/build/SlashCommandBuilder.d.ts +0 -52
- package/dist/build/SlashCommandBuilder.js +0 -113
- package/dist/client/XernerxClient.d.ts +0 -55
- package/dist/client/XernerxClient.js +0 -82
- package/dist/client/XernerxShardClient.d.ts +0 -16
- package/dist/client/XernerxShardClient.js +0 -32
- package/dist/functions/delay.d.ts +0 -1
- package/dist/functions/delay.js +0 -3
- package/dist/functions/deploy.d.ts +0 -2
- package/dist/functions/deploy.js +0 -33
- package/dist/functions/isOwner.d.ts +0 -3
- package/dist/functions/isOwner.js +0 -3
- package/dist/functions/isVoter.d.ts +0 -3
- package/dist/functions/isVoter.js +0 -5
- package/dist/functions/load.d.ts +0 -3
- package/dist/functions/load.js +0 -32
- package/dist/functions/reload.d.ts +0 -2
- package/dist/functions/reload.js +0 -39
- package/dist/functions/sendWebhook.d.ts +0 -2
- package/dist/functions/sendWebhook.js +0 -12
- package/dist/functions/setPresence.d.ts +0 -3
- package/dist/functions/setPresence.js +0 -19
- package/dist/functions/xernerxUser.d.ts +0 -3
- package/dist/functions/xernerxUser.js +0 -8
- package/dist/handlers/CommandHandler.d.ts +0 -13
- package/dist/handlers/CommandHandler.js +0 -251
- package/dist/handlers/EventHandler.d.ts +0 -7
- package/dist/handlers/EventHandler.js +0 -24
- package/dist/handlers/ExtensionHandler.d.ts +0 -7
- package/dist/handlers/ExtensionHandler.js +0 -21
- package/dist/handlers/Handler.d.ts +0 -14
- package/dist/handlers/Handler.js +0 -36
- package/dist/handlers/InhibitorHandler.d.ts +0 -7
- package/dist/handlers/InhibitorHandler.js +0 -24
- package/dist/handlers/WebhookHandler.d.ts +0 -7
- package/dist/handlers/WebhookHandler.js +0 -50
- package/dist/main.d.ts +0 -42
- package/dist/main.js +0 -43
- package/dist/models/Arguments.d.ts +0 -15
- package/dist/models/Arguments.js +0 -129
- package/dist/tools/XernerxError.d.ts +0 -6
- package/dist/tools/XernerxError.js +0 -10
- package/dist/tools/XernerxLog.d.ts +0 -14
- package/dist/tools/XernerxLog.js +0 -48
- package/dist/types/extenders.d.ts +0 -28
- package/dist/types/extenders.js +0 -1
- package/dist/types/interfaces.d.ts +0 -236
- package/dist/types/interfaces.js +0 -1
- package/dist/types/types.d.ts +0 -181
- package/dist/types/types.js +0 -1
- package/dist/utils/ClientUtil.d.ts +0 -10
- package/dist/utils/ClientUtil.js +0 -30
- package/dist/utils/InteractionUtil.d.ts +0 -10
- package/dist/utils/InteractionUtil.js +0 -15
- package/dist/utils/MessageUtil.d.ts +0 -15
- package/dist/utils/MessageUtil.js +0 -46
- package/dist/utils/Util.d.ts +0 -5
- package/dist/utils/Util.js +0 -6
- package/dist/validators/commandValidation.d.ts +0 -6
- package/dist/validators/commandValidation.js +0 -49
- package/dist/validators/inhibitorValidations.d.ts +0 -18
- package/dist/validators/inhibitorValidations.js +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xernerx",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.3",
|
|
4
4
|
"description": "A bot framework for discord.js.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"dbl-sdk": "^1.2.0",
|
|
40
|
-
"discord.js": "^14.
|
|
40
|
+
"discord.js": "^14.11.0",
|
|
41
41
|
"dumfunctions": "^2.1.2",
|
|
42
42
|
"xernerx-extension-builder": "^0.0.16",
|
|
43
43
|
"zod": "^3.21.4"
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
import { XernerxMessageContextInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
|
-
import { ContextCommandOptions } from '../types/interfaces.js';
|
|
5
|
-
export default class ContextCommandBuilder {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
readonly data: ContextMenuCommandBuilder;
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly type: 'message' | 'user';
|
|
10
|
-
readonly description: string | null | undefined;
|
|
11
|
-
readonly usage: string | null | undefined;
|
|
12
|
-
readonly info: string | null | undefined;
|
|
13
|
-
readonly category: string | null | undefined;
|
|
14
|
-
readonly cooldown: number | null | undefined;
|
|
15
|
-
readonly ignore:
|
|
16
|
-
| {
|
|
17
|
-
owner?: boolean | undefined;
|
|
18
|
-
users?: string[] | undefined;
|
|
19
|
-
channels?: string[] | undefined;
|
|
20
|
-
guilds?: string[] | undefined;
|
|
21
|
-
}
|
|
22
|
-
| undefined;
|
|
23
|
-
readonly strict:
|
|
24
|
-
| {
|
|
25
|
-
owner?: boolean | undefined;
|
|
26
|
-
users?: string[] | undefined;
|
|
27
|
-
channels?: string[] | undefined;
|
|
28
|
-
guilds?: string[] | undefined;
|
|
29
|
-
}
|
|
30
|
-
| undefined;
|
|
31
|
-
readonly permissions:
|
|
32
|
-
| {
|
|
33
|
-
user?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
34
|
-
client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
35
|
-
dm?: boolean | undefined;
|
|
36
|
-
}
|
|
37
|
-
| undefined;
|
|
38
|
-
readonly defer:
|
|
39
|
-
| {
|
|
40
|
-
reply?: boolean | undefined;
|
|
41
|
-
ephemeral?: boolean | undefined;
|
|
42
|
-
fetchReply?: boolean | undefined;
|
|
43
|
-
}
|
|
44
|
-
| undefined;
|
|
45
|
-
readonly client: typeof XernerxClient;
|
|
46
|
-
constructor(id: string, options: ContextCommandOptions);
|
|
47
|
-
exec(interaction: XernerxUserContextInteraction | XernerxMessageContextInteraction): Promise<void>;
|
|
48
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
export default class ContextCommandBuilder {
|
|
5
|
-
constructor(id, options) {
|
|
6
|
-
this.id = id;
|
|
7
|
-
this.data = new ContextMenuCommandBuilder();
|
|
8
|
-
this.data.setName(options.name);
|
|
9
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
10
|
-
this.data.setType(options.type === 'user' ? 2 : 3);
|
|
11
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
12
|
-
options = z
|
|
13
|
-
.object({
|
|
14
|
-
name: z.string(),
|
|
15
|
-
type: z.enum(['user', 'message']),
|
|
16
|
-
description: z.string().or(z.null()).default(null),
|
|
17
|
-
usage: z.string().or(z.null()).default(null),
|
|
18
|
-
info: z.string().or(z.null()).default(null),
|
|
19
|
-
category: z.string().or(z.null()).default(null),
|
|
20
|
-
cooldown: z.number().or(z.null()).default(null),
|
|
21
|
-
ignore: z
|
|
22
|
-
.object({
|
|
23
|
-
owner: z.boolean().default(false),
|
|
24
|
-
users: z.array(z.string()).default([]),
|
|
25
|
-
channels: z.array(z.string()).default([]),
|
|
26
|
-
guilds: z.array(z.string()).default([]),
|
|
27
|
-
})
|
|
28
|
-
.default({}),
|
|
29
|
-
strict: z
|
|
30
|
-
.object({
|
|
31
|
-
owner: z.boolean().default(false),
|
|
32
|
-
users: z.array(z.string()).default([]),
|
|
33
|
-
channels: z.array(z.string()).default([]),
|
|
34
|
-
guilds: z.array(z.string()).default([]),
|
|
35
|
-
})
|
|
36
|
-
.default({}),
|
|
37
|
-
permissions: z
|
|
38
|
-
.object({
|
|
39
|
-
user: z.array(z.string()).default([]),
|
|
40
|
-
client: z.array(z.string()).default([]),
|
|
41
|
-
dm: z.boolean().default(true),
|
|
42
|
-
})
|
|
43
|
-
.default({}),
|
|
44
|
-
defer: z
|
|
45
|
-
.object({
|
|
46
|
-
reply: z.boolean().default(false),
|
|
47
|
-
ephemeral: z.boolean().default(false),
|
|
48
|
-
fetch: z.boolean().default(false),
|
|
49
|
-
})
|
|
50
|
-
.default({}),
|
|
51
|
-
})
|
|
52
|
-
.parse(options);
|
|
53
|
-
this.name = options.name;
|
|
54
|
-
this.type = options.type;
|
|
55
|
-
this.description = options.description;
|
|
56
|
-
this.usage = options.usage;
|
|
57
|
-
this.info = options.info;
|
|
58
|
-
this.category = options.category;
|
|
59
|
-
this.cooldown = options.cooldown;
|
|
60
|
-
this.ignore = options.ignore;
|
|
61
|
-
this.strict = options.strict;
|
|
62
|
-
this.permissions = options.permissions;
|
|
63
|
-
this.defer = options.defer;
|
|
64
|
-
this.client = XernerxClient;
|
|
65
|
-
}
|
|
66
|
-
async exec(interaction) {}
|
|
67
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
-
import { EventBuilderOptions } from '../types/interfaces.js';
|
|
3
|
-
import { EventType } from '../types/types.js';
|
|
4
|
-
/**
|
|
5
|
-
* @description - The event builder for events.
|
|
6
|
-
* @param {String} id - The unique ID of the event.
|
|
7
|
-
* @param {EventOptions} options - The event options.
|
|
8
|
-
*/
|
|
9
|
-
export default class EventBuilder {
|
|
10
|
-
readonly id: string;
|
|
11
|
-
readonly name: EventType;
|
|
12
|
-
readonly emitter?: 'client' | 'process' | string;
|
|
13
|
-
readonly type?: 'discord' | string;
|
|
14
|
-
readonly once?: boolean;
|
|
15
|
-
readonly client: typeof XernerxClient;
|
|
16
|
-
constructor(id: string, options: EventBuilderOptions);
|
|
17
|
-
/**
|
|
18
|
-
* @description run your custom event here.
|
|
19
|
-
* TODO - update description
|
|
20
|
-
*/
|
|
21
|
-
run<T>(...args: T[]): Promise<void>;
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
// import { EventOptions } from '../types/options.js';
|
|
4
|
-
/**
|
|
5
|
-
* @description - The event builder for events.
|
|
6
|
-
* @param {String} id - The unique ID of the event.
|
|
7
|
-
* @param {EventOptions} options - The event options.
|
|
8
|
-
*/
|
|
9
|
-
export default class EventBuilder {
|
|
10
|
-
constructor(id, options) {
|
|
11
|
-
this.id = id;
|
|
12
|
-
z.object({
|
|
13
|
-
name: z.string(),
|
|
14
|
-
emitter: z.string().optional(),
|
|
15
|
-
type: z.string().optional(),
|
|
16
|
-
once: z.boolean().optional(),
|
|
17
|
-
}).parse(options);
|
|
18
|
-
this.name = options.name;
|
|
19
|
-
this.emitter = options.emitter || 'client';
|
|
20
|
-
this.type = options.type || 'discord';
|
|
21
|
-
this.once = options.once || false;
|
|
22
|
-
this.client = XernerxClient;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @description run your custom event here.
|
|
26
|
-
* TODO - update description
|
|
27
|
-
*/
|
|
28
|
-
async run(...args) {}
|
|
29
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
-
import { InhibitorBuilderOptions } from '../types/interfaces.js';
|
|
3
|
-
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
4
|
-
import { XernerxMessage } from '../types/extenders.js';
|
|
5
|
-
/**
|
|
6
|
-
* @description - The inhibitor builder for inhibitors.
|
|
7
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
8
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
9
|
-
*/
|
|
10
|
-
export default class InhibitorBuilder {
|
|
11
|
-
readonly id: string;
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly type: InhibitorType;
|
|
14
|
-
readonly client: typeof XernerxClient;
|
|
15
|
-
constructor(id: string, options: InhibitorBuilderOptions);
|
|
16
|
-
check<T>(action: XernerxInteraction | XernerxMessage, args: T): Promise<void>;
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
// import { InhibitorOptions, MessageArgumentOptions, SlashArgumentOptions } from '../types/options.js';
|
|
4
|
-
// import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
5
|
-
/**
|
|
6
|
-
* @description - The inhibitor builder for inhibitors.
|
|
7
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
8
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
9
|
-
*/
|
|
10
|
-
export default class InhibitorBuilder {
|
|
11
|
-
constructor(id, options) {
|
|
12
|
-
this.id = id;
|
|
13
|
-
z.object({
|
|
14
|
-
name: z.string(),
|
|
15
|
-
type: z.string(),
|
|
16
|
-
}).parse(options);
|
|
17
|
-
this.name = options.name;
|
|
18
|
-
this.type = options.type;
|
|
19
|
-
this.client = XernerxClient;
|
|
20
|
-
}
|
|
21
|
-
async check(action, args) {}
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
-
import { XernerxMessage } from '../types/extenders.js';
|
|
3
|
-
import { MessageCommandArguments, MessageCommandOptions } from '../types/interfaces.js';
|
|
4
|
-
export default class MessageCommandBuilder {
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly aliases: string[] | undefined;
|
|
8
|
-
readonly regex: RegExp | undefined;
|
|
9
|
-
readonly prefix: string | string[] | undefined;
|
|
10
|
-
readonly description: string | null | undefined;
|
|
11
|
-
readonly usage: string | null | undefined;
|
|
12
|
-
readonly info: string | null | undefined;
|
|
13
|
-
readonly separator: string | undefined;
|
|
14
|
-
readonly args: import('../types/interfaces.js').MessageCommandArgumentOptions[] | undefined;
|
|
15
|
-
readonly flags: import('../types/interfaces.js').MessageCommandFlagOptions[] | undefined;
|
|
16
|
-
readonly category: string | null | undefined;
|
|
17
|
-
readonly cooldown: number | null | undefined;
|
|
18
|
-
readonly ignore:
|
|
19
|
-
| {
|
|
20
|
-
owner?: boolean | undefined;
|
|
21
|
-
users?: string[] | undefined;
|
|
22
|
-
channels?: string[] | undefined;
|
|
23
|
-
guilds?: string[] | undefined;
|
|
24
|
-
}
|
|
25
|
-
| undefined;
|
|
26
|
-
readonly strict:
|
|
27
|
-
| {
|
|
28
|
-
owner?: boolean | undefined;
|
|
29
|
-
users?: string[] | undefined;
|
|
30
|
-
channels?: string[] | undefined;
|
|
31
|
-
guilds?: string[] | undefined;
|
|
32
|
-
}
|
|
33
|
-
| undefined;
|
|
34
|
-
readonly permissions:
|
|
35
|
-
| {
|
|
36
|
-
user?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
37
|
-
client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
38
|
-
dm?: boolean | undefined;
|
|
39
|
-
}
|
|
40
|
-
| undefined;
|
|
41
|
-
readonly client: typeof XernerxClient;
|
|
42
|
-
constructor(id: string, options: MessageCommandOptions);
|
|
43
|
-
conditions(message: XernerxMessage, args: MessageCommandArguments): Promise<void>;
|
|
44
|
-
exec(message: XernerxMessage, args: MessageCommandArguments): Promise<void>;
|
|
45
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
export default class MessageCommandBuilder {
|
|
4
|
-
constructor(id, options) {
|
|
5
|
-
this.id = id;
|
|
6
|
-
this.regex = options.regex;
|
|
7
|
-
this.args = options.args;
|
|
8
|
-
this.flags = options.flags;
|
|
9
|
-
options = z
|
|
10
|
-
.object({
|
|
11
|
-
name: z.string(),
|
|
12
|
-
aliases: z.array(z.string()).default([]),
|
|
13
|
-
description: z.string().or(z.null()).default(null),
|
|
14
|
-
usage: z.string().or(z.null()).default(null),
|
|
15
|
-
info: z.string().or(z.null()).default(null),
|
|
16
|
-
category: z.string().or(z.null()).default(null),
|
|
17
|
-
cooldown: z.number().or(z.null()).default(null),
|
|
18
|
-
prefix: z.array(z.string()).or(z.string()).default([]),
|
|
19
|
-
ignore: z
|
|
20
|
-
.object({
|
|
21
|
-
owner: z.boolean().default(false),
|
|
22
|
-
users: z.array(z.string()).default([]),
|
|
23
|
-
channels: z.array(z.string()).default([]),
|
|
24
|
-
guilds: z.array(z.string()).default([]),
|
|
25
|
-
})
|
|
26
|
-
.default({}),
|
|
27
|
-
strict: z
|
|
28
|
-
.object({
|
|
29
|
-
owner: z.boolean().default(false),
|
|
30
|
-
users: z.array(z.string()).default([]),
|
|
31
|
-
channels: z.array(z.string()).default([]),
|
|
32
|
-
guilds: z.array(z.string()).default([]),
|
|
33
|
-
})
|
|
34
|
-
.default({}),
|
|
35
|
-
permissions: z
|
|
36
|
-
.object({
|
|
37
|
-
user: z.array(z.string()).default([]),
|
|
38
|
-
client: z.array(z.string()).default([]),
|
|
39
|
-
dm: z.boolean().default(true),
|
|
40
|
-
})
|
|
41
|
-
.default({}),
|
|
42
|
-
})
|
|
43
|
-
.parse(options);
|
|
44
|
-
this.name = options.name;
|
|
45
|
-
this.aliases = options.aliases;
|
|
46
|
-
this.prefix = options.prefix;
|
|
47
|
-
this.description = options.description;
|
|
48
|
-
this.usage = options.usage;
|
|
49
|
-
this.info = options.info;
|
|
50
|
-
this.category = options.category;
|
|
51
|
-
this.cooldown = options.cooldown;
|
|
52
|
-
this.ignore = options.ignore;
|
|
53
|
-
this.strict = options.strict;
|
|
54
|
-
this.separator = options.separator;
|
|
55
|
-
this.permissions = options.permissions;
|
|
56
|
-
this.client = XernerxClient;
|
|
57
|
-
}
|
|
58
|
-
async conditions(message, args) {}
|
|
59
|
-
async exec(message, args) {}
|
|
60
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import Discord from 'discord.js';
|
|
2
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
import { XernerxSlashInteraction } from '../types/extenders.js';
|
|
4
|
-
import { SlashCommandArguments, SlashCommandOptions } from '../types/interfaces.js';
|
|
5
|
-
export default class SlashCommandBuilder {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
readonly data: Discord.SlashCommandBuilder;
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly description: string;
|
|
10
|
-
readonly usage: string | null | undefined;
|
|
11
|
-
readonly info: string | null | undefined;
|
|
12
|
-
readonly category: string | null | undefined;
|
|
13
|
-
readonly cooldown: number | null | undefined;
|
|
14
|
-
readonly ignore:
|
|
15
|
-
| {
|
|
16
|
-
owner?: boolean | undefined;
|
|
17
|
-
users?: string[] | undefined;
|
|
18
|
-
channels?: string[] | undefined;
|
|
19
|
-
guilds?: string[] | undefined;
|
|
20
|
-
}
|
|
21
|
-
| undefined;
|
|
22
|
-
readonly strict:
|
|
23
|
-
| {
|
|
24
|
-
owner?: boolean | undefined;
|
|
25
|
-
users?: string[] | undefined;
|
|
26
|
-
channels?: string[] | undefined;
|
|
27
|
-
guilds?: string[] | undefined;
|
|
28
|
-
}
|
|
29
|
-
| undefined;
|
|
30
|
-
readonly permissions:
|
|
31
|
-
| {
|
|
32
|
-
user?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
33
|
-
client?: string[] | import('../types/types.js').PermissionNames[] | undefined;
|
|
34
|
-
dm?: boolean | undefined;
|
|
35
|
-
}
|
|
36
|
-
| undefined;
|
|
37
|
-
readonly defer:
|
|
38
|
-
| {
|
|
39
|
-
reply?: boolean | undefined;
|
|
40
|
-
ephemeral?: boolean | undefined;
|
|
41
|
-
fetchReply?: boolean | undefined;
|
|
42
|
-
}
|
|
43
|
-
| undefined;
|
|
44
|
-
readonly client: typeof XernerxClient;
|
|
45
|
-
constructor(id: string, options: SlashCommandOptions);
|
|
46
|
-
autocomplete<T>(interaction: XernerxSlashInteraction, focused: T, options: Array<T>): Promise<void>;
|
|
47
|
-
conditions(interaction: XernerxSlashInteraction, args: SlashCommandArguments): Promise<void>;
|
|
48
|
-
exec(interaction: XernerxSlashInteraction, args: SlashCommandArguments): Promise<void>;
|
|
49
|
-
private addArguments;
|
|
50
|
-
private addSubcommands;
|
|
51
|
-
private addSubcommandGroups;
|
|
52
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import Discord, { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from 'discord.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
4
|
-
export default class SlashCommandBuilder {
|
|
5
|
-
constructor(id, options) {
|
|
6
|
-
this.id = id;
|
|
7
|
-
this.data = new Discord.SlashCommandBuilder();
|
|
8
|
-
this.data.setName(options.name);
|
|
9
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
10
|
-
this.data.setDescription(options.description);
|
|
11
|
-
this.data.setDescriptionLocalizations(options.descriptionLocalizations || null);
|
|
12
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
13
|
-
if (options.args && options?.args?.length > 0) {
|
|
14
|
-
this.addArguments(this.data, options.args);
|
|
15
|
-
}
|
|
16
|
-
if (options.subcommands && options?.subcommands?.length > 0) {
|
|
17
|
-
this.addSubcommands(this.data, options.subcommands);
|
|
18
|
-
}
|
|
19
|
-
if (options.groups && options?.groups?.length > 0) {
|
|
20
|
-
this.addSubcommandGroups(options.groups);
|
|
21
|
-
}
|
|
22
|
-
options = z
|
|
23
|
-
.object({
|
|
24
|
-
name: z.string(),
|
|
25
|
-
description: z.string(),
|
|
26
|
-
usage: z.string().or(z.null()).default(null),
|
|
27
|
-
info: z.string().or(z.null()).default(null),
|
|
28
|
-
category: z.string().or(z.null()).default(null),
|
|
29
|
-
number: z.number().or(z.null()).default(null),
|
|
30
|
-
channelType: z.array(z.number()).or(z.null()).default(null),
|
|
31
|
-
ignore: z
|
|
32
|
-
.object({
|
|
33
|
-
owner: z.boolean().default(false),
|
|
34
|
-
users: z.array(z.string()).default([]),
|
|
35
|
-
channels: z.array(z.string()).default([]),
|
|
36
|
-
guilds: z.array(z.string()).default([]),
|
|
37
|
-
})
|
|
38
|
-
.default({}),
|
|
39
|
-
strict: z
|
|
40
|
-
.object({
|
|
41
|
-
owner: z.boolean().default(false),
|
|
42
|
-
users: z.array(z.string()).default([]),
|
|
43
|
-
channels: z.array(z.string()).default([]),
|
|
44
|
-
guilds: z.array(z.string()).default([]),
|
|
45
|
-
})
|
|
46
|
-
.default({}),
|
|
47
|
-
permissions: z
|
|
48
|
-
.object({
|
|
49
|
-
user: z.array(z.string()).default([]),
|
|
50
|
-
client: z.array(z.string()).default([]),
|
|
51
|
-
dm: z.boolean().default(true),
|
|
52
|
-
})
|
|
53
|
-
.default({}),
|
|
54
|
-
defer: z
|
|
55
|
-
.object({
|
|
56
|
-
reply: z.boolean().default(false),
|
|
57
|
-
ephemeral: z.boolean().default(false),
|
|
58
|
-
fetch: z.boolean().default(false),
|
|
59
|
-
})
|
|
60
|
-
.default({}),
|
|
61
|
-
})
|
|
62
|
-
.parse(options);
|
|
63
|
-
this.name = options.name;
|
|
64
|
-
this.description = options.description;
|
|
65
|
-
this.usage = options.usage;
|
|
66
|
-
this.info = options.info;
|
|
67
|
-
this.category = options.category;
|
|
68
|
-
this.cooldown = options.cooldown;
|
|
69
|
-
this.ignore = options.ignore;
|
|
70
|
-
this.strict = options.strict;
|
|
71
|
-
this.permissions = options.permissions;
|
|
72
|
-
this.defer = options.defer;
|
|
73
|
-
this.client = XernerxClient;
|
|
74
|
-
}
|
|
75
|
-
async autocomplete(interaction, focused, options) {}
|
|
76
|
-
async conditions(interaction, args) {}
|
|
77
|
-
async exec(interaction, args) {}
|
|
78
|
-
addArguments(command, args) {
|
|
79
|
-
for (const argument of args) {
|
|
80
|
-
let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
81
|
-
command[`add${slashCommandArgumentType}Option`]((option) => {
|
|
82
|
-
option
|
|
83
|
-
.setName(argument.name)
|
|
84
|
-
.setDescription(argument.description)
|
|
85
|
-
.setRequired(argument.required || false);
|
|
86
|
-
if (slashCommandArgumentType === 'String') {
|
|
87
|
-
if (argument.choices)
|
|
88
|
-
option.setChoices(
|
|
89
|
-
...argument.choices.map((choices) => {
|
|
90
|
-
return { name: Object.keys(choices).at(0), value: Object.values(choices).at(0) };
|
|
91
|
-
})
|
|
92
|
-
);
|
|
93
|
-
option.setAutocomplete(argument.autocomplete || false);
|
|
94
|
-
}
|
|
95
|
-
return option;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
addSubcommands(method, subcommands) {
|
|
100
|
-
for (const subcommand of subcommands) {
|
|
101
|
-
let sub = new SlashCommandSubcommandBuilder().setName(subcommand.name).setDescription(subcommand.description);
|
|
102
|
-
if (subcommand.args?.length > 0) this.addArguments(sub, subcommand.args);
|
|
103
|
-
method.addSubcommand(sub);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
addSubcommandGroups(groups) {
|
|
107
|
-
for (const group of groups) {
|
|
108
|
-
let subcommandGroup = new SlashCommandSubcommandGroupBuilder().setName(group.name).setDescription(group.description);
|
|
109
|
-
if (group.subcommands?.length > 0) this.addSubcommands(subcommandGroup, group.subcommands);
|
|
110
|
-
this.data.addSubcommandGroup(subcommandGroup);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Client, ClientOptions, Collection } from 'discord.js';
|
|
2
|
-
import { XernerxOptions, ModuleOptions, XernerxCommands, XernerxCache } from '../types/interfaces.js';
|
|
3
|
-
import ClientUtil from '../utils/ClientUtil.js';
|
|
4
|
-
import { InhibitorBuilder, EventBuilder } from '../main.js';
|
|
5
|
-
export default class XernerxClient extends Client {
|
|
6
|
-
readonly settings: {
|
|
7
|
-
ownerId: (string | string[]) & (string | string[] | undefined);
|
|
8
|
-
global: boolean;
|
|
9
|
-
local?: string | undefined;
|
|
10
|
-
permissions?:
|
|
11
|
-
| {
|
|
12
|
-
client: string[];
|
|
13
|
-
user: string[];
|
|
14
|
-
dm: boolean;
|
|
15
|
-
}
|
|
16
|
-
| undefined;
|
|
17
|
-
ignore?:
|
|
18
|
-
| {
|
|
19
|
-
owner: boolean;
|
|
20
|
-
users: string[];
|
|
21
|
-
channels: string[];
|
|
22
|
-
guilds: string[];
|
|
23
|
-
}
|
|
24
|
-
| undefined;
|
|
25
|
-
log?:
|
|
26
|
-
| {
|
|
27
|
-
ready: boolean;
|
|
28
|
-
error: boolean;
|
|
29
|
-
info: boolean;
|
|
30
|
-
table: string[] | null;
|
|
31
|
-
}
|
|
32
|
-
| undefined;
|
|
33
|
-
cooldown?:
|
|
34
|
-
| {
|
|
35
|
-
command: number;
|
|
36
|
-
cache: number;
|
|
37
|
-
}
|
|
38
|
-
| undefined;
|
|
39
|
-
};
|
|
40
|
-
readonly config: Record<string, unknown> | null;
|
|
41
|
-
readonly commands: XernerxCommands;
|
|
42
|
-
readonly events: Collection<string, EventBuilder>;
|
|
43
|
-
readonly inhibitors: Collection<string, InhibitorBuilder>;
|
|
44
|
-
readonly modules: ModuleOptions;
|
|
45
|
-
readonly util: ClientUtil;
|
|
46
|
-
readonly stats: {
|
|
47
|
-
guildCount: number;
|
|
48
|
-
userCount: number;
|
|
49
|
-
shardId: number;
|
|
50
|
-
shardCount: number;
|
|
51
|
-
};
|
|
52
|
-
readonly cache: XernerxCache;
|
|
53
|
-
constructor(discordOptions: ClientOptions, xernerxOptions: XernerxOptions, config?: Record<string, unknown>);
|
|
54
|
-
connect(token: string): void;
|
|
55
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Client, Collection } from 'discord.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import CommandHandler from '../handlers/CommandHandler.js';
|
|
4
|
-
import EventHandler from '../handlers/EventHandler.js';
|
|
5
|
-
import InhibitorHandler from '../handlers/InhibitorHandler.js';
|
|
6
|
-
import WebhookHandler from '../handlers/WebhookHandler.js';
|
|
7
|
-
import XernerxLog from '../tools/XernerxLog.js';
|
|
8
|
-
import ClientUtil from '../utils/ClientUtil.js';
|
|
9
|
-
import ExtensionHandler from '../handlers/ExtensionHandler.js';
|
|
10
|
-
export default class XernerxClient extends Client {
|
|
11
|
-
constructor(discordOptions, xernerxOptions, config) {
|
|
12
|
-
super(discordOptions);
|
|
13
|
-
this.settings = z
|
|
14
|
-
.object({
|
|
15
|
-
local: z.string().optional(),
|
|
16
|
-
global: z.boolean().default(false),
|
|
17
|
-
ownerId: z.string().or(z.array(z.string())).default([]),
|
|
18
|
-
permissions: z
|
|
19
|
-
.object({
|
|
20
|
-
client: z.array(z.string()).default([]),
|
|
21
|
-
user: z.array(z.string()).default([]),
|
|
22
|
-
dm: z.boolean().default(false),
|
|
23
|
-
})
|
|
24
|
-
.optional(),
|
|
25
|
-
ignore: z
|
|
26
|
-
.object({
|
|
27
|
-
owner: z.boolean().default(false),
|
|
28
|
-
users: z.array(z.string()),
|
|
29
|
-
channels: z.array(z.string()),
|
|
30
|
-
guilds: z.array(z.string()),
|
|
31
|
-
})
|
|
32
|
-
.optional(),
|
|
33
|
-
log: z
|
|
34
|
-
.object({
|
|
35
|
-
ready: z.boolean().default(false),
|
|
36
|
-
info: z.boolean().default(false),
|
|
37
|
-
error: z.boolean().default(false),
|
|
38
|
-
table: z.array(z.string()).or(z.null()).default(null),
|
|
39
|
-
})
|
|
40
|
-
.optional(),
|
|
41
|
-
cooldown: z
|
|
42
|
-
.object({
|
|
43
|
-
command: z.number().default(0),
|
|
44
|
-
cache: z.number().default(0),
|
|
45
|
-
})
|
|
46
|
-
.optional(),
|
|
47
|
-
})
|
|
48
|
-
.parse(xernerxOptions);
|
|
49
|
-
this.config = config || null;
|
|
50
|
-
this.commands = {
|
|
51
|
-
message: new Collection(),
|
|
52
|
-
slash: new Collection(),
|
|
53
|
-
context: new Collection(),
|
|
54
|
-
};
|
|
55
|
-
this.events = new Collection();
|
|
56
|
-
this.inhibitors = new Collection();
|
|
57
|
-
this.modules = {
|
|
58
|
-
options: {},
|
|
59
|
-
commandHandler: new CommandHandler(this),
|
|
60
|
-
eventHandler: new EventHandler(this),
|
|
61
|
-
inhibitorHandler: new InhibitorHandler(this),
|
|
62
|
-
webhookHandler: new WebhookHandler(this),
|
|
63
|
-
extensionHandler: new ExtensionHandler(this),
|
|
64
|
-
};
|
|
65
|
-
this.util = new ClientUtil(this);
|
|
66
|
-
this.stats = {
|
|
67
|
-
guildCount: this.guilds.cache.size,
|
|
68
|
-
userCount: 0,
|
|
69
|
-
shardId: 0,
|
|
70
|
-
shardCount: 1,
|
|
71
|
-
};
|
|
72
|
-
this.cache = {
|
|
73
|
-
messages: new Collection(),
|
|
74
|
-
cooldowns: new Collection(),
|
|
75
|
-
};
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
connect(token) {
|
|
79
|
-
this.login(token);
|
|
80
|
-
new XernerxLog(this).ready();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ShardingManager, ShardingManagerOptions, ClientUser } from 'discord.js';
|
|
2
|
-
interface XernerxOptions {
|
|
3
|
-
log?: {
|
|
4
|
-
ready?: boolean;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
export default class XernerxShardClient extends ShardingManager {
|
|
8
|
-
readonly stats: {
|
|
9
|
-
guildCount: number;
|
|
10
|
-
userCount: number;
|
|
11
|
-
shardCount: number;
|
|
12
|
-
};
|
|
13
|
-
user: ClientUser | null;
|
|
14
|
-
constructor(file: string, discordOptions: ShardingManagerOptions, xernerxOptions?: XernerxOptions);
|
|
15
|
-
}
|
|
16
|
-
export {};
|