Handle CTRL + C with SIGINT event & Add Error handling

This commit is contained in:
Christer Warén 2024-11-01 01:57:08 +02:00
parent 5105108df5
commit fd6675cd31

28
src/index.ts Normal file
View File

@ -0,0 +1,28 @@
import { Client as DiscordClient, Collection, IntentsBitField } from "discord.js";
process.on('SIGINT', () => {
process.exit();
});
process.on('SIGTERM', () => {
process.exit();
});
process.on('uncaughtException', (error) => {
console.error("Error");
console.error(error.name);
console.error(error.message);
console.error(error.stack);
});
process.on('exit', () => {
});
process.on('warning', (warning) => {
console.warn("Warning");
console.warn(warning.name);
console.warn(warning.message);
console.warn(warning.stack);
});