2023-06-01 18:36:39 +00:00
|
|
|
import { SlashCommandBuilder } from 'discord.js';
|
2023-04-26 14:23:42 +00:00
|
|
|
import packageJSON from '../../package.json' assert { type: 'json' };
|
2023-06-26 15:05:05 +00:00
|
|
|
import { client } from '../bot.js';
|
2023-05-30 18:42:34 +00:00
|
|
|
import { tankopedia } from '../core/blitz/tankopedia.js';
|
2023-06-02 01:31:14 +00:00
|
|
|
import { tankAverages } from '../core/blitzstars/tankAverages.js';
|
2023-06-27 02:22:28 +00:00
|
|
|
import embedInfo from '../core/discord/embedInfo.js';
|
|
|
|
|
import markdownTable from '../core/discord/markdownTable.js';
|
2023-06-27 01:43:30 +00:00
|
|
|
import getClientId from '../core/node/getClientId.js';
|
2023-06-25 02:32:56 +00:00
|
|
|
import { CommandRegistry } from '../events/interactionCreate/index.js';
|
2023-04-26 14:23:42 +00:00
|
|
|
|
2023-04-27 01:00:56 +00:00
|
|
|
const executionStart = new Date().getTime();
|
|
|
|
|
|
2023-04-26 14:23:42 +00:00
|
|
|
export default {
|
2023-04-26 23:43:43 +00:00
|
|
|
inProduction: true,
|
2023-06-23 17:14:27 +00:00
|
|
|
inDevelopment: false,
|
2023-04-26 14:23:42 +00:00
|
|
|
inPublic: true,
|
|
|
|
|
|
|
|
|
|
command: new SlashCommandBuilder()
|
2023-06-21 02:01:12 +00:00
|
|
|
.setName('debug')
|
2023-04-26 14:23:42 +00:00
|
|
|
.setDescription('Debug information about the bot'),
|
|
|
|
|
|
2023-06-27 01:43:30 +00:00
|
|
|
handler(interaction) {
|
2023-04-26 14:23:42 +00:00
|
|
|
const currentTime = new Date().getTime();
|
|
|
|
|
const uptime = currentTime - executionStart;
|
|
|
|
|
|
2023-06-27 02:22:28 +00:00
|
|
|
return embedInfo(
|
2023-06-16 02:01:06 +00:00
|
|
|
`${client.user?.username} debug information`,
|
2023-06-27 02:22:28 +00:00
|
|
|
markdownTable([
|
2023-06-16 02:01:06 +00:00
|
|
|
['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', `${tankopedia !== undefined}`],
|
|
|
|
|
['Tank averages cached', `${tankAverages !== undefined}`],
|
|
|
|
|
]),
|
|
|
|
|
);
|
2023-04-26 14:23:42 +00:00
|
|
|
},
|
|
|
|
|
} satisfies CommandRegistry;
|