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-10-14 11:32:02 -05:00
|
|
|
import { client } from '../core/discord/client';
|
2023-07-11 19:54:57 +00:00
|
|
|
import { CommandRegistry } from '../events/interactionCreate';
|
2023-04-26 14:23:42 +00:00
|
|
|
|
2023-04-27 01:00:56 +00:00
|
|
|
const executionStart = new Date().getTime();
|
|
|
|
|
|
2023-07-05 01:15:18 +00:00
|
|
|
export const debugCommand: CommandRegistry = {
|
2023-04-26 23:43:43 +00:00
|
|
|
inProduction: true,
|
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'),
|
|
|
|
|
|
2024-01-19 21:32:46 -06:00
|
|
|
async handler() {
|
2023-04-26 14:23:42 +00:00
|
|
|
const currentTime = new Date().getTime();
|
|
|
|
|
const uptime = currentTime - executionStart;
|
2023-11-25 20:46:20 -06:00
|
|
|
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');
|
2023-04-26 14:23:42 +00:00
|
|
|
|
2023-11-25 20:46:20 -06:00
|
|
|
return `# Debug\n\n${list}`;
|
2023-04-26 14:23:42 +00:00
|
|
|
},
|
2023-07-05 01:15:18 +00:00
|
|
|
};
|