xernerx 3.4.3 → 3.5.1
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 +10 -10
- package/dist/build/ContextCommandBuilder.d.ts +60 -42
- package/dist/build/ContextCommandBuilder.js +93 -86
- package/dist/build/EventBuilder.d.ts +21 -17
- package/dist/build/EventBuilder.js +34 -35
- package/dist/build/InhibitorBuilder.d.ts +19 -20
- package/dist/build/InhibitorBuilder.js +27 -27
- package/dist/build/MessageCommandBuilder.d.ts +53 -42
- package/dist/build/MessageCommandBuilder.js +90 -78
- package/dist/build/SlashCommandBuilder.d.ts +58 -40
- package/dist/build/SlashCommandBuilder.js +125 -118
- package/dist/client/XernerxClient.d.ts +28 -28
- package/dist/client/XernerxClient.js +101 -83
- package/dist/handlers/CommandHandler.d.ts +27 -27
- package/dist/handlers/CommandHandler.js +42 -42
- package/dist/handlers/EventHandler.d.ts +13 -13
- package/dist/handlers/EventHandler.js +16 -16
- package/dist/handlers/Handler.d.ts +57 -57
- package/dist/handlers/Handler.js +250 -250
- package/dist/handlers/InhibitorHandler.d.ts +18 -18
- package/dist/handlers/InhibitorHandler.js +21 -21
- package/dist/main.cjs +2023 -0
- package/dist/main.d.ts +30 -30
- package/dist/main.js +42 -42
- package/dist/models/CommandArguments.d.ts +17 -17
- package/dist/models/CommandArguments.js +121 -123
- package/dist/models/Events.d.ts +24 -24
- package/dist/models/Events.js +294 -304
- package/dist/models/Extensions.d.ts +7 -7
- package/dist/models/Extensions.js +23 -23
- package/dist/tools/XernerxError.d.ts +5 -5
- package/dist/tools/XernerxError.js +8 -8
- package/dist/tools/package.d.ts +49 -38
- package/dist/tools/package.js +48 -41
- package/dist/types/enums.d.ts +35 -35
- package/dist/types/enums.js +35 -35
- package/dist/types/interfaces.d.ts +25 -25
- package/dist/types/interfaces.js +1 -1
- package/dist/types/options.d.ts +241 -206
- package/dist/types/options.js +1 -1
- package/dist/types/types.d.ts +34 -32
- package/dist/types/types.js +1 -1
- package/dist/utils/ClientUtil.d.ts +25 -25
- package/dist/utils/ClientUtil.js +222 -218
- package/dist/utils/CommandUtil.d.ts +56 -56
- package/dist/utils/CommandUtil.js +248 -260
- package/dist/validators/CommandValidations.d.ts +7 -7
- package/dist/validators/CommandValidations.js +183 -185
- package/dist/validators/InhibitorValidations.d.ts +11 -11
- package/dist/validators/InhibitorValidations.js +42 -42
- package/dist/validators/Shapes.js +1 -0
- package/package.json +54 -39
- package/dist/build/XContextCommandBuilder.d.ts +0 -40
- package/dist/build/XContextCommandBuilder.js +0 -84
- package/dist/build/XEventBuilder.d.ts +0 -17
- package/dist/build/XEventBuilder.js +0 -35
- package/dist/build/XInhibitorBuilder.d.ts +0 -20
- package/dist/build/XInhibitorBuilder.js +0 -28
- package/dist/build/XMessageCommandBuilder.d.ts +0 -42
- package/dist/build/XMessageCommandBuilder.js +0 -80
- package/dist/build/XSlashCommandBuilder.d.ts +0 -36
- package/dist/build/XSlashCommandBuilder.js +0 -114
- package/dist/models/CommandValidations.d.ts +0 -4
- package/dist/models/CommandValidations.js +0 -183
- package/dist/models/InhibitorValidations.d.ts +0 -12
- package/dist/models/InhibitorValidations.js +0 -42
package/dist/main.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export * from 'discord.js';
|
|
2
|
-
export * from 'dumfunctions';
|
|
3
|
-
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
4
|
-
import XernerxClient from './client/XernerxClient.js';
|
|
5
|
-
import EventBuilder from './build/EventBuilder.js';
|
|
6
|
-
import InhibitorBuilder from './build/InhibitorBuilder.js';
|
|
7
|
-
import MessageCommandBuilder from './build/MessageCommandBuilder.js';
|
|
8
|
-
import ContextCommandBuilder from './build/ContextCommandBuilder.js';
|
|
9
|
-
import SlashCommandBuilder from './build/SlashCommandBuilder.js';
|
|
10
|
-
import { CommandType, EventEmitterType, ContextCommandType, InhibitorType } from './types/enums.js';
|
|
11
|
-
import XernerxError from './tools/XernerxError.js';
|
|
12
|
-
declare const xernerxVersion: string;
|
|
13
|
-
declare const _default: {
|
|
14
|
-
Client: typeof XernerxClient;
|
|
15
|
-
XernerxClient: typeof XernerxClient;
|
|
16
|
-
CommandType: typeof CommandType;
|
|
17
|
-
EventEmitterType: typeof EventEmitterType;
|
|
18
|
-
InhibitorType: typeof InhibitorType;
|
|
19
|
-
ContextCommandType: typeof ContextCommandType;
|
|
20
|
-
EventBuilder: typeof EventBuilder;
|
|
21
|
-
MessageCommandBuilder: typeof MessageCommandBuilder;
|
|
22
|
-
ContextCommandBuilder: typeof ContextCommandBuilder;
|
|
23
|
-
SlashCommandBuilder: typeof SlashCommandBuilder;
|
|
24
|
-
InhibitorBuilder: typeof InhibitorBuilder;
|
|
25
|
-
ExtensionBuilder: typeof ExtensionBuilder;
|
|
26
|
-
XernerxError: typeof XernerxError;
|
|
27
|
-
version: string;
|
|
28
|
-
};
|
|
29
|
-
export default _default;
|
|
30
|
-
export { XernerxClient, CommandType, EventEmitterType, InhibitorType, ContextCommandType, EventBuilder, MessageCommandBuilder, ContextCommandBuilder, SlashCommandBuilder, InhibitorBuilder, ExtensionBuilder, XernerxError, xernerxVersion, };
|
|
1
|
+
export * from 'discord.js';
|
|
2
|
+
export * from 'dumfunctions';
|
|
3
|
+
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
4
|
+
import XernerxClient from './client/XernerxClient.js';
|
|
5
|
+
import EventBuilder from './build/EventBuilder.js';
|
|
6
|
+
import InhibitorBuilder from './build/InhibitorBuilder.js';
|
|
7
|
+
import MessageCommandBuilder from './build/MessageCommandBuilder.js';
|
|
8
|
+
import ContextCommandBuilder from './build/ContextCommandBuilder.js';
|
|
9
|
+
import SlashCommandBuilder from './build/SlashCommandBuilder.js';
|
|
10
|
+
import { CommandType, EventEmitterType, ContextCommandType, InhibitorType } from './types/enums.js';
|
|
11
|
+
import XernerxError from './tools/XernerxError.js';
|
|
12
|
+
declare const xernerxVersion: string;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
Client: typeof XernerxClient;
|
|
15
|
+
XernerxClient: typeof XernerxClient;
|
|
16
|
+
CommandType: typeof CommandType;
|
|
17
|
+
EventEmitterType: typeof EventEmitterType;
|
|
18
|
+
InhibitorType: typeof InhibitorType;
|
|
19
|
+
ContextCommandType: typeof ContextCommandType;
|
|
20
|
+
EventBuilder: typeof EventBuilder;
|
|
21
|
+
MessageCommandBuilder: typeof MessageCommandBuilder;
|
|
22
|
+
ContextCommandBuilder: typeof ContextCommandBuilder;
|
|
23
|
+
SlashCommandBuilder: typeof SlashCommandBuilder;
|
|
24
|
+
InhibitorBuilder: typeof InhibitorBuilder;
|
|
25
|
+
ExtensionBuilder: typeof ExtensionBuilder;
|
|
26
|
+
XernerxError: typeof XernerxError;
|
|
27
|
+
version: string;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
30
|
+
export { XernerxClient, CommandType, EventEmitterType, InhibitorType, ContextCommandType, EventBuilder, MessageCommandBuilder, ContextCommandBuilder, SlashCommandBuilder, InhibitorBuilder, ExtensionBuilder, XernerxError, xernerxVersion, };
|
package/dist/main.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
export * from 'discord.js';
|
|
2
|
-
export * from 'dumfunctions';
|
|
3
|
-
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
4
|
-
import XernerxClient from './client/XernerxClient.js';
|
|
5
|
-
import EventBuilder from './build/EventBuilder.js';
|
|
6
|
-
import InhibitorBuilder from './build/InhibitorBuilder.js';
|
|
7
|
-
import MessageCommandBuilder from './build/MessageCommandBuilder.js';
|
|
8
|
-
import ContextCommandBuilder from './build/ContextCommandBuilder.js';
|
|
9
|
-
import SlashCommandBuilder from './build/SlashCommandBuilder.js';
|
|
10
|
-
import { CommandType, EventEmitterType, ContextCommandType, InhibitorType } from './types/enums.js';
|
|
11
|
-
import XernerxError from './tools/XernerxError.js';
|
|
12
|
-
import pkg from './tools/package.js';
|
|
13
|
-
const xernerxVersion = pkg.version;
|
|
14
|
-
export default {
|
|
15
|
-
// Client
|
|
16
|
-
Client: XernerxClient,
|
|
17
|
-
XernerxClient,
|
|
18
|
-
// Enums
|
|
19
|
-
CommandType,
|
|
20
|
-
EventEmitterType,
|
|
21
|
-
InhibitorType,
|
|
22
|
-
ContextCommandType,
|
|
23
|
-
// Builds
|
|
24
|
-
EventBuilder,
|
|
25
|
-
MessageCommandBuilder,
|
|
26
|
-
ContextCommandBuilder,
|
|
27
|
-
SlashCommandBuilder,
|
|
28
|
-
InhibitorBuilder,
|
|
29
|
-
ExtensionBuilder,
|
|
30
|
-
XernerxError,
|
|
31
|
-
// Constants
|
|
32
|
-
version: xernerxVersion,
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
// Client
|
|
36
|
-
XernerxClient,
|
|
37
|
-
// Enums
|
|
38
|
-
CommandType, EventEmitterType, InhibitorType, ContextCommandType,
|
|
39
|
-
// Builds
|
|
40
|
-
EventBuilder, MessageCommandBuilder, ContextCommandBuilder, SlashCommandBuilder, InhibitorBuilder, ExtensionBuilder, XernerxError,
|
|
41
|
-
// Constants
|
|
42
|
-
xernerxVersion, };
|
|
1
|
+
export * from 'discord.js';
|
|
2
|
+
export * from 'dumfunctions';
|
|
3
|
+
import ExtensionBuilder from 'xernerx-extension-builder';
|
|
4
|
+
import XernerxClient from './client/XernerxClient.js';
|
|
5
|
+
import EventBuilder from './build/EventBuilder.js';
|
|
6
|
+
import InhibitorBuilder from './build/InhibitorBuilder.js';
|
|
7
|
+
import MessageCommandBuilder from './build/MessageCommandBuilder.js';
|
|
8
|
+
import ContextCommandBuilder from './build/ContextCommandBuilder.js';
|
|
9
|
+
import SlashCommandBuilder from './build/SlashCommandBuilder.js';
|
|
10
|
+
import { CommandType, EventEmitterType, ContextCommandType, InhibitorType } from './types/enums.js';
|
|
11
|
+
import XernerxError from './tools/XernerxError.js';
|
|
12
|
+
import pkg from './tools/package.js';
|
|
13
|
+
const xernerxVersion = pkg.version;
|
|
14
|
+
export default {
|
|
15
|
+
// Client
|
|
16
|
+
Client: XernerxClient,
|
|
17
|
+
XernerxClient,
|
|
18
|
+
// Enums
|
|
19
|
+
CommandType,
|
|
20
|
+
EventEmitterType,
|
|
21
|
+
InhibitorType,
|
|
22
|
+
ContextCommandType,
|
|
23
|
+
// Builds
|
|
24
|
+
EventBuilder,
|
|
25
|
+
MessageCommandBuilder,
|
|
26
|
+
ContextCommandBuilder,
|
|
27
|
+
SlashCommandBuilder,
|
|
28
|
+
InhibitorBuilder,
|
|
29
|
+
ExtensionBuilder,
|
|
30
|
+
XernerxError,
|
|
31
|
+
// Constants
|
|
32
|
+
version: xernerxVersion,
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
// Client
|
|
36
|
+
XernerxClient,
|
|
37
|
+
// Enums
|
|
38
|
+
CommandType, EventEmitterType, InhibitorType, ContextCommandType,
|
|
39
|
+
// Builds
|
|
40
|
+
EventBuilder, MessageCommandBuilder, ContextCommandBuilder, SlashCommandBuilder, InhibitorBuilder, ExtensionBuilder, XernerxError,
|
|
41
|
+
// Constants
|
|
42
|
+
xernerxVersion, };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
|
|
2
|
-
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
3
|
-
export declare class InteractionArguments {
|
|
4
|
-
interaction: XernerxInteraction;
|
|
5
|
-
constructor(interaction: XernerxInteraction);
|
|
6
|
-
group(): string | undefined;
|
|
7
|
-
subcommand(): string | undefined;
|
|
8
|
-
arguments(): Record<string, object>;
|
|
9
|
-
}
|
|
10
|
-
interface Flag {
|
|
11
|
-
flags: Record<string, string | boolean>;
|
|
12
|
-
}
|
|
13
|
-
interface Argument {
|
|
14
|
-
[index: string]: string | number | null;
|
|
15
|
-
}
|
|
16
|
-
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<import("discord.js").Message<boolean> | Flag | Argument | undefined>;
|
|
17
|
-
export {};
|
|
1
|
+
import MessageCommandBuilder from '../build/MessageCommandBuilder.js';
|
|
2
|
+
import { XernerxInteraction, XernerxMessage } from '../types/types.js';
|
|
3
|
+
export declare class InteractionArguments {
|
|
4
|
+
interaction: XernerxInteraction;
|
|
5
|
+
constructor(interaction: XernerxInteraction);
|
|
6
|
+
group(): string | undefined;
|
|
7
|
+
subcommand(): string | undefined;
|
|
8
|
+
arguments(): Record<string, object>;
|
|
9
|
+
}
|
|
10
|
+
interface Flag {
|
|
11
|
+
flags: Record<string, string | boolean>;
|
|
12
|
+
}
|
|
13
|
+
interface Argument {
|
|
14
|
+
[index: string]: string | number | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function messageArguments(message: XernerxMessage, command: MessageCommandBuilder): Promise<import("discord.js").Message<boolean> | Flag | Argument | undefined>;
|
|
17
|
+
export {};
|
|
@@ -1,123 +1,121 @@
|
|
|
1
|
-
export class InteractionArguments {
|
|
2
|
-
interaction;
|
|
3
|
-
constructor(interaction) {
|
|
4
|
-
this.interaction = interaction;
|
|
5
|
-
}
|
|
6
|
-
group() {
|
|
7
|
-
return this.interaction?.options?._group;
|
|
8
|
-
}
|
|
9
|
-
subcommand() {
|
|
10
|
-
return this.interaction?.options?._subcommand;
|
|
11
|
-
}
|
|
12
|
-
arguments() {
|
|
13
|
-
const options = {};
|
|
14
|
-
if (this.interaction?.options?._hoistedOptions) {
|
|
15
|
-
for (const option of this.interaction.options._hoistedOptions) {
|
|
16
|
-
options[option.name] = option.channel || option.user || option.role || option.value;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return options;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export async function messageArguments(message, command) {
|
|
23
|
-
let args = { flags: {} }, separator = command.separator || ' ', i = 0;
|
|
24
|
-
if (!command.args)
|
|
25
|
-
return;
|
|
26
|
-
command.args
|
|
27
|
-
.filter((c) => c.type == 'flag')
|
|
28
|
-
.map((flag) => {
|
|
29
|
-
args = args;
|
|
30
|
-
for (const flg of message.content.matchAll(flag.match)) {
|
|
31
|
-
if (flag.match == flg) {
|
|
32
|
-
message.content = message.content.replace(flag.match, '');
|
|
33
|
-
args.flags[flag.name] = true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (!args.flags[flag.name])
|
|
37
|
-
args.flags[flag.name] = false;
|
|
38
|
-
});
|
|
39
|
-
for (const argument of command.args) {
|
|
40
|
-
args = args;
|
|
41
|
-
let content = message.content
|
|
42
|
-
.split(/ +/)
|
|
43
|
-
.slice(1)
|
|
44
|
-
.join(separator)
|
|
45
|
-
.replace(new RegExp(`${separator}${separator}+`, 'g'), separator)
|
|
46
|
-
.split(separator)
|
|
47
|
-
.slice(i);
|
|
48
|
-
if (content.join(separator) != '' && argument.type !== 'flag') {
|
|
49
|
-
if (argument?.content?.includes(content[0])) {
|
|
50
|
-
args[argument.name] = content[0];
|
|
51
|
-
}
|
|
52
|
-
else if (argument.type == 'string') {
|
|
53
|
-
args[argument.name] = content[0];
|
|
54
|
-
}
|
|
55
|
-
else if (argument.type == 'number') {
|
|
56
|
-
args[argument.name] = parseInt(content[0]);
|
|
57
|
-
}
|
|
58
|
-
else if (argument.type == 'boolean') {
|
|
59
|
-
if (content[0]?.toLowerCase() != 'true' && content[0]?.toLowerCase() != 'false')
|
|
60
|
-
content[0] = null;
|
|
61
|
-
args[argument.name] = content[0];
|
|
62
|
-
}
|
|
63
|
-
else if (argument.type == 'user') {
|
|
64
|
-
let user = message.client.users.cache.find((u) => u?.username?.toLowerCase()?.includes(content[0])) || null;
|
|
65
|
-
try {
|
|
66
|
-
user = (await message.client.users.fetch(user?.id || content[0].replace(/<@!?|>/g, ''))) || null;
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
user = null;
|
|
70
|
-
}
|
|
71
|
-
args[argument.name] = user;
|
|
72
|
-
}
|
|
73
|
-
else if (argument.type == 'role') {
|
|
74
|
-
let role = message.guild?.roles.cache.find((r) => r?.name?.toLowerCase()?.includes(content[0])) || null;
|
|
75
|
-
try {
|
|
76
|
-
role = (await message.guild?.roles.fetch(role?.id || content[0].replace(/<@&?|>/g, ''))) || null;
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
role = null;
|
|
80
|
-
}
|
|
81
|
-
args[argument.name] = role;
|
|
82
|
-
}
|
|
83
|
-
else if (argument.type == 'member') {
|
|
84
|
-
let member = message.guild?.members.cache.find((m) => m?.nickname?.toLowerCase()?.includes(content[0]) ||
|
|
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
|
-
if (argument.prompt.
|
|
111
|
-
return message.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return args;
|
|
123
|
-
}
|
|
1
|
+
export class InteractionArguments {
|
|
2
|
+
interaction;
|
|
3
|
+
constructor(interaction) {
|
|
4
|
+
this.interaction = interaction;
|
|
5
|
+
}
|
|
6
|
+
group() {
|
|
7
|
+
return this.interaction?.options?._group;
|
|
8
|
+
}
|
|
9
|
+
subcommand() {
|
|
10
|
+
return this.interaction?.options?._subcommand;
|
|
11
|
+
}
|
|
12
|
+
arguments() {
|
|
13
|
+
const options = {};
|
|
14
|
+
if (this.interaction?.options?._hoistedOptions) {
|
|
15
|
+
for (const option of this.interaction.options._hoistedOptions) {
|
|
16
|
+
options[option.name] = option.channel || option.user || option.role || option.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return options;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function messageArguments(message, command) {
|
|
23
|
+
let args = { flags: {} }, separator = command.separator || ' ', i = 0;
|
|
24
|
+
if (!command.args)
|
|
25
|
+
return;
|
|
26
|
+
command.args
|
|
27
|
+
.filter((c) => c.type == 'flag')
|
|
28
|
+
.map((flag) => {
|
|
29
|
+
args = args;
|
|
30
|
+
for (const flg of message.content.matchAll(flag.match)) {
|
|
31
|
+
if (flag.match == flg) {
|
|
32
|
+
message.content = message.content.replace(flag.match, '');
|
|
33
|
+
args.flags[flag.name] = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!args.flags[flag.name])
|
|
37
|
+
args.flags[flag.name] = false;
|
|
38
|
+
});
|
|
39
|
+
for (const argument of command.args) {
|
|
40
|
+
args = args;
|
|
41
|
+
let content = message.content
|
|
42
|
+
.split(/ +/)
|
|
43
|
+
.slice(1)
|
|
44
|
+
.join(separator)
|
|
45
|
+
.replace(new RegExp(`${separator}${separator}+`, 'g'), separator)
|
|
46
|
+
.split(separator)
|
|
47
|
+
.slice(i);
|
|
48
|
+
if (content.join(separator) != '' && argument.type !== 'flag') {
|
|
49
|
+
if (argument?.content?.includes(content[0])) {
|
|
50
|
+
args[argument.name] = content[0];
|
|
51
|
+
}
|
|
52
|
+
else if (argument.type == 'string') {
|
|
53
|
+
args[argument.name] = content[0];
|
|
54
|
+
}
|
|
55
|
+
else if (argument.type == 'number') {
|
|
56
|
+
args[argument.name] = parseInt(content[0]);
|
|
57
|
+
}
|
|
58
|
+
else if (argument.type == 'boolean') {
|
|
59
|
+
if (content[0]?.toLowerCase() != 'true' && content[0]?.toLowerCase() != 'false')
|
|
60
|
+
content[0] = null;
|
|
61
|
+
args[argument.name] = content[0];
|
|
62
|
+
}
|
|
63
|
+
else if (argument.type == 'user') {
|
|
64
|
+
let user = message.client.users.cache.find((u) => u?.username?.toLowerCase()?.includes(content[0])) || null;
|
|
65
|
+
try {
|
|
66
|
+
user = (await message.client.users.fetch(user?.id || content[0].replace(/<@!?|>/g, ''))) || null;
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
user = null;
|
|
70
|
+
}
|
|
71
|
+
args[argument.name] = user;
|
|
72
|
+
}
|
|
73
|
+
else if (argument.type == 'role') {
|
|
74
|
+
let role = message.guild?.roles.cache.find((r) => r?.name?.toLowerCase()?.includes(content[0])) || null;
|
|
75
|
+
try {
|
|
76
|
+
role = (await message.guild?.roles.fetch(role?.id || content[0].replace(/<@&?|>/g, ''))) || null;
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
role = null;
|
|
80
|
+
}
|
|
81
|
+
args[argument.name] = role;
|
|
82
|
+
}
|
|
83
|
+
else if (argument.type == 'member') {
|
|
84
|
+
let member = message.guild?.members.cache.find((m) => m?.nickname?.toLowerCase()?.includes(content[0]) || m?.user?.username?.toLowerCase()?.includes(content[0])) || null;
|
|
85
|
+
try {
|
|
86
|
+
member = (await message.guild?.members.fetch(member?.id || content[0].replace(/<@!?|>/g, ''))) || null;
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
member = null;
|
|
90
|
+
}
|
|
91
|
+
args[argument.name] = member;
|
|
92
|
+
}
|
|
93
|
+
else if (argument.type == 'channel') {
|
|
94
|
+
let channel = message.guild?.channels.cache.find((c) => c?.name?.toLowerCase()?.includes(content[0]));
|
|
95
|
+
try {
|
|
96
|
+
channel = await message.client.channels.fetch(channel?.id || content[0].replace(/<#|>/g, ''));
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
channel = null;
|
|
100
|
+
}
|
|
101
|
+
args[argument.name] = channel;
|
|
102
|
+
}
|
|
103
|
+
else if (argument.type == 'rest') {
|
|
104
|
+
args[argument.name] = content.join(separator);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
else if (argument.prompt) {
|
|
108
|
+
if (argument.prompt.reply)
|
|
109
|
+
return message.util?.reply(argument.prompt.reply);
|
|
110
|
+
else if (argument.prompt.send)
|
|
111
|
+
return message.channel.send(argument.prompt.send);
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
args[argument.name] = typeof argument.default == 'function' ? argument.default(message) : argument.default;
|
|
115
|
+
i++;
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
args[argument.name] = typeof argument.default == 'function' ? argument.default(message) : argument.default;
|
|
119
|
+
}
|
|
120
|
+
return args;
|
|
121
|
+
}
|
package/dist/models/Events.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
-
export declare class MessageCommandEvents {
|
|
3
|
-
client: XernerxClient;
|
|
4
|
-
constructor(client: XernerxClient);
|
|
5
|
-
messageCreate(): void;
|
|
6
|
-
messageUpdate(): void;
|
|
7
|
-
messageDelete(): void;
|
|
8
|
-
}
|
|
9
|
-
export declare class SlashCommandEvents {
|
|
10
|
-
client: XernerxClient;
|
|
11
|
-
constructor(client: XernerxClient);
|
|
12
|
-
slashCreate(): void;
|
|
13
|
-
}
|
|
14
|
-
export declare class ContextCommandEvents {
|
|
15
|
-
client: XernerxClient;
|
|
16
|
-
constructor(client: XernerxClient);
|
|
17
|
-
contextCreate(): void;
|
|
18
|
-
}
|
|
19
|
-
export declare class CommandsDeploy {
|
|
20
|
-
private client;
|
|
21
|
-
constructor(client: XernerxClient);
|
|
22
|
-
deploy(): void;
|
|
23
|
-
private put;
|
|
24
|
-
}
|
|
1
|
+
import XernerxClient from '../client/XernerxClient.js';
|
|
2
|
+
export declare class MessageCommandEvents {
|
|
3
|
+
client: XernerxClient;
|
|
4
|
+
constructor(client: XernerxClient);
|
|
5
|
+
messageCreate(): void;
|
|
6
|
+
messageUpdate(): void;
|
|
7
|
+
messageDelete(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class SlashCommandEvents {
|
|
10
|
+
client: XernerxClient;
|
|
11
|
+
constructor(client: XernerxClient);
|
|
12
|
+
slashCreate(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class ContextCommandEvents {
|
|
15
|
+
client: XernerxClient;
|
|
16
|
+
constructor(client: XernerxClient);
|
|
17
|
+
contextCreate(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class CommandsDeploy {
|
|
20
|
+
private client;
|
|
21
|
+
constructor(client: XernerxClient);
|
|
22
|
+
deploy(): void;
|
|
23
|
+
private put;
|
|
24
|
+
}
|