devsnek / discord-rich-presence

Discord RPC but only the rich presence part
122 stars 16 forks source link

Error: RPC_CONNECTION_TIMEOUT #26

Open Xart3mis opened 4 years ago

Xart3mis commented 4 years ago

everytime i start the app i get this error

Error: RPC_CONNECTION_TIMEOUT at Timeout._onTimeout (D:\Documents\Nodejs\Electron\4anime-app\node_modules\discord-rpc\src\client.js:107:47) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) Promise {

Error: RPC_CONNECTION_TIMEOUT at Timeout._onTimeout (D:\Documents\Nodejs\Electron\4anime-app\node_modules\discord-rpc\src\client.js:107:47) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) } here's the code ``` function updateDiscordRPC() { const client = require("discord-rich-presence")("removed for privacy"); client.on("connected", () => { console.log("connected!"); }); client.updatePresence({ state: "Watchin Anime", details: `watching ${getCurrentUrl}`, largeImageKey: "logo", instance: false, elapsedTime: new Date(), }); } ``` full project is [here](https://www.github.com/Xart3mis/4anime-app)
DylanD16 commented 3 years ago

Why are you running updatePresence

Sv443 commented 3 years ago

elapsedTime has to be an epoch number, not a Date object. Try to replace new Date() with Date.now() or new Date().getTime()

GiovanH commented 2 years ago

https://github.com/devsnek/discord-rich-presence/blob/e7c9d0b76e463d3f92e70ba58aad4a2bb1726608/test.js#L27 uses new Date().