fix(commands): correct signature site URL; stop command errors from crashing the bot

;시그니처 sent an embed with url "https:sig.tkrmagid.kr", which Discord
rejects (50035 Invalid Form Body). messageRun/slashRun were called without
await or catch, so the rejection became an unhandled rejection and killed
the Node process (container restarted 3 times on 2026-11-11 21:33).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude Owner
2026-11-11 21:35:54 +09:00
parent 26b4525316
commit eefe851a44
3 changed files with 11 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { ChatInputCommandInteraction, Collection } from "discord.js";
import { readdirSync } from "node:fs";
import { Command } from "../types/Command";
import { COMMAND_PATH, COMMANDS_PATH } from "../utils/Config";
import { Logger } from "../utils/Logger";
export class Handler {
public commands: Collection<string, Command> = new Collection();
@@ -28,6 +29,9 @@ export class Handler {
const command = this.commands.get(commandName);
if (!command) return;
if (command.slashRun) command.slashRun(interaction);
if (!command.slashRun) return;
Promise.resolve(command.slashRun(interaction)).catch((err) => {
Logger.error(`[명령어] /${commandName} 실행 오류: ${String(err)}`);
});
}
}

View File

@@ -25,7 +25,7 @@ export default class implements Command {
if (message.channel?.type !== ChannelType.GuildText) return;
return await message.channel.send({ embeds: [ client.mkembed({
title: "시그니처 사이트",
url: "https:sig.tkrmagid.kr",
url: "https://sig.tkrmagid.kr",
}) ] }).then(m => client.msgDelete(m, 5));
}
}

View File

@@ -31,7 +31,11 @@ export const messageCreate = async (message: Message): Promise<void> => {
cmdErr(message, commandName);
return client.msgDelete(message, 0, true);
}
command.messageRun(message, args);
// messageRun은 async라 여기 try/catch로 잡히지 않는다. 거부된 promise가
// unhandled rejection으로 프로세스 전체를 죽이지 않도록 따로 처리한다.
Promise.resolve(command.messageRun(message, args)).catch((err) => {
Logger.error(`[명령어] ${commandName} 실행 오류: ${String(err)}`);
});
client.msgDelete(message, 0, true);
} catch(err: any) {
if (Config.debug) Logger.error(err);