From fe2a2e53a47b9937048c359a7033812626bcd70b Mon Sep 17 00:00:00 2001 From: Neko-Life Date: Fri, 6 Aug 2021 21:57:30 +0700 Subject: [PATCH] log errors to console --- Main.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Main.js b/Main.js index ad63d29..8e6d641 100644 --- a/Main.js +++ b/Main.js @@ -198,15 +198,31 @@ client.on("commandRun", async (c, u, msg) => { if (msg.guild && !msg.guild.DB) await msg.guild.dbLoad(); }); -client.on("warn", a => console.log("warn", typeof a, a)); -client.on("error", e => errLog(e, null, client)); +client.on("warn", e => { + console.error(e); + errLog(e, null, client); +}); +client.on("error", e => { + console.error(e); + errLog(e, null, client); +}); client.on("commandError", (c, e, m) => { + console.error(e); errLog(e, m, client); m?.channel.stopTyping(); }); -process.on("uncaughtException", e => errLog(e, null, client)); -process.on("unhandledRejection", e => errLog(e, null, client)); -process.on("warning", e => errLog(e, null, client)); +process.on("uncaughtException", e => { + console.error(e); + errLog(e, null, client); +}); +process.on("unhandledRejection", e => { + console.error(e); + errLog(e, null, client); +}); +process.on("warning", e => { + console.error(e); + errLog(e, null, client); +}); client.login(configFile.token); \ No newline at end of file