From c145ffa50b3160b0d1fa5bb84cc540319044c2d0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 7 Jan 2025 23:38:42 +0100 Subject: [PATCH] feat(bot): provide more helpful errors in case of misconfiguration --- server/bot/bot.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/bot/bot.js b/server/bot/bot.js index c7fbeb2a..e1f1c4b6 100644 --- a/server/bot/bot.js +++ b/server/bot/bot.js @@ -3,7 +3,18 @@ process.on('uncaughtException', function(err) { console.log('Caught exception: ', err.stack) }) process.on('unhandledRejection', function(err) { - console.log('Caught exception: ', err.stack) + if (err.message.includes("this.rest.clearHashSweeper is not a function")) { + setTimeout(() => { // mandatory delay so idiots can read the error + console.log("^1EasyAdmin ^3FATAL ERROR! ^7Your Discord Token is Invalid, EasyAdmin's Discord Bot ^1will not work ^7until this error has been resolved! Please check your Discord Token and try again.") + }, 1000); + return + } else if (err.message.includes("disallowed intents")) { + setTimeout(() => { + console.log("^1EasyAdmin ^3FATAL ERROR! ^7Your Discord Bot does not have the correct intents enabled, EasyAdmin's Discord Bot ^1will not work ^7until this error has been resolved! Please refer to the documentation: https://easyadmin.readthedocs.io/en/latest/discordbot/#creating-the-bot-user") + }, 1000); + return + } + console.log('Caught rejection: ', err.stack) }) AsciiTable = require('ascii-table')