GoonCord/src/core/commands/debug.ts

35 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-03-06 01:57:59 +08:00
import { Strings } from "@core/i18n";
import { ApplicationCommand, ApplicationCommandOptionType } from "@lib/api/commands/types";
2024-02-27 23:35:55 +08:00
import { getDebugInfo } from "@lib/debug";
import { messageUtil } from "@metro/common";
export default () => <ApplicationCommand>{
name: "debug",
description: Strings.COMMAND_DEBUG_DESC,
options: [
{
name: "ephemeral",
type: ApplicationCommandOptionType.BOOLEAN,
description: Strings.COMMAND_DEBUG_OPT_EPHEMERALLY,
}
],
execute([ephemeral], ctx) {
const info = getDebugInfo();
const content = [
"**Bunny Debug Info**",
2024-03-01 14:25:43 +08:00
`> Bunny: ${info.bunny.version} (${info.bunny.loader})`,
2024-02-27 23:35:55 +08:00
`> Discord: ${info.discord.version} (${info.discord.build})`,
`> React: ${info.react.version} (RN ${info.react.nativeVersion})`,
`> Hermes: ${info.hermes.version} (bcv${info.hermes.bytecodeVersion})`,
`> System: ${info.os.name} ${info.os.version} (SDK ${info.os.sdk})`,
`> Device: ${info.device.model} (${info.device.codename})`,
].join("\n");
if (ephemeral?.value) {
messageUtil.sendBotMessage(ctx.channel.id, content);
} else {
messageUtil.sendMessage(ctx.channel.id, { content });
}
}
2024-03-06 01:57:59 +08:00
};