From 650945418db49598e239094db1ed7134398a56eb Mon Sep 17 00:00:00 2001 From: Araxeus Date: Fri, 23 Apr 2021 03:42:00 +0300 Subject: [PATCH 1/2] simple fix --- plugins/discord/back.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/discord/back.js b/plugins/discord/back.js index 2fb8cc79..e46f5fb5 100644 --- a/plugins/discord/back.js +++ b/plugins/discord/back.js @@ -11,14 +11,17 @@ const clientId = "790655993809338398"; let clearActivity; -module.exports = (win, {activityTimoutEnabled, activityTimoutTime}) => { +module.exports = (win, { activityTimoutEnabled, activityTimoutTime }) => { const registerCallback = getSongInfo(win); // If the page is ready, register the callback - win.on("ready-to-show", () => { - rpc.on("ready", () => { + win.once("ready-to-show", () => { + rpc.once("ready", () => { // Register the callback registerCallback((songInfo) => { + if (songInfo.title.length === 0 && songInfo.artist.length === 0) { + return; + } // Song information changed, so lets update the rich presence const activityInfo = { details: songInfo.title, @@ -36,7 +39,7 @@ module.exports = (win, {activityTimoutEnabled, activityTimoutTime}) => { activityInfo.smallImageText = "idle/paused"; // Set start the timer so the activity gets cleared after a while if enabled if (activityTimoutEnabled) - clearActivity = setTimeout(()=>rpc.clearActivity(), activityTimoutTime||10,000); + clearActivity = setTimeout(() => rpc.clearActivity(), activityTimoutTime || 10, 000); } else { // stop the clear activity timout From 20123d8245483f3e446f336b9c3d2649cb7d760c Mon Sep 17 00:00:00 2001 From: Araxeus Date: Fri, 23 Apr 2021 03:50:00 +0300 Subject: [PATCH 2/2] revert to original lint format --- plugins/discord/back.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/discord/back.js b/plugins/discord/back.js index e46f5fb5..80be6243 100644 --- a/plugins/discord/back.js +++ b/plugins/discord/back.js @@ -11,7 +11,7 @@ const clientId = "790655993809338398"; let clearActivity; -module.exports = (win, { activityTimoutEnabled, activityTimoutTime }) => { +module.exports = (win, {activityTimoutEnabled, activityTimoutTime}) => { const registerCallback = getSongInfo(win); // If the page is ready, register the callback @@ -39,8 +39,7 @@ module.exports = (win, { activityTimoutEnabled, activityTimoutTime }) => { activityInfo.smallImageText = "idle/paused"; // Set start the timer so the activity gets cleared after a while if enabled if (activityTimoutEnabled) - clearActivity = setTimeout(() => rpc.clearActivity(), activityTimoutTime || 10, 000); - + clearActivity = setTimeout(()=>rpc.clearActivity(), activityTimoutTime||10000); } else { // stop the clear activity timout clearTimeout(clearActivity);