Discord Rich Presence Extension

Discord (discordapp.com) is a gaming chat service however has a feature to show what games you are playing and recently added a feature to show what spotify song you are playing. I have made the extension (at least a working prototype) and you can find it at GitHub - jamesxsc/roon-discord-rp. I have asked TheAppgineer to add the roon-extension-manager however since it uses the discord-rpc library from DiscordJS, he didn’t want it in the library.

I think that the best approach for your Discord RP extension would be to create a Docker image for it. That would take care of the dependency difficulties and seems to be the way to go for extensions in general.

Never used docker, is it continuous integration? If so I have a TeamCity server that should work just fine. If not then how should I go about creating one, am open to suggestions and people willing to help.

A lot of Docker resources can be found via a Google search.

I used part 1 and 2 of the Getting Started Guide as a starting point.

You can derive your Dockerfile from an official Node image.

I’m not quite sure in the point in a docker image nor how to do it without having to host it on a server of mine. Is there not a way we can package the dependencies into the files that are downloaded by the extension manager?

Sorry to bring up an old thread, but how do I run this? I am running Windows 10.

2 Likes

Would also like a hand getting this to run if possible…

I’ve got npm and bide installed, installed the package, but I can’t seem to get it to actually run.

I’ve tried to alter the .js script to have no discord Id (I think) but can’t for the life of me find where I get the Roon zone ID or actually run this script.

1 Like

If you’ve got NPM and node installed you’ll need to run “npm install” in the source code folder to install the packages.

Next modify the settings. ClientID should be left as is. IP address can be left blank. Set “use_discovery” to true. ZoneID is the ID of the zone you want to report to discord RP. If you don’t know what the ID of the source zone is, the zones are listed as JSON in the console window when you run the app and you can lift it from there and add it to the settings before running the app a second time.

My settings look like this:

image

To run the app, in a command window type “node roon-discord-publish.js”.

If you don’t see any errors then you can open Roon and Navigate to Settings → Extensions. You should see the Rich Presence app listed. Click Authorize if needed.

You might need to restart Discord at this point.

That should be all you need to do.

I’ve only just looked at this myself this evening, if I get bored and decide I want to use it long term I might fork the repo and make it more user friendly.

1 Like

Thanks a lot. It’s a bit embarassing not knowing this stuff being an engineer, but i’ve been on firmware/systems for the last 5 years and all software knowledge is outdated haha. Can talk VHDL and signal processing all day but i’m hopeless on this stuff these days.

This may not be the right topic, but I tried to install node.js 18.17.0 (includes npm 9.6.7) and got an error like this.


It would be nice if someone could help.

I thought you said Discogs… Now that would be a cool integration

have roon server running on macOS sonoma 14.3 on apple silicon (Mac mini M2 Pro) together with discord.
npm 10.2.4 and node v21.6.1 are installed via homebrew

I actually cloned GitHub - williamtdr/roon-discord-publish: Uses the Discord Presence API to show what you're listening to on Roon. because npm install on GitHub - jamesxsc/roon-discord-rp returned a 404 on https://github.com/electron/electron/releases/download/v9.4.4/electron-v9.4.4-darwin-arm64.zip

having run ‘npm install’ i got the packages installed.
editing roon-discord-publish.js i left clientId alone and made ip blank and set use_discovery to true.
when i then run : node roon-discord-publish.js it returns:

node roon-discord-publish.js
Connecting to Discord…
(node:7806) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Error: Could not connect
at Socket.onerror (/Users/foo/git-repos/roon-discord-publish/node_modules/discord-rpc/src/transports/ipc.js:32:16)
at Object.onceWrapper (node:events:634:26)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

EDIT:
[~] netstat -anv | grep -w 6463
tcp4 0 0 127.0.0.1.6463 . LISTEN 131072 131072 7848 0 00100 00000106 00000000007419e4 00000001 00000900 1 0 000001
[~] sudo lsof -nP | grep LISTEN | grep :6463
Password:
Discord 7848 foo 56u IPv4 0xd168e0eba7a1755b 0t0 TCP 127.0.0.1:6463 (LISTEN)

so discord is nicely listening on localhost:6463 and i can connect to it locally

[~] tcp_open -qzz 127.0.0.1 6463 (tcp_open is a zsh(1) function to test sockets)

let’s check netstat output again:

[~] netstat -anv | grep -w 6463
tcp4 0 0 127.0.0.1.6463 127.0.0.1.50745 ESTABLISHED 408300 146988 7848 0 00102 00000104 0000000000869c1c 00000081 01000900 1 0 000001
tcp4 0 0 127.0.0.1.50745 127.0.0.1.6463 ESTABLISHED 408300 146988 1390 0 00002 00000100 0000000000869c1b 00000080 04000900 1 0 000001
tcp4 0 0 127.0.0.1.6463 . LISTEN 131072 131072 7848 0 00100 00000106 00000000007419e4 00000001 00000900 1 0 000001

Any tips on how to troubleshoot this further?
Thanks