diff --git a/config.json.template b/config.json.template index 102bb58..d1d7410 100644 --- a/config.json.template +++ b/config.json.template @@ -1,4 +1,5 @@ { + "debug": 0, "priorityColors": { "1": "#00AFFF", "2": "#00FF00", @@ -8,14 +9,21 @@ }, "discord": { "token": "YOUR_TOKEN", - "owner": "your_user_id", - "mainGuild": "your_guild_id", - "inviteChannel": "your_channel_id" + "owner": "YOUR_ID", + "mainGuild": "YOUR_GUILD", + "inviteChannel": "INVITE_CHANNEL", + "logChannel": "LOG_CHANNEL" }, "ntfy": { "enabled": false, - "server": "https://Example.com", - "token": "ntfy_access_token", - "prefix": "iem-" + "server": "https://your.ntfy.server", + "token": "tk_XXXXXXXXXXXXXXXX", + "prefix": "iem-", + "errors": "iem-errors" + }, + "broadcastify": { + "enabled": false, + "username": "YOUR_USERNAME", + "password": "YOUR_PASSWORD" } } \ No newline at end of file diff --git a/index.js b/index.js index 7f5d954..659c758 100644 --- a/index.js +++ b/index.js @@ -1133,10 +1133,42 @@ discord.on("guildDelete", (guild) => { process.on("unhandledRejection", (error) => { console.log(`${colors.red("[ERROR]")} Unhandled Rejection: ${error.message}`); + if (config.ntfy.enabled) { + fetch(config.ntfy.server, { + method: 'POST', + body: JSON.stringify({ + "topic": config.ntfy.errors, + "message": `Unhandled Rejection: ${error.message}`, + "tags": ["Error"], + "priority": 5 + }), + headers: { + 'Authorization': `Bearer ${config.ntfy.token}` + } + }).catch((err) => { + console.error(err) + }) + } }); process.on("uncaughtException", (error) => { console.log(`${colors.red("[ERROR]")} Uncaught Exception: ${error.message}\n${error.stack}`); + if (config.ntfy.enabled) { + fetch(config.ntfy.server, { + method: 'POST', + body: JSON.stringify({ + "topic": config.ntfy.errors, + "message": `Uncaught Exception: ${error.message}\n${error.stack}`, + "tags": ["Error"], + "priority": 5 + }), + headers: { + 'Authorization': `Bearer ${config.ntfy.token}` + } + }).catch((err) => { + console.error(err) + }) + } }); // Login to discord