From 3864b5d082eafdc44bf7a8cb3481c733aca7479b Mon Sep 17 00:00:00 2001 From: tkrmagid-desktop Date: Sun, 26 Apr 2026 20:22:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=98=EB=8F=84=EC=B9=98=EC=95=8A=EC=9D=80?= =?UTF-8?q?=20=EC=A2=85=EB=A3=8C=EC=8B=9C=20=EC=98=A4=EB=A5=98=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=9E=91=EC=84=B1=ED=95=98=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/src/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bot/src/index.ts b/bot/src/index.ts index a40c6d3..0ec9f77 100644 --- a/bot/src/index.ts +++ b/bot/src/index.ts @@ -3,6 +3,20 @@ import { LavalinkManager } from "./classes/LavalinkManager"; import { Handler } from "./classes/Handler"; import { onEvents } from "./events"; import { RedisClient } from "./classes/RedisClient"; +import { Logger } from "./utils/Logger"; + +// 봇이 예기치 않게 죽기 직전에 에러를 잡아내서 로그로 남기는 코드 +process.on('unhandledRejection', (reason, _promise) => { + Logger.error('🚨 [치명적 오류] 처리되지 않은 Promise 거부 발생:'+String(reason)); +}); + +process.on('uncaughtException', (err) => { + Logger.error('🚨 [치명적 오류] 잡지 못한 예외 발생:'+String(err)); +}); + +process.on('SIGTERM', () => { + Logger.log('💀 시스템에 의해 강제 종료(SIGTERM) 신호를 받았습니다!'); +}); export const client = new BotClient(); export const lavalinkManager = new LavalinkManager(client);