Skip to content

Commit 8decdf4

Browse files
authored
Merge pull request #239 from Araxeus/discord-fix
simple fix for discord plugin
2 parents 61e7124 + 20123d8 commit 8decdf4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugins/discord/back.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ module.exports = (win, {activityTimoutEnabled, activityTimoutTime}) => {
1515
const registerCallback = getSongInfo(win);
1616

1717
// If the page is ready, register the callback
18-
win.on("ready-to-show", () => {
19-
rpc.on("ready", () => {
18+
win.once("ready-to-show", () => {
19+
rpc.once("ready", () => {
2020
// Register the callback
2121
registerCallback((songInfo) => {
22+
if (songInfo.title.length === 0 && songInfo.artist.length === 0) {
23+
return;
24+
}
2225
// Song information changed, so lets update the rich presence
2326
const activityInfo = {
2427
details: songInfo.title,
@@ -36,8 +39,7 @@ module.exports = (win, {activityTimoutEnabled, activityTimoutTime}) => {
3639
activityInfo.smallImageText = "idle/paused";
3740
// Set start the timer so the activity gets cleared after a while if enabled
3841
if (activityTimoutEnabled)
39-
clearActivity = setTimeout(()=>rpc.clearActivity(), activityTimoutTime||10,000);
40-
42+
clearActivity = setTimeout(()=>rpc.clearActivity(), activityTimoutTime||10000);
4143
} else {
4244
// stop the clear activity timout
4345
clearTimeout(clearActivity);

0 commit comments

Comments
 (0)