xernerx 4.16.0 → 4.17.0
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/XernerxContextCommand.d.ts +1 -0
- package/dist/build/XernerxMessageCommand.d.ts +6 -1
- package/dist/build/XernerxSlashCommand.d.ts +1 -0
- package/dist/tools/XernerxLog.d.ts +1 -1
- package/dist/tools/XernerxLog.js +6 -6
- package/dist/tools/XernerxText.d.ts +1 -0
- package/dist/tools/XernerxText.js +5 -0
- package/dist/types/interfaces.d.ts +1 -1
- package/dist/utils/ClientUtil.d.ts +1 -1
- package/dist/utils/ClientUtil.js +6 -2
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ export default class XernerxContextCommand {
|
|
|
43
43
|
readonly filepath: string;
|
|
44
44
|
readonly client: XernerxClientType;
|
|
45
45
|
util: InteractionUtil;
|
|
46
|
+
snowflake: string | null;
|
|
46
47
|
constructor(id: string, options: ContextCommandOptions);
|
|
47
48
|
/**
|
|
48
49
|
* @description the execution of the command
|
|
@@ -34,12 +34,17 @@ export default class XernerxMessageCommand {
|
|
|
34
34
|
} | undefined;
|
|
35
35
|
readonly permissions: {
|
|
36
36
|
user?: string[] | import("../main.js").PermissionNames[] | null | undefined;
|
|
37
|
-
client?: string[] | import("../main.js").PermissionNames[] | null | undefined;
|
|
37
|
+
client?: string[] | import("../main.js").PermissionNames[] | null | undefined; /**
|
|
38
|
+
* @description Checks for conditions before running the command
|
|
39
|
+
* @param message - The message event emitted on this command
|
|
40
|
+
* @param options - The args and flags parsed on this command
|
|
41
|
+
*/
|
|
38
42
|
dm?: boolean | undefined;
|
|
39
43
|
} | undefined;
|
|
40
44
|
readonly filetype: 'MessageCommand';
|
|
41
45
|
readonly filepath: string;
|
|
42
46
|
readonly client: XernerxClientType;
|
|
47
|
+
snowflake: string | null;
|
|
43
48
|
util: MessageUtil;
|
|
44
49
|
constructor(id: string, options: MessageCommandOptions);
|
|
45
50
|
/**
|
|
@@ -42,6 +42,7 @@ export default class XernerxSlashCommand {
|
|
|
42
42
|
readonly filetype: 'SlashCommand';
|
|
43
43
|
readonly filepath: string;
|
|
44
44
|
readonly client: XernerxClientType;
|
|
45
|
+
snowflake: string | null;
|
|
45
46
|
util: InteractionUtil;
|
|
46
47
|
constructor(id: string, options: SlashCommandOptions);
|
|
47
48
|
/**
|
package/dist/tools/XernerxLog.js
CHANGED
|
@@ -12,6 +12,7 @@ export default class XernerxLog {
|
|
|
12
12
|
this.errorLog = true;
|
|
13
13
|
this.infoLog = true;
|
|
14
14
|
this.warnLog = true;
|
|
15
|
+
this.format = ['ram', 'time'];
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
17
18
|
this.errorLog = client.settings.log?.error;
|
|
@@ -19,9 +20,9 @@ export default class XernerxLog {
|
|
|
19
20
|
this.warnLog = client.settings.log?.warn;
|
|
20
21
|
this.readyLog = client.settings.log?.ready;
|
|
21
22
|
this.tableLog = client.settings.log?.table;
|
|
22
|
-
this.
|
|
23
|
+
this.format = client.settings.log?.format || ['ram', 'time'];
|
|
23
24
|
}
|
|
24
|
-
const
|
|
25
|
+
const format = {
|
|
25
26
|
name: this.blue(pkg.name),
|
|
26
27
|
node: this.green(process.version),
|
|
27
28
|
xernerx: this.cyan(version),
|
|
@@ -38,13 +39,12 @@ export default class XernerxLog {
|
|
|
38
39
|
return i;
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
|
-
this.config;
|
|
42
42
|
process.on('message', (message) => {
|
|
43
43
|
if (message.type == 'xernerx')
|
|
44
|
-
|
|
44
|
+
format.shard = message?.data?.sharded ? `| ${message?.data?.shardId} |` : '';
|
|
45
45
|
});
|
|
46
|
-
this.base = (type, message) => `${type == 'info' ? `✔️ | ${this.purple('Xernerx')}` : type == `error` ? `❗ | ${this.red('Xernerx')}` : type == `update` ? `⬆️ | ${this.blue('Xernerx')}` : `⚠️ | ${this.yellow('Xernerx')}`} | ${this.
|
|
47
|
-
?.map((c) => (typeof
|
|
46
|
+
this.base = (type, message) => `${type == 'info' ? `✔️ | ${this.purple('Xernerx')}` : type == `error` ? `❗ | ${this.red('Xernerx')}` : type == `update` ? `⬆️ | ${this.blue('Xernerx')}` : `⚠️ | ${this.yellow('Xernerx')}`} | ${this.format
|
|
47
|
+
?.map((c) => (typeof format[c] == 'function' ? format[c]() : format[c]) || null)
|
|
48
48
|
.filter((x) => x)
|
|
49
49
|
.join(' | ')} | ${message}`;
|
|
50
50
|
}
|
|
@@ -7,6 +7,7 @@ export default class XernerxText {
|
|
|
7
7
|
role(role: string | Role): string;
|
|
8
8
|
emoji(emoji: string | Emoji, animated?: boolean): string;
|
|
9
9
|
member(member: string | XernerxMember): string;
|
|
10
|
+
command(id: string, name: string): string | null;
|
|
10
11
|
timestamp(timestamp?: number | Date, format?: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R'): string;
|
|
11
12
|
codeBlock(code: string, language: string): string;
|
|
12
13
|
iCodeBlock(code: string): string;
|
|
@@ -25,6 +25,11 @@ export default class XernerxText {
|
|
|
25
25
|
member = member.id;
|
|
26
26
|
return `<@!${member}>`;
|
|
27
27
|
}
|
|
28
|
+
command(id, name) {
|
|
29
|
+
if (typeof id !== 'string')
|
|
30
|
+
return null;
|
|
31
|
+
return `</${name}:${id}>`;
|
|
32
|
+
}
|
|
28
33
|
timestamp(timestamp = Date.now(), format = 'R') {
|
|
29
34
|
if (typeof timestamp == 'string')
|
|
30
35
|
timestamp = Number(timestamp);
|
|
@@ -35,7 +35,7 @@ export interface XernerxOptions {
|
|
|
35
35
|
warn?: boolean;
|
|
36
36
|
error?: boolean;
|
|
37
37
|
table?: Array<'name' | 'aliases' | 'description' | 'filetype' | 'category'>;
|
|
38
|
-
|
|
38
|
+
format?: Array<'name' | 'node' | 'xernerx' | 'discordjs' | 'platform' | 'time' | 'date' | 'ram' | 'version' | 'author' | 'shard' | 'index'>;
|
|
39
39
|
};
|
|
40
40
|
cooldown?: {
|
|
41
41
|
command?: number;
|
|
@@ -11,7 +11,7 @@ export default class ClientUtil extends Util {
|
|
|
11
11
|
constructor(client: XernerxClient);
|
|
12
12
|
setPresence(options: PresenceOptions): import("discord.js").ClientPresence | undefined;
|
|
13
13
|
private resolveCooldown;
|
|
14
|
-
resolveCommand(options: ResolveCommandOptions): XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand | Collection<string, XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand
|
|
14
|
+
resolveCommand(options: ResolveCommandOptions): Promise<XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand | Collection<string, XernerxSlashCommand | XernerxContextCommand | XernerxMessageCommand>>;
|
|
15
15
|
resolveChannel(query: string | Record<string, string>): Promise<import("discord.js").Channel | null>;
|
|
16
16
|
resolveGuild(query: string | Record<string, string>): Promise<import("discord.js").Guild | null>;
|
|
17
17
|
uptime(timestamp?: number | null): string;
|
package/dist/utils/ClientUtil.js
CHANGED
|
@@ -11,7 +11,8 @@ export default class ClientUtil extends Util {
|
|
|
11
11
|
}
|
|
12
12
|
// @ts-ignore
|
|
13
13
|
resolveCooldown() { }
|
|
14
|
-
resolveCommand(options) {
|
|
14
|
+
async resolveCommand(options) {
|
|
15
|
+
const interCommands = await this.client.application?.commands.fetch();
|
|
15
16
|
const commands = [], collection = new Collection();
|
|
16
17
|
if (options?.type == 'MessageCommand' || !options?.type)
|
|
17
18
|
commands.push(...this.client.commands.message);
|
|
@@ -19,7 +20,10 @@ export default class ClientUtil extends Util {
|
|
|
19
20
|
commands.push(...this.client.commands.slash);
|
|
20
21
|
if (options?.type == 'Interaction' || options?.type == 'ContextCommand' || !options?.type)
|
|
21
22
|
commands.push(...this.client.commands.context);
|
|
22
|
-
commands.map(([name, command]) =>
|
|
23
|
+
commands.map(([name, command]) => {
|
|
24
|
+
command.snowflake = interCommands?.find((cmd) => command.name === cmd.name)?.id || null;
|
|
25
|
+
collection.set(name, command);
|
|
26
|
+
});
|
|
23
27
|
if (options?.name) {
|
|
24
28
|
return collection.get(options.name) || null;
|
|
25
29
|
}
|