xernerx 4.15.3 → 4.16.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.
|
@@ -44,6 +44,7 @@ export default class XernerxClient extends Client {
|
|
|
44
44
|
warn: z.boolean().default(false),
|
|
45
45
|
error: z.boolean().default(false),
|
|
46
46
|
table: z.array(z.string()).or(z.null()).default(null),
|
|
47
|
+
config: z.array(z.string()).or(z.null()).default(null),
|
|
47
48
|
})
|
|
48
49
|
.or(z.boolean())
|
|
49
50
|
.optional(),
|
package/dist/tools/XernerxLog.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** @format */
|
|
2
2
|
import { Style } from 'dumfunctions';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import Discord from 'discord.js';
|
|
5
|
+
import { version } from '../main.js';
|
|
6
|
+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
7
|
+
let i = 0;
|
|
3
8
|
export default class XernerxLog {
|
|
4
9
|
constructor(client) {
|
|
5
10
|
this.client = client;
|
|
@@ -14,15 +19,34 @@ export default class XernerxLog {
|
|
|
14
19
|
this.warnLog = client.settings.log?.warn;
|
|
15
20
|
this.readyLog = client.settings.log?.ready;
|
|
16
21
|
this.tableLog = client.settings.log?.table;
|
|
22
|
+
this.config = client.settings.log?.config || ['ram', 'time'];
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
const config = {
|
|
25
|
+
name: this.blue(pkg.name),
|
|
26
|
+
node: this.green(process.version),
|
|
27
|
+
xernerx: this.cyan(version),
|
|
28
|
+
discordjs: this.cyan(Discord.version),
|
|
29
|
+
platform: this.green(process.platform),
|
|
30
|
+
time: () => this.cyan(new Date().toLocaleTimeString()),
|
|
31
|
+
date: () => this.cyan(new Date().toLocaleDateString()),
|
|
32
|
+
ram: () => `${this.cyan(Math.round(process.memoryUsage().rss / 1000000))}mb`,
|
|
33
|
+
version: this.cyan(pkg.version),
|
|
34
|
+
author: this.blue(pkg.author),
|
|
35
|
+
shard: this.cyan(''),
|
|
36
|
+
index: () => {
|
|
37
|
+
i++;
|
|
38
|
+
return i;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
this.config;
|
|
21
42
|
process.on('message', (message) => {
|
|
22
43
|
if (message.type == 'xernerx')
|
|
23
|
-
|
|
44
|
+
config.shard = message?.data?.sharded ? `| ${message?.data?.shardId} |` : '';
|
|
24
45
|
});
|
|
25
|
-
this.base = (type, message) => `${type == 'info' ? `✔️ | ${this.purple('Xernerx')}` : type == `error` ? `❗ | ${this.red('Xernerx')}` : type == `update` ? `⬆️ | ${this.blue('Xernerx')}` : `⚠️ | ${this.yellow('Xernerx')}`} | ${this.
|
|
46
|
+
this.base = (type, message) => `${type == 'info' ? `✔️ | ${this.purple('Xernerx')}` : type == `error` ? `❗ | ${this.red('Xernerx')}` : type == `update` ? `⬆️ | ${this.blue('Xernerx')}` : `⚠️ | ${this.yellow('Xernerx')}`} | ${this.config
|
|
47
|
+
?.map((c) => (typeof config[c] == 'function' ? config[c]() : config[c]) || null)
|
|
48
|
+
.filter((x) => x)
|
|
49
|
+
.join(' | ')} | ${message}`;
|
|
26
50
|
}
|
|
27
51
|
info(message, force = false) {
|
|
28
52
|
return this.infoLog || force ? console.info(this.base('info', message)) : null;
|
|
@@ -35,6 +35,7 @@ export interface XernerxOptions {
|
|
|
35
35
|
warn?: boolean;
|
|
36
36
|
error?: boolean;
|
|
37
37
|
table?: Array<'name' | 'aliases' | 'description' | 'filetype' | 'category'>;
|
|
38
|
+
config?: Array<'name' | 'node' | 'xernerx' | 'discordjs' | 'platform' | 'time' | 'date' | 'ram' | 'version' | 'author' | 'shard' | 'index'>;
|
|
38
39
|
};
|
|
39
40
|
cooldown?: {
|
|
40
41
|
command?: number;
|