discord-rich-presence
Advanced tools
Comparing version 0.0.6 to 0.0.7
27
index.js
@@ -0,6 +1,9 @@ | ||
'use strict'; | ||
const Discord = require('discord-rpc'); | ||
const EventEmitter = require('events'); | ||
const browser = typeof window !== 'undefined'; | ||
function makeClient(id) { | ||
function makeClient(clientId) { | ||
const rpc = new Discord.Client({ transport: browser ? 'websocket' : 'ipc' }); | ||
@@ -13,6 +16,7 @@ | ||
updatePresence(d) { | ||
if (connected) | ||
if (connected) { | ||
rpc.setActivity(d).catch((e) => this.emit('error', e)); | ||
else | ||
} else { | ||
activityCache = d; | ||
} | ||
} | ||
@@ -29,2 +33,5 @@ | ||
rpc.closeJoinRequest(user).catch(handle); | ||
break; | ||
default: | ||
throw new RangeError('unknown response'); | ||
} | ||
@@ -36,12 +43,9 @@ } | ||
} | ||
}; | ||
}(); | ||
rpc.login(id) | ||
rpc.login({ clientId }) | ||
.then(() => { | ||
instance.emit('connected'); | ||
connected = true; | ||
if (activityCache) { | ||
rpc.setActivity(activityCache).catch((e) => instance.emit('error', e)); | ||
activityCache = null; | ||
} | ||
rpc.subscribe('ACTIVITY_JOIN', ({ secret }) => { | ||
@@ -56,2 +60,7 @@ instance.emit('join', secret); | ||
}); | ||
if (activityCache) { | ||
rpc.setActivity(activityCache).catch((e) => instance.emit('error', e)); | ||
activityCache = null; | ||
} | ||
}) | ||
@@ -58,0 +67,0 @@ .catch((e) => instance.emit('error', e)); |
{ | ||
"name": "discord-rich-presence", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "rich presence wrapper for discord-rpc", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"discord-rpc": "^3.0.0-beta.8" | ||
"discord-rpc": "github:discordjs/rpc" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
56
23417
1
- Removeddiscord-rpc@3.2.0(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedws@7.5.10(transitive)