소스 검색

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.
Daniel Scalzi 7 년 전
부모
커밋
ee55446cd6
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      app/assets/js/discordwrapper.js

+ 4 - 1
app/assets/js/discordwrapper.js

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