GoonCord/src/core/commands/debug.ts

42 lines
1.4 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-07-30 00:18:01 +08:00
import { getDebugInfo } from "@lib/api/debug";
2024-02-27 23:35:55 +08:00
import { messageUtil } from "@metro/common";
export default () =>
<ApplicationCommand>{
2025-12-27 01:45:59 +01:00
name: "Goon",
2024-02-27 23:35:55 +08:00
description: Strings.COMMAND_DEBUG_DESC,
options: [
{
name: "ephemeral",
type: ApplicationCommandOptionType.BOOLEAN,
description: Strings.COMMAND_DEBUG_OPT_EPHEMERALLY,
},
2024-02-27 23:35:55 +08:00
],
execute([ephemeral], ctx) {
const info = getDebugInfo();
const content = [
2025-12-27 01:45:59 +01:00
"**GoonCord Debug Info**",
`> GoonCord: ${info.bunny.version} (${info.bunny.loader.name} ${info.bunny.loader.version})`,
`> 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} ${info.os.sdk ? `(SDK ${info.os.sdk})` : ""}`.trimEnd(),
`> Device: ${info.device.model}`,
].join("\n");
2024-02-27 23:35:55 +08:00
if (ephemeral?.value) {
messageUtil.sendBotMessage(ctx.channel.id, content);
} else {
const fixNonce = Date.now().toString();
messageUtil.sendMessage(ctx.channel.id, { content }, void 0, {
nonce: fixNonce,
});
}
},
};