diff --git a/src/index.ts b/src/index.ts index 35e211b..7b9c7d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,13 +35,12 @@ const cleanup = () => { container.pool.end(); }; -main().catch((error) => { - container.logger.error(error); -}); +main(); process.on("uncaughtException", (error) => { console.error(error); cleanup(); + process.exit(1); }); process.on("SIGTERM", () => { diff --git a/src/listeners/imageboard_check.ts b/src/listeners/imageboard_check.ts index cac4676..8f6bd59 100644 --- a/src/listeners/imageboard_check.ts +++ b/src/listeners/imageboard_check.ts @@ -35,7 +35,7 @@ export class ImageboardCheckListener extends Listener { const notWhitelisted = !roles?.hasAny(...settings.whitelist); if (locked && hasNoLink && hasNoAttachments && notWhitelisted) { - msg.delete(); + ttry(() => msg.delete()); } } }