xernerx 4.17.7 → 5.0.2
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 +14 -67
- package/dist/main.cjs +63 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.cts +21 -0
- package/dist/main.d.ts +20 -46
- package/dist/main.js +23 -49
- package/dist/main.js.map +1 -0
- package/package.json +63 -47
- package/src/main.ts +26 -0
- package/dist/build/XernerxContextCommand.d.ts +0 -82
- package/dist/build/XernerxContextCommand.js +0 -125
- package/dist/build/XernerxEvent.d.ts +0 -21
- package/dist/build/XernerxEvent.js +0 -27
- package/dist/build/XernerxInhibitor.d.ts +0 -53
- package/dist/build/XernerxInhibitor.js +0 -27
- package/dist/build/XernerxMessageCommand.d.ts +0 -84
- package/dist/build/XernerxMessageCommand.js +0 -123
- package/dist/build/XernerxSlashCommand.d.ts +0 -104
- package/dist/build/XernerxSlashCommand.js +0 -182
- package/dist/client/XernerxClient.d.ts +0 -70
- package/dist/client/XernerxClient.js +0 -106
- package/dist/client/XernerxShardClient.d.ts +0 -21
- package/dist/client/XernerxShardClient.js +0 -67
- package/dist/functions/deploy.d.ts +0 -3
- package/dist/functions/deploy.js +0 -56
- package/dist/functions/load.d.ts +0 -4
- package/dist/functions/load.js +0 -34
- package/dist/functions/reload.d.ts +0 -3
- package/dist/functions/reload.js +0 -29
- package/dist/functions/setPresence.d.ts +0 -4
- package/dist/functions/setPresence.js +0 -22
- package/dist/functions/xernerxUser.d.ts +0 -4
- package/dist/functions/xernerxUser.js +0 -10
- package/dist/handlers/CommandHandler.d.ts +0 -16
- package/dist/handlers/CommandHandler.js +0 -326
- package/dist/handlers/EventHandler.d.ts +0 -9
- package/dist/handlers/EventHandler.js +0 -56
- package/dist/handlers/ExtensionHandler.d.ts +0 -9
- package/dist/handlers/ExtensionHandler.js +0 -29
- package/dist/handlers/Handler.d.ts +0 -31
- package/dist/handlers/Handler.js +0 -52
- package/dist/handlers/InhibitorHandler.d.ts +0 -9
- package/dist/handlers/InhibitorHandler.js +0 -33
- package/dist/handlers/IntegrationHandler.d.ts +0 -15
- package/dist/handlers/IntegrationHandler.js +0 -26
- package/dist/models/Arguments.d.ts +0 -12
- package/dist/models/Arguments.js +0 -139
- package/dist/models/Cooldowns.d.ts +0 -11
- package/dist/models/Cooldowns.js +0 -29
- package/dist/tools/XernerxError.d.ts +0 -7
- package/dist/tools/XernerxError.js +0 -11
- package/dist/tools/XernerxIntents.d.ts +0 -6
- package/dist/tools/XernerxIntents.js +0 -26
- package/dist/tools/XernerxLog.d.ts +0 -31
- package/dist/tools/XernerxLog.js +0 -148
- package/dist/tools/XernerxText.d.ts +0 -31
- package/dist/tools/XernerxText.js +0 -84
- package/dist/types/extenders.d.ts +0 -84
- package/dist/types/extenders.js +0 -2
- package/dist/types/interfaces.d.ts +0 -263
- package/dist/types/interfaces.js +0 -2
- package/dist/types/types.d.ts +0 -111
- package/dist/types/types.js +0 -2
- package/dist/utils/ClientUtil.d.ts +0 -22
- package/dist/utils/ClientUtil.js +0 -102
- package/dist/utils/InteractionUtil.d.ts +0 -25
- package/dist/utils/InteractionUtil.js +0 -154
- package/dist/utils/MessageUtil.d.ts +0 -26
- package/dist/utils/MessageUtil.js +0 -168
- package/dist/utils/Util.d.ts +0 -12
- package/dist/utils/Util.js +0 -11
- package/dist/validators/commandValidation.d.ts +0 -10
- package/dist/validators/commandValidation.js +0 -167
- package/dist/validators/inhibitorValidations.d.ts +0 -28
- package/dist/validators/inhibitorValidations.js +0 -44
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import XernerxLog from '../tools/XernerxLog.js';
|
|
5
|
-
export default class XernerxContextCommand {
|
|
6
|
-
constructor(id, options) {
|
|
7
|
-
this.id = id;
|
|
8
|
-
this.data = new ContextMenuCommandBuilder();
|
|
9
|
-
this.data.setName(options.name);
|
|
10
|
-
this.data.setNameLocalizations(options.nameLocalizations || null);
|
|
11
|
-
this.data.setType(options.type === 'user' ? 2 : 3);
|
|
12
|
-
this.data.setDMPermission(options.permissions?.dm || null);
|
|
13
|
-
options = z
|
|
14
|
-
.object({
|
|
15
|
-
name: z.string(),
|
|
16
|
-
type: z.enum(['user', 'message']),
|
|
17
|
-
description: z.string().or(z.null()).default(null),
|
|
18
|
-
usage: z.string().or(z.null()).default(null),
|
|
19
|
-
info: z.string().or(z.null()).default(null),
|
|
20
|
-
category: z.string().or(z.null()).default(null),
|
|
21
|
-
cooldown: z.number().or(z.null()).default(null),
|
|
22
|
-
global: z.boolean().default(true),
|
|
23
|
-
channel: z
|
|
24
|
-
.array(
|
|
25
|
-
z.enum([
|
|
26
|
-
'GuildText',
|
|
27
|
-
'DM',
|
|
28
|
-
'GuildVoice',
|
|
29
|
-
'GroupDM',
|
|
30
|
-
'GuildCategory',
|
|
31
|
-
'GuildAnnouncement',
|
|
32
|
-
'AnnouncementThread',
|
|
33
|
-
'PublicThread',
|
|
34
|
-
'PrivateThread',
|
|
35
|
-
'GuildStageVoice',
|
|
36
|
-
'GuildDirectory',
|
|
37
|
-
'GuildForum',
|
|
38
|
-
'GuildNews',
|
|
39
|
-
'GuildNewsThread',
|
|
40
|
-
'GuildPublicThread',
|
|
41
|
-
'GuildPrivateThread',
|
|
42
|
-
])
|
|
43
|
-
)
|
|
44
|
-
.or(
|
|
45
|
-
z.enum([
|
|
46
|
-
'GuildText',
|
|
47
|
-
'DM',
|
|
48
|
-
'GuildVoice',
|
|
49
|
-
'GroupDM',
|
|
50
|
-
'GuildCategory',
|
|
51
|
-
'GuildAnnouncement',
|
|
52
|
-
'AnnouncementThread',
|
|
53
|
-
'PublicThread',
|
|
54
|
-
'PrivateThread',
|
|
55
|
-
'GuildStageVoice',
|
|
56
|
-
'GuildDirectory',
|
|
57
|
-
'GuildForum',
|
|
58
|
-
'GuildNews',
|
|
59
|
-
'GuildNewsThread',
|
|
60
|
-
'GuildPublicThread',
|
|
61
|
-
'GuildPrivateThread',
|
|
62
|
-
])
|
|
63
|
-
)
|
|
64
|
-
.or(z.null())
|
|
65
|
-
.default(null),
|
|
66
|
-
ignore: z
|
|
67
|
-
.object({
|
|
68
|
-
owner: z.boolean().default(false),
|
|
69
|
-
users: z.array(z.string()).default([]),
|
|
70
|
-
channels: z.array(z.string()).default([]),
|
|
71
|
-
guilds: z.array(z.string()).default([]),
|
|
72
|
-
voice: z.boolean().default(false),
|
|
73
|
-
})
|
|
74
|
-
.default({}),
|
|
75
|
-
strict: z
|
|
76
|
-
.object({
|
|
77
|
-
owner: z.boolean().default(false),
|
|
78
|
-
users: z.array(z.string()).default([]),
|
|
79
|
-
channels: z.array(z.string()).default([]),
|
|
80
|
-
guilds: z.array(z.string()).default([]),
|
|
81
|
-
voice: z.boolean().default(false),
|
|
82
|
-
})
|
|
83
|
-
.default({}),
|
|
84
|
-
permissions: z
|
|
85
|
-
.object({
|
|
86
|
-
user: z.array(z.string()).or(z.null()).default(null),
|
|
87
|
-
client: z.array(z.string()).or(z.null()).default(null),
|
|
88
|
-
dm: z.boolean().default(true),
|
|
89
|
-
})
|
|
90
|
-
.default({}),
|
|
91
|
-
defer: z
|
|
92
|
-
.object({
|
|
93
|
-
reply: z.boolean().optional(),
|
|
94
|
-
ephemeral: z.boolean().optional(),
|
|
95
|
-
fetch: z.boolean().optional(),
|
|
96
|
-
})
|
|
97
|
-
.default({}),
|
|
98
|
-
})
|
|
99
|
-
.parse(options);
|
|
100
|
-
this.name = options.name;
|
|
101
|
-
this.type = options.type;
|
|
102
|
-
this.description = options.description;
|
|
103
|
-
this.usage = options.usage;
|
|
104
|
-
this.info = options.info;
|
|
105
|
-
this.category = options.category;
|
|
106
|
-
this.cooldown = options.cooldown;
|
|
107
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
108
|
-
this.global = options.global;
|
|
109
|
-
this.ignore = options.ignore;
|
|
110
|
-
this.strict = options.strict;
|
|
111
|
-
this.permissions = options.permissions;
|
|
112
|
-
this.defer = options.defer;
|
|
113
|
-
this.client = this.client;
|
|
114
|
-
this.util = this.util;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @description the execution of the command
|
|
118
|
-
* @param interaction - Interaction event emitted on command
|
|
119
|
-
* @param args - The arguments parsed with the command, if any
|
|
120
|
-
*/
|
|
121
|
-
async exec(interaction, args) {
|
|
122
|
-
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
123
|
-
return await this.client.emit('commandError', interaction, `${this.id} doesn't have an execution rule.`, this, this.filetype);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { XernerxEventOptions } from '../types/interfaces.js';
|
|
3
|
-
import { XernerxClientEvents, XernerxClientType } from '../types/extenders.js';
|
|
4
|
-
import { Awaitable, RestEvents } from 'discord.js';
|
|
5
|
-
/**
|
|
6
|
-
* @description - The event builder for events.
|
|
7
|
-
* @param {String} id - The unique ID of the event.
|
|
8
|
-
* @param {EventOptions} options - The event options.
|
|
9
|
-
*/
|
|
10
|
-
export default class XernerxEvent<Event extends keyof XernerxClientEvents> {
|
|
11
|
-
readonly id: string;
|
|
12
|
-
readonly name: Event | keyof RestEvents | string;
|
|
13
|
-
readonly emitter?: 'client' | 'process' | 'rest' | string;
|
|
14
|
-
readonly type?: 'discord' | 'node' | string;
|
|
15
|
-
readonly once?: boolean;
|
|
16
|
-
readonly filetype: 'Event';
|
|
17
|
-
readonly filepath: string;
|
|
18
|
-
readonly client: XernerxClientType;
|
|
19
|
-
constructor(id: string, options: XernerxEventOptions);
|
|
20
|
-
run<T = void>(...args: XernerxClientEvents[Event]): Promise<Awaitable<void | any | T>>;
|
|
21
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import XernerxLog from '../tools/XernerxLog.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 XernerxEvent {
|
|
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 = this.client;
|
|
23
|
-
}
|
|
24
|
-
async run(...args) {
|
|
25
|
-
return new XernerxLog(this.client).error(`${this.id} doesn't have a run rule.`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { XernerxInhibitorOptions, MessageCommandArguments, SlashCommandArguments, ContextCommandArguments } from '../types/interfaces.js';
|
|
3
|
-
import { InhibitorType, XernerxInteraction } from '../types/types.js';
|
|
4
|
-
import { XernerxClientType, XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
5
|
-
import XernerxContextCommand from '../build/XernerxContextCommand.js';
|
|
6
|
-
import XernerxSlashCommand from '../build/XernerxSlashCommand.js';
|
|
7
|
-
import XernerxMessageCommand from '../build/XernerxMessageCommand.js';
|
|
8
|
-
/**
|
|
9
|
-
* @description - The inhibitor builder for inhibitors.
|
|
10
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
11
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
12
|
-
*/
|
|
13
|
-
export default class XernerxInhibitor {
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly name: string;
|
|
16
|
-
readonly type: InhibitorType;
|
|
17
|
-
readonly filetype: 'Inhibitor';
|
|
18
|
-
readonly filepath: string;
|
|
19
|
-
readonly client: XernerxClientType;
|
|
20
|
-
constructor(id: string, options: XernerxInhibitorOptions);
|
|
21
|
-
pre(interaction: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>, args: any): void;
|
|
22
|
-
/**
|
|
23
|
-
* @description The check rule
|
|
24
|
-
* @param interaction - The interaction with the inhibitor, can be message and interaction
|
|
25
|
-
* @param args - The arguments parsed with this command
|
|
26
|
-
*/
|
|
27
|
-
check<T extends XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>>(
|
|
28
|
-
interaction: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
29
|
-
args:
|
|
30
|
-
| (T extends XernerxMessage
|
|
31
|
-
? MessageCommandArguments
|
|
32
|
-
: T extends XernerxSlashInteraction
|
|
33
|
-
? SlashCommandArguments
|
|
34
|
-
: T extends XernerxUserContextInteraction
|
|
35
|
-
? ContextCommandArguments<'user' | 'message'>
|
|
36
|
-
: never)
|
|
37
|
-
| null,
|
|
38
|
-
command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand
|
|
39
|
-
): Promise<any>;
|
|
40
|
-
post<T extends XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>>(
|
|
41
|
-
interaction: XernerxMessage | XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
42
|
-
args:
|
|
43
|
-
| (T extends XernerxMessage
|
|
44
|
-
? MessageCommandArguments
|
|
45
|
-
: T extends XernerxSlashInteraction
|
|
46
|
-
? SlashCommandArguments
|
|
47
|
-
: T extends XernerxUserContextInteraction
|
|
48
|
-
? ContextCommandArguments<'user' | 'message'>
|
|
49
|
-
: never)
|
|
50
|
-
| null,
|
|
51
|
-
command: XernerxSlashCommand | XernerxMessageCommand | XernerxContextCommand
|
|
52
|
-
): Promise<any>;
|
|
53
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
/**
|
|
4
|
-
* @description - The inhibitor builder for inhibitors.
|
|
5
|
-
* @param {String} id - The unique ID of the inhibitor.
|
|
6
|
-
* @param {InhibitorOptions} options - The inhibitor options.
|
|
7
|
-
*/
|
|
8
|
-
export default class XernerxInhibitor {
|
|
9
|
-
constructor(id, options) {
|
|
10
|
-
this.id = id;
|
|
11
|
-
z.object({
|
|
12
|
-
name: z.string(),
|
|
13
|
-
type: z.string(),
|
|
14
|
-
}).parse(options);
|
|
15
|
-
this.name = options.name;
|
|
16
|
-
this.type = options.type;
|
|
17
|
-
this.client = this.client;
|
|
18
|
-
}
|
|
19
|
-
pre(interaction, args) {}
|
|
20
|
-
/**
|
|
21
|
-
* @description The check rule
|
|
22
|
-
* @param interaction - The interaction with the inhibitor, can be message and interaction
|
|
23
|
-
* @param args - The arguments parsed with this command
|
|
24
|
-
*/
|
|
25
|
-
async check(interaction, args, command) {}
|
|
26
|
-
async post(interaction, args, command) {}
|
|
27
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { XernerxClientType, XernerxMessage } from '../types/extenders.js';
|
|
3
|
-
import { MessageCommandArguments, MessageCommandOptions } from '../types/interfaces.js';
|
|
4
|
-
import MessageUtil from '../utils/MessageUtil.js';
|
|
5
|
-
export default class XernerxMessageCommand {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
readonly aliases: string[] | undefined;
|
|
9
|
-
readonly regex: RegExp | undefined;
|
|
10
|
-
readonly prefix: string | string[] | undefined;
|
|
11
|
-
readonly description: string | null | undefined;
|
|
12
|
-
readonly usage: string | null | undefined;
|
|
13
|
-
readonly info: string | null | undefined;
|
|
14
|
-
readonly separator: string | undefined;
|
|
15
|
-
readonly args: import('../types/interfaces.js').MessageCommandArgumentOptions[] | undefined;
|
|
16
|
-
readonly flags: import('../types/interfaces.js').MessageCommandFlagOptions[] | undefined;
|
|
17
|
-
readonly category: string | null | undefined;
|
|
18
|
-
readonly cooldown: number | null | undefined;
|
|
19
|
-
readonly channel:
|
|
20
|
-
| (
|
|
21
|
-
| 'GuildText'
|
|
22
|
-
| 'DM'
|
|
23
|
-
| 'GuildVoice'
|
|
24
|
-
| 'GroupDM'
|
|
25
|
-
| 'GuildCategory'
|
|
26
|
-
| 'GuildAnnouncement'
|
|
27
|
-
| 'AnnouncementThread'
|
|
28
|
-
| 'PublicThread'
|
|
29
|
-
| 'PrivateThread'
|
|
30
|
-
| 'GuildStageVoice'
|
|
31
|
-
| 'GuildDirectory'
|
|
32
|
-
| 'GuildForum'
|
|
33
|
-
| 'GuildMedia'
|
|
34
|
-
| 'GuildNews'
|
|
35
|
-
| 'GuildNewsThread'
|
|
36
|
-
| 'GuildPublicThread'
|
|
37
|
-
| 'GuildPrivateThread'
|
|
38
|
-
)[]
|
|
39
|
-
| null;
|
|
40
|
-
readonly global: boolean | undefined;
|
|
41
|
-
readonly ignore:
|
|
42
|
-
| {
|
|
43
|
-
owner?: boolean;
|
|
44
|
-
users?: Array<string>;
|
|
45
|
-
channels?: Array<string>;
|
|
46
|
-
guilds?: Array<string>;
|
|
47
|
-
voice?: boolean;
|
|
48
|
-
}
|
|
49
|
-
| undefined;
|
|
50
|
-
readonly strict:
|
|
51
|
-
| {
|
|
52
|
-
owner?: boolean;
|
|
53
|
-
users?: Array<string>;
|
|
54
|
-
channels?: Array<string>;
|
|
55
|
-
guilds?: Array<string>;
|
|
56
|
-
voice?: boolean;
|
|
57
|
-
}
|
|
58
|
-
| undefined;
|
|
59
|
-
readonly permissions:
|
|
60
|
-
| {
|
|
61
|
-
user?: Array<import('../main.js').PermissionNames> | Array<string> | null;
|
|
62
|
-
client?: Array<import('../main.js').PermissionNames> | Array<string> | null;
|
|
63
|
-
dm?: boolean;
|
|
64
|
-
}
|
|
65
|
-
| undefined;
|
|
66
|
-
readonly filetype: 'MessageCommand';
|
|
67
|
-
readonly filepath: string;
|
|
68
|
-
readonly client: XernerxClientType;
|
|
69
|
-
snowflake: string | null;
|
|
70
|
-
util: MessageUtil;
|
|
71
|
-
constructor(id: string, options: MessageCommandOptions);
|
|
72
|
-
/**
|
|
73
|
-
* @description Checks for conditions before running the command
|
|
74
|
-
* @param message - The message event emitted on this command
|
|
75
|
-
* @param options - The args and flags parsed on this command
|
|
76
|
-
*/
|
|
77
|
-
conditions<T = void>(message: XernerxMessage, { args, flags }: MessageCommandArguments): Promise<void | any | T>;
|
|
78
|
-
/**
|
|
79
|
-
* @description Runs the execution rule
|
|
80
|
-
* @param message - The message event emitted on this command
|
|
81
|
-
* @param options - The args and flags parsed on this command
|
|
82
|
-
*/
|
|
83
|
-
exec<T = void>(message: XernerxMessage, { args, flags }: MessageCommandArguments): Promise<void | any | T>;
|
|
84
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import XernerxLog from '../tools/XernerxLog.js';
|
|
4
|
-
export default class XernerxMessageCommand {
|
|
5
|
-
constructor(id, options) {
|
|
6
|
-
this.id = id;
|
|
7
|
-
this.regex = options.regex;
|
|
8
|
-
this.args = options.args;
|
|
9
|
-
this.flags = options.flags;
|
|
10
|
-
options = z
|
|
11
|
-
.object({
|
|
12
|
-
name: z.string(),
|
|
13
|
-
aliases: z.array(z.string()).default([]),
|
|
14
|
-
description: z.string().or(z.null()).default(null),
|
|
15
|
-
usage: z.string().or(z.null()).default(null),
|
|
16
|
-
info: z.string().or(z.null()).default(null),
|
|
17
|
-
category: z.string().or(z.null()).default(null),
|
|
18
|
-
cooldown: z.number().or(z.null()).default(null),
|
|
19
|
-
global: z.boolean().default(true),
|
|
20
|
-
channel: z
|
|
21
|
-
.array(
|
|
22
|
-
z.enum([
|
|
23
|
-
'GuildText',
|
|
24
|
-
'DM',
|
|
25
|
-
'GuildVoice',
|
|
26
|
-
'GroupDM',
|
|
27
|
-
'GuildCategory',
|
|
28
|
-
'GuildAnnouncement',
|
|
29
|
-
'AnnouncementThread',
|
|
30
|
-
'PublicThread',
|
|
31
|
-
'PrivateThread',
|
|
32
|
-
'GuildStageVoice',
|
|
33
|
-
'GuildDirectory',
|
|
34
|
-
'GuildForum',
|
|
35
|
-
'GuildNews',
|
|
36
|
-
'GuildNewsThread',
|
|
37
|
-
'GuildPublicThread',
|
|
38
|
-
'GuildPrivateThread',
|
|
39
|
-
])
|
|
40
|
-
)
|
|
41
|
-
.or(
|
|
42
|
-
z.enum([
|
|
43
|
-
'GuildText',
|
|
44
|
-
'DM',
|
|
45
|
-
'GuildVoice',
|
|
46
|
-
'GroupDM',
|
|
47
|
-
'GuildCategory',
|
|
48
|
-
'GuildAnnouncement',
|
|
49
|
-
'AnnouncementThread',
|
|
50
|
-
'PublicThread',
|
|
51
|
-
'PrivateThread',
|
|
52
|
-
'GuildStageVoice',
|
|
53
|
-
'GuildDirectory',
|
|
54
|
-
'GuildForum',
|
|
55
|
-
'GuildNews',
|
|
56
|
-
'GuildNewsThread',
|
|
57
|
-
'GuildPublicThread',
|
|
58
|
-
'GuildPrivateThread',
|
|
59
|
-
])
|
|
60
|
-
)
|
|
61
|
-
.or(z.null())
|
|
62
|
-
.default(null),
|
|
63
|
-
prefix: z.array(z.string()).or(z.string()).default([]),
|
|
64
|
-
ignore: z
|
|
65
|
-
.object({
|
|
66
|
-
owner: z.boolean().default(false),
|
|
67
|
-
users: z.array(z.string()).default([]),
|
|
68
|
-
channels: z.array(z.string()).default([]),
|
|
69
|
-
guilds: z.array(z.string()).default([]),
|
|
70
|
-
voice: z.boolean().default(false),
|
|
71
|
-
})
|
|
72
|
-
.default({}),
|
|
73
|
-
strict: z
|
|
74
|
-
.object({
|
|
75
|
-
owner: z.boolean().default(false),
|
|
76
|
-
users: z.array(z.string()).default([]),
|
|
77
|
-
channels: z.array(z.string()).default([]),
|
|
78
|
-
guilds: z.array(z.string()).default([]),
|
|
79
|
-
voice: z.boolean().default(false),
|
|
80
|
-
})
|
|
81
|
-
.default({}),
|
|
82
|
-
permissions: z
|
|
83
|
-
.object({
|
|
84
|
-
user: z.array(z.string()).or(z.null()).default(null),
|
|
85
|
-
client: z.array(z.string()).or(z.null()).default(null),
|
|
86
|
-
dm: z.boolean().default(true),
|
|
87
|
-
})
|
|
88
|
-
.default({}),
|
|
89
|
-
})
|
|
90
|
-
.parse(options);
|
|
91
|
-
this.name = options.name;
|
|
92
|
-
this.aliases = options.aliases;
|
|
93
|
-
this.prefix = options.prefix;
|
|
94
|
-
this.description = options.description;
|
|
95
|
-
this.usage = options.usage;
|
|
96
|
-
this.info = options.info;
|
|
97
|
-
this.category = options.category;
|
|
98
|
-
this.cooldown = options.cooldown;
|
|
99
|
-
this.channel = options.channel ? (Array.isArray(options.channel) ? options.channel : [options.channel]) : null;
|
|
100
|
-
this.global = options.global;
|
|
101
|
-
this.ignore = options.ignore;
|
|
102
|
-
this.strict = options.strict;
|
|
103
|
-
this.separator = options.separator;
|
|
104
|
-
this.permissions = options.permissions;
|
|
105
|
-
this.client = this.client;
|
|
106
|
-
this.util = this.util;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @description Checks for conditions before running the command
|
|
110
|
-
* @param message - The message event emitted on this command
|
|
111
|
-
* @param options - The args and flags parsed on this command
|
|
112
|
-
*/
|
|
113
|
-
async conditions(message, { args, flags }) {}
|
|
114
|
-
/**
|
|
115
|
-
* @description Runs the execution rule
|
|
116
|
-
* @param message - The message event emitted on this command
|
|
117
|
-
* @param options - The args and flags parsed on this command
|
|
118
|
-
*/
|
|
119
|
-
async exec(message, { args, flags }) {
|
|
120
|
-
new XernerxLog(this.client).error(`${this.id} doesn't have an execution rule.`);
|
|
121
|
-
return await this.client.emit('commandError', message, `${this.id} doesn't have an execution rule.`, this);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
import Discord, { AutocompleteFocusedOption, AutocompleteInteraction } from 'discord.js';
|
|
3
|
-
import { XernerxClientType, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
|
-
import { SlashCommandArguments, SlashCommandOptions } from '../types/interfaces.js';
|
|
5
|
-
import { XernerxInteraction } from '../types/types.js';
|
|
6
|
-
import InteractionUtil from '../utils/InteractionUtil.js';
|
|
7
|
-
export default class XernerxSlashCommand {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly data: Discord.SlashCommandBuilder;
|
|
10
|
-
readonly name: string;
|
|
11
|
-
readonly description: string;
|
|
12
|
-
readonly usage: string | null | undefined;
|
|
13
|
-
readonly info: string | null | undefined;
|
|
14
|
-
readonly category: string | null | undefined;
|
|
15
|
-
readonly cooldown: number | null | undefined;
|
|
16
|
-
readonly channel:
|
|
17
|
-
| (
|
|
18
|
-
| 'GuildText'
|
|
19
|
-
| 'DM'
|
|
20
|
-
| 'GuildVoice'
|
|
21
|
-
| 'GroupDM'
|
|
22
|
-
| 'GuildCategory'
|
|
23
|
-
| 'GuildAnnouncement'
|
|
24
|
-
| 'AnnouncementThread'
|
|
25
|
-
| 'PublicThread'
|
|
26
|
-
| 'PrivateThread'
|
|
27
|
-
| 'GuildStageVoice'
|
|
28
|
-
| 'GuildDirectory'
|
|
29
|
-
| 'GuildForum'
|
|
30
|
-
| 'GuildMedia'
|
|
31
|
-
| 'GuildNews'
|
|
32
|
-
| 'GuildNewsThread'
|
|
33
|
-
| 'GuildPublicThread'
|
|
34
|
-
| 'GuildPrivateThread'
|
|
35
|
-
)[]
|
|
36
|
-
| null;
|
|
37
|
-
readonly global: boolean | undefined;
|
|
38
|
-
readonly ignore:
|
|
39
|
-
| {
|
|
40
|
-
owner?: boolean;
|
|
41
|
-
users?: Array<string>;
|
|
42
|
-
channels?: Array<string>;
|
|
43
|
-
guilds?: Array<string>;
|
|
44
|
-
voice?: boolean;
|
|
45
|
-
}
|
|
46
|
-
| undefined;
|
|
47
|
-
readonly strict:
|
|
48
|
-
| {
|
|
49
|
-
owner?: boolean;
|
|
50
|
-
users?: Array<string>;
|
|
51
|
-
channels?: Array<string>;
|
|
52
|
-
guilds?: Array<string>;
|
|
53
|
-
voice?: boolean;
|
|
54
|
-
}
|
|
55
|
-
| undefined;
|
|
56
|
-
readonly permissions:
|
|
57
|
-
| {
|
|
58
|
-
user?: Array<import('../types/types.js').PermissionNames> | Array<string> | null;
|
|
59
|
-
client?: Array<import('../types/types.js').PermissionNames> | Array<string> | null;
|
|
60
|
-
dm?: boolean;
|
|
61
|
-
}
|
|
62
|
-
| undefined;
|
|
63
|
-
readonly defer:
|
|
64
|
-
| {
|
|
65
|
-
reply?: boolean;
|
|
66
|
-
ephemeral?: boolean;
|
|
67
|
-
fetchReply?: boolean;
|
|
68
|
-
}
|
|
69
|
-
| undefined;
|
|
70
|
-
readonly filetype: 'SlashCommand';
|
|
71
|
-
readonly filepath: string;
|
|
72
|
-
readonly client: XernerxClientType;
|
|
73
|
-
snowflake: string | null;
|
|
74
|
-
util: InteractionUtil;
|
|
75
|
-
constructor(id: string, options: SlashCommandOptions);
|
|
76
|
-
/**
|
|
77
|
-
* @description autocomplete let's you add choices to string option arguments
|
|
78
|
-
* @param interaction - The interaction event emitted on this command
|
|
79
|
-
* @param focused - The command option that is in focus
|
|
80
|
-
* @param options - The full list of options on the command
|
|
81
|
-
*/
|
|
82
|
-
autocomplete<T = void>(interaction: AutocompleteInteraction, focused: AutocompleteFocusedOption, options: any[]): Promise<void | any | T>;
|
|
83
|
-
/**
|
|
84
|
-
* @description Checks for conditions before running the command
|
|
85
|
-
* @param interaction - The interaction event emitted on this command
|
|
86
|
-
* @param options - The args, group and subcommand parsed on this command
|
|
87
|
-
*/
|
|
88
|
-
conditions<T = void>(
|
|
89
|
-
interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
90
|
-
{ args, subcommand, group }: SlashCommandArguments
|
|
91
|
-
): Promise<void | any | T>;
|
|
92
|
-
/**
|
|
93
|
-
* @description Runs the execution rule
|
|
94
|
-
* @param interaction - The interaction event emitted on this command
|
|
95
|
-
* @param options - The args, group and subcommand parsed on this command
|
|
96
|
-
*/
|
|
97
|
-
exec<T = void>(
|
|
98
|
-
interaction: XernerxInteraction<XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction>,
|
|
99
|
-
{ args, subcommand, group }: SlashCommandArguments
|
|
100
|
-
): Promise<void | any | T>;
|
|
101
|
-
private addArguments;
|
|
102
|
-
private addSubcommands;
|
|
103
|
-
private addSubcommandGroups;
|
|
104
|
-
}
|