add ntfy logs

This commit is contained in:
Christopher Cookman 2024-03-10 16:12:31 -06:00
parent 7dbf5ac4c2
commit 9680dc46f0
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -193,4 +193,35 @@ client.on("interactionCreate", async (interaction) => {
});
// Lets actually handle exceptions now
process.on('unhandledRejection', (error) => {
// Log a full error with line number
sendLog(`${colors.red("[ERROR]")} ${error}`);
// If config.ntfyUrl is set, Send the exception to ntfy
if (config.ntfyUrl) fetch(config.ntfyUrl, {
method: 'POST', // PUT works too
body: error,
headers: {
'Title': 'TicketTool Watcher Bot Rejection',
'Priority': 5,
'Tags': 'warning,inbox_tray,TicketTool Watcher'
}
});
});
process.on('uncaughtException', (error) => {
// Log a full error with line number
sendLog(`${colors.red("[ERROR]")} ${error}`);
// If config.ntfyUrl is set, Send the exception to ntfy
if (config.ntfyUrl) fetch(config.ntfyUrl, {
method: 'POST', // PUT works too
body: error,
headers: {
'Title': 'TicketTool Watcher Bot Exception',
'Priority': 5,
'Tags': 'warning,inbox_tray,TicketTool Watcher'
}
});
});
client.login(config.token)