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);