From eefe851a4457cb217bcbd55a9ed9db89df499196 Mon Sep 17 00:00:00 2001 From: Claude Owner Date: Wed, 11 Nov 2026 21:35:54 +0900 Subject: [PATCH] fix(commands): correct signature site URL; stop command errors from crashing the bot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ;시그니처 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 --- src/classes/Handler.ts | 6 +++++- src/commands/signature.ts | 2 +- src/events/messageCreate.ts | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/classes/Handler.ts b/src/classes/Handler.ts index 8f338e3..9cda38f 100644 --- a/src/classes/Handler.ts +++ b/src/classes/Handler.ts @@ -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 = 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)}`); + }); } } \ No newline at end of file diff --git a/src/commands/signature.ts b/src/commands/signature.ts index 44ff7da..1e23e27 100644 --- a/src/commands/signature.ts +++ b/src/commands/signature.ts @@ -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)); } } \ No newline at end of file diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 1ca11c4..2a2963f 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -31,7 +31,11 @@ export const messageCreate = async (message: Message): Promise => { 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);