31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { BotClient } from "./classes/BotClient";
|
|
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);
|
|
export const handler = new Handler();
|
|
export const Redis = RedisClient();
|
|
|
|
for (const eventName of Object.keys(onEvents) as (keyof typeof onEvents)[]) {
|
|
client.onEvent(eventName, onEvents[eventName]);
|
|
}
|
|
|
|
client.start();
|