From 8eb12469a38f8ee565a000eb7417a22b45bf371e Mon Sep 17 00:00:00 2001 From: Agampreet Singh <68941022+agam778@users.noreply.github.com> Date: Sat, 24 Sep 2022 23:21:53 +0530 Subject: [PATCH] Show message box when error occurs on RPC connection --- main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 263f3d1..68cb62a 100644 --- a/main.js +++ b/main.js @@ -589,11 +589,15 @@ app.on("ready", function () { }); }); autoUpdater.checkForUpdatesAndNotify(); - rpc - .login({ clientId }) - .catch(() => - console.error( - "Oops! An Error occured while connecting to Discord RPC. Probably discord isn't installed or opened?" - ) + if (store.get("discordrpcstatus") === "true") { + rpc.login({ clientId }).catch(() => + dialog.showMessageBox(BrowserWindow.getFocusedWindow(), { + type: "error", + title: "Discord RPC Error", + message: + "Oops! An Error occured while connecting to Discord RPC. Probably discord isn't installed or opened?", + buttons: ["OK"], + }) ); + } });