Updates and Fixes issues with Discord Rich Presences #3785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My system and some pre information
Note I've had to disable the pre-commit as it simply would not run no matter what the debugging I tried on it
But info:
node -v
: v8.15.0npm -v
: v6.4.1This was Tested on a Win10 64x (1903)
npm run lint
has been ran, and no errors returned.Fixes:
Possible fix to #2969
This issue seemed to be caused by a dead RPC connection when Discord wasn't open, still trying to send requests to it. This is fixed by using a Connected / Disconnected varaible which prevents from sending requests to nothing.
This is not verified as I was not experiancing the issue before, but from my testing of a few hours on my PC, (On and Off Discord) My RAM never really exceeded much 300MBs.
Fixes #3266
This is fixed by using my own Discord application instead of the currently used one. I've previously requested to join the existing Application but haven't got a reply. I have this one setup for teams already, and willing to add people if I'm provided with a Discord username + Discrim. (Discord only supports Full Admin at the moment so it will be restricted to main Contributers, People who have got previously approve Discord RPC work)
Fixes #3404
This will currently try to reconnect to the client on a State change but the Event listeners on Google Play Music might get moved around.
Explaination stuff...
Looking through the Basic Discord-rich-presences library used before, there was no event triggered for disconnecting from client.
This is why I have instead replace it with the native discord-rpc library instead of the wrapper library originally used, for better control over the RPC + all of the events including the Disconnect.
Added features
I've also added an additional feature of showing a Heart icon on songs which are liked.
Testing
Sadly this can't have a testing Library but I will create YouTube Video including a showing example of it all working!
Crappy YouTube Video showing "stuff"
Edit:
Been rolling with this as my Daily driver for my Google Play Music, and a friend of mine has been using the prebuilt version for their daily driver for a few weeks, with no issues towards it showing up incorrectly.
Discussion
One thing that probably needs a bit more questioning would be the usage of the Application's event listeners and for when to check for a connection for Discord.
This change is