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>{
|
|
|
|
|
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 = [
|
2025-05-03 17:29:00 +01:00
|
|
|
"**Pupu Debug Info**",
|
2025-05-03 20:32:55 +01:00
|
|
|
`> Pupu: ${info.pupu.version} (${info.pupu.loader.name} ${info.pupu.loader.version})`,
|
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})`,
|
2024-04-30 17:07:23 +08:00
|
|
|
`> System: ${info.os.name} ${info.os.version} ${info.os.sdk ? `(SDK ${info.os.sdk})` : ""}`.trimEnd(),
|
2024-02-27 23:35:55 +08:00
|
|
|
`> 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
|
|
|
};
|