xernerx 4.4.4 → 4.4.5
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 +4 -3
- package/dist/build/ContextCommandBuilder.js +1 -1
- package/dist/build/EventBuilder.d.ts +3 -1
- package/dist/build/EventBuilder.js +1 -1
- package/dist/build/InhibitorBuilder.d.ts +5 -3
- package/dist/build/InhibitorBuilder.js +1 -1
- package/dist/build/MessageCommandBuilder.d.ts +5 -3
- package/dist/build/MessageCommandBuilder.js +2 -2
- package/dist/build/SlashCommandBuilder.d.ts +7 -4
- package/dist/build/SlashCommandBuilder.js +2 -2
- package/dist/models/Arguments.d.ts +1 -8
- package/dist/models/Arguments.js +15 -9
- package/package.json +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { ContextMenuCommandBuilder } from 'discord.js';
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
|
-
import { XernerxMessageContextInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
4
3
|
import { ContextCommandOptions } from '../types/interfaces.js';
|
|
5
4
|
export default class ContextCommandBuilder {
|
|
6
5
|
readonly id: string;
|
|
7
6
|
readonly data: ContextMenuCommandBuilder;
|
|
8
7
|
readonly name: string;
|
|
9
|
-
readonly type: '
|
|
8
|
+
readonly type: 'user' | 'message';
|
|
10
9
|
readonly description: string | null | undefined;
|
|
11
10
|
readonly usage: string | null | undefined;
|
|
12
11
|
readonly info: string | null | undefined;
|
|
@@ -42,7 +41,9 @@ export default class ContextCommandBuilder {
|
|
|
42
41
|
fetchReply?: boolean | undefined;
|
|
43
42
|
}
|
|
44
43
|
| undefined;
|
|
44
|
+
readonly fileType: 'ContextCommand';
|
|
45
|
+
readonly filePath: string;
|
|
45
46
|
readonly client: typeof XernerxClient;
|
|
46
47
|
constructor(id: string, options: ContextCommandOptions);
|
|
47
|
-
exec(
|
|
48
|
+
exec(): Promise<void>;
|
|
48
49
|
}
|
|
@@ -12,11 +12,13 @@ export default class EventBuilder {
|
|
|
12
12
|
readonly emitter?: 'client' | 'process' | string;
|
|
13
13
|
readonly type?: 'discord' | string;
|
|
14
14
|
readonly once?: boolean;
|
|
15
|
+
readonly fileType: 'Event';
|
|
16
|
+
readonly filePath: string;
|
|
15
17
|
readonly client: typeof XernerxClient;
|
|
16
18
|
constructor(id: string, options: EventBuilderOptions);
|
|
17
19
|
/**
|
|
18
20
|
* @description run your custom event here.
|
|
19
21
|
* TODO - update description
|
|
20
22
|
*/
|
|
21
|
-
run
|
|
23
|
+
run(): Promise<void>;
|
|
22
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { InhibitorBuilderOptions } from '../types/interfaces.js';
|
|
3
|
-
import { InhibitorType
|
|
4
|
-
import { XernerxMessage } from '../types/extenders.js';
|
|
3
|
+
import { InhibitorType } from '../types/types.js';
|
|
4
|
+
import { XernerxMessage, XernerxMessageContextInteraction, XernerxSlashInteraction, XernerxUserContextInteraction } from '../types/extenders.js';
|
|
5
5
|
/**
|
|
6
6
|
* @description - The inhibitor builder for inhibitors.
|
|
7
7
|
* @param {String} id - The unique ID of the inhibitor.
|
|
@@ -11,7 +11,9 @@ export default class InhibitorBuilder {
|
|
|
11
11
|
readonly id: string;
|
|
12
12
|
readonly name: string;
|
|
13
13
|
readonly type: InhibitorType;
|
|
14
|
+
readonly fileType: 'Inhibitor';
|
|
15
|
+
readonly filePath: string;
|
|
14
16
|
readonly client: typeof XernerxClient;
|
|
15
17
|
constructor(id: string, options: InhibitorBuilderOptions);
|
|
16
|
-
check
|
|
18
|
+
check(interaction: XernerxMessage | XernerxSlashInteraction | XernerxUserContextInteraction | XernerxMessageContextInteraction, args: any): Promise<void>;
|
|
17
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import XernerxClient from '../client/XernerxClient.js';
|
|
2
2
|
import { XernerxMessage } from '../types/extenders.js';
|
|
3
|
-
import {
|
|
3
|
+
import { MessageCommandOptions } from '../types/interfaces.js';
|
|
4
4
|
export default class MessageCommandBuilder {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly name: string;
|
|
@@ -38,8 +38,10 @@ export default class MessageCommandBuilder {
|
|
|
38
38
|
dm?: boolean | undefined;
|
|
39
39
|
}
|
|
40
40
|
| undefined;
|
|
41
|
+
readonly fileType: 'MessageCommand';
|
|
42
|
+
readonly filePath: string;
|
|
41
43
|
readonly client: typeof XernerxClient;
|
|
42
44
|
constructor(id: string, options: MessageCommandOptions);
|
|
43
|
-
conditions(message: XernerxMessage, args:
|
|
44
|
-
exec(message: XernerxMessage, args:
|
|
45
|
+
conditions(message: XernerxMessage, { args, flags }: any): Promise<void>;
|
|
46
|
+
exec(message: XernerxMessage, { args, flags }: any): Promise<void>;
|
|
45
47
|
}
|
|
@@ -55,6 +55,6 @@ export default class MessageCommandBuilder {
|
|
|
55
55
|
this.permissions = options.permissions;
|
|
56
56
|
this.client = XernerxClient;
|
|
57
57
|
}
|
|
58
|
-
async conditions(message, args) {}
|
|
59
|
-
async exec(message, args) {}
|
|
58
|
+
async conditions(message, { args, flags }) {}
|
|
59
|
+
async exec(message, { args, flags }) {}
|
|
60
60
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Discord from 'discord.js';
|
|
2
2
|
import XernerxClient from '../client/XernerxClient.js';
|
|
3
3
|
import { XernerxSlashInteraction } from '../types/extenders.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SlashCommandOptions } from '../types/interfaces.js';
|
|
5
|
+
import { XernerxInteraction } from '../types/types.js';
|
|
5
6
|
export default class SlashCommandBuilder {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly data: Discord.SlashCommandBuilder;
|
|
@@ -41,11 +42,13 @@ export default class SlashCommandBuilder {
|
|
|
41
42
|
fetchReply?: boolean | undefined;
|
|
42
43
|
}
|
|
43
44
|
| undefined;
|
|
45
|
+
readonly fileType: 'SlashCommand';
|
|
46
|
+
readonly filePath: string;
|
|
44
47
|
readonly client: typeof XernerxClient;
|
|
45
48
|
constructor(id: string, options: SlashCommandOptions);
|
|
46
|
-
autocomplete<T>(interaction:
|
|
47
|
-
conditions(interaction: XernerxSlashInteraction, args:
|
|
48
|
-
exec(interaction: XernerxSlashInteraction, args:
|
|
49
|
+
autocomplete<T>(interaction: XernerxInteraction, focused: T, options: T[]): Promise<void>;
|
|
50
|
+
conditions(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
|
|
51
|
+
exec(interaction: XernerxSlashInteraction, { args, subcommand, group }: any): Promise<void>;
|
|
49
52
|
private addArguments;
|
|
50
53
|
private addSubcommands;
|
|
51
54
|
private addSubcommandGroups;
|
|
@@ -73,8 +73,8 @@ export default class SlashCommandBuilder {
|
|
|
73
73
|
this.client = XernerxClient;
|
|
74
74
|
}
|
|
75
75
|
async autocomplete(interaction, focused, options) {}
|
|
76
|
-
async conditions(interaction, args) {}
|
|
77
|
-
async exec(interaction, args) {}
|
|
76
|
+
async conditions(interaction, { args, subcommand, group }) {}
|
|
77
|
+
async exec(interaction, { args, subcommand, group }) {}
|
|
78
78
|
addArguments(command, args) {
|
|
79
79
|
for (const argument of args) {
|
|
80
80
|
let slashCommandArgumentType = `${argument.type.charAt(0).toUpperCase()}${argument.type.slice(1).toLowerCase()}`;
|
|
@@ -5,11 +5,4 @@ import { XernerxMessage } from '../types/extenders.js';
|
|
|
5
5
|
import { MessageCommandArguments } from '../types/interfaces.js';
|
|
6
6
|
import { XernerxInteraction } from '../types/types.js';
|
|
7
7
|
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<MessageCommandArguments>;
|
|
8
|
-
export declare function interactionArguments(
|
|
9
|
-
interaction: XernerxInteraction | any,
|
|
10
|
-
command: ContextCommandBuilder | SlashCommandBuilder
|
|
11
|
-
): Promise<{
|
|
12
|
-
args: any;
|
|
13
|
-
group: any;
|
|
14
|
-
subcommand: any;
|
|
15
|
-
}>;
|
|
8
|
+
export declare function interactionArguments(interaction: XernerxInteraction | any, command: ContextCommandBuilder | SlashCommandBuilder): Promise<any>;
|
package/dist/models/Arguments.js
CHANGED
|
@@ -115,15 +115,21 @@ export async function messageArguments(message, command) {
|
|
|
115
115
|
return { args, flags };
|
|
116
116
|
}
|
|
117
117
|
export async function interactionArguments(interaction, command) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
if (command.fileType === 'SlashCommand') {
|
|
119
|
+
const options = {};
|
|
120
|
+
let args = interaction?.options?._hoistedOptions,
|
|
121
|
+
group = interaction?.options?._group,
|
|
122
|
+
subcommand = interaction?.options?._subcommand;
|
|
123
|
+
if (interaction.options._hoistedOptions) {
|
|
124
|
+
for (const option of interaction.options._hoistedOptions) {
|
|
125
|
+
options[option.name] = option.member || option.channel || option.user || option.role || option.value;
|
|
126
|
+
}
|
|
127
|
+
args = options;
|
|
125
128
|
}
|
|
126
|
-
args
|
|
129
|
+
return { args, group, subcommand };
|
|
130
|
+
}
|
|
131
|
+
if (command.fileType === 'ContextCommand') {
|
|
132
|
+
if (command.type === 'user') return await interaction.client.users.fetch(interaction.targetId);
|
|
133
|
+
if (command.type === 'message') return await interaction.channel.messages.fetch(interaction.targetId);
|
|
127
134
|
}
|
|
128
|
-
return { args, group, subcommand };
|
|
129
135
|
}
|