mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: better debug
This commit is contained in:
1 parent
f5425d0e54
commit
f728751fa9
1 file changed
+15
-23
+15
-23
@@ -1,11 +1,6 @@
|
|||||||
import { SlashCommandBuilder } from 'discord.js';
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
import packageJSON from '../../package.json' assert { type: 'json' };
|
import packageJSON from '../../package.json' assert { type: 'json' };
|
||||||
import getClientId from '../core/blitzkrieg/getClientId';
|
|
||||||
import { tankAverages } from '../core/blitzstars/tankAverages';
|
|
||||||
import { tankopedia } from '../core/blitzstars/tankopedia';
|
|
||||||
import { client } from '../core/discord/client';
|
import { client } from '../core/discord/client';
|
||||||
import embedInfo from '../core/discord/embedInfo';
|
|
||||||
import markdownTable from '../core/discord/markdownTable';
|
|
||||||
import { CommandRegistry } from '../events/interactionCreate';
|
import { CommandRegistry } from '../events/interactionCreate';
|
||||||
|
|
||||||
const executionStart = new Date().getTime();
|
const executionStart = new Date().getTime();
|
||||||
@@ -21,24 +16,21 @@ export const debugCommand: CommandRegistry = {
|
|||||||
async handler(interaction) {
|
async handler(interaction) {
|
||||||
const currentTime = new Date().getTime();
|
const currentTime = new Date().getTime();
|
||||||
const uptime = currentTime - executionStart;
|
const uptime = currentTime - executionStart;
|
||||||
|
const list = [
|
||||||
|
['Version', packageJSON.version],
|
||||||
|
['Shard', client.shard?.ids[0] ?? 'default'],
|
||||||
|
[
|
||||||
|
'Uptime',
|
||||||
|
`${Math.floor((uptime / 1000 / 60 / 60) % 24)}h ${Math.floor(
|
||||||
|
(uptime / 1000 / 60) % 60,
|
||||||
|
)}m ${Math.floor((uptime / 1000) % 60)}s ${Math.floor(
|
||||||
|
uptime % 1000,
|
||||||
|
)}ms`,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
.map(([key, value]) => `- ${key}: ${value}`)
|
||||||
|
.join('\n');
|
||||||
|
|
||||||
return embedInfo(
|
return `# Debug\n\n${list}`;
|
||||||
`${client.user?.username} debug information`,
|
|
||||||
markdownTable([
|
|
||||||
['Version', packageJSON.version],
|
|
||||||
['Client ID', getClientId()],
|
|
||||||
['Tag', interaction.client.user.tag],
|
|
||||||
[
|
|
||||||
'Uptime',
|
|
||||||
`${Math.floor(uptime / 1000 / 60 / 60 / 24)}d ${Math.floor(
|
|
||||||
(uptime / 1000 / 60 / 60) % 24,
|
|
||||||
)}h ${Math.floor((uptime / 1000 / 60) % 60)}m ${Math.floor(
|
|
||||||
(uptime / 1000) % 60,
|
|
||||||
)}s ${Math.floor(uptime % 1000)}ms`,
|
|
||||||
],
|
|
||||||
['Tankopedia cached', `${(await tankopedia) !== undefined}`],
|
|
||||||
['Tank averages cached', `${(await tankAverages) !== undefined}`],
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user