Temporary fix to DiscordRPC not shutting down properly.

Something must have changed on discord's end, as our previous solution is no longer working. The latest changes to the module include a clearActivity() method, however it is not available on npm. Until it is, we are using the implementation directly.
This commit is contained in:
Daniel Scalzi 2018-05-29 23:42:27 -04:00
parent daa6faac86
commit ee55446cd6
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9

View File

@ -30,6 +30,8 @@ exports.initRPC = function(genSettings, servSettings, initialDetails = 'Waiting
console.log('Unable to initialize Discord Rich Presence: ' + error.message, error) console.log('Unable to initialize Discord Rich Presence: ' + error.message, error)
} }
}) })
return rpc
} }
exports.updateDetails = function(details){ exports.updateDetails = function(details){
@ -42,7 +44,8 @@ exports.updateDetails = function(details){
exports.shutdownRPC = function(){ exports.shutdownRPC = function(){
if(!rpc) return if(!rpc) return
rpc.setActivity({}) // Workaround until discord rpc releases clearActivity()
rpc.request('SET_ACTIVITY', {pid: process.pid})
rpc.destroy() rpc.destroy()
rpc = null rpc = null
activity = null activity = null