mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Merge pull request #239 from Araxeus/discord-fix
simple fix for discord plugin
This commit is contained in:
@ -15,10 +15,13 @@ 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,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);
|
||||
|
||||
Reference in New Issue
Block a user