feat(DiscordRPC): add support for targeting specific Discord instances (PTB/Canary)#223
Open
zeedif wants to merge 3 commits intoInrixia:masterfrom
Open
feat(DiscordRPC): add support for targeting specific Discord instances (PTB/Canary)#223zeedif wants to merge 3 commits intoInrixia:masterfrom
zeedif wants to merge 3 commits intoInrixia:masterfrom
Conversation
- Added dynamic scanning of active Discord IPC pipes (`getAvailablePipes`). - Automatically connects to the available pipe if only one is found. - Added a dropdown in settings to select the preferred instance (e.g., Stable vs PTB) when multiple clients are open. The setting remains hidden if only one instance is active. - Improved connection error handling to prevent UI timeout alerts.
Inrixia
requested changes
Feb 27, 2026
Owner
Inrixia
left a comment
There was a problem hiding this comment.
This is a awesome pr!
Few changes and fixes and I'll be happy to merge 💜
- Extracted pipe detection logic into its own file (`getAvailablePipes.native.ts`). - Updated file system operations to use `node:fs/promises`. - Implemented `os.tmpdir()` for OS-agnostic temp directory resolution. - Optimized pipe ID collection using a `Set`. - Wrapped `getClient` with `asyncDebounce` to efficiently handle concurrent connection attempts. - Removed silent `try/catch` in `setActivity` to ensure errors properly propagate up.
Author
|
Thanks for the feedback! I've just pushed a new commit applying all your suggestions. Let me know if everything looks good now. |
Inrixia
requested changes
Feb 27, 2026
Owner
Inrixia
left a comment
There was a problem hiding this comment.
Looks great, just a few other things around error handling and avoiding client spawn loops and itl be foot to merge.
| if (rpcClient) await rpcClient.destroy(); | ||
| rpcClient = new Client({ clientId: "1130698654987067493" }); | ||
| await rpcClient.connect(); | ||
| if (rpcClient) await rpcClient.destroy().catch(() => {}); |
Owner
There was a problem hiding this comment.
Please remove the catch here as well.
| const client = await getClient(); | ||
| if (!client.user) return; | ||
| rpcClient = new Client(clientOptions); | ||
| currentPipeId = targetPipe; |
Owner
There was a problem hiding this comment.
This should only be set after .connect is called
Owner
There was a problem hiding this comment.
Only this left and then happy to merge, thanks for fixing these things 💜
- Removed silent `.catch(() => {})` on `destroy()` calls to properly throw errors.
- Removed `try/catch` wrapper around `connect()` to let connection errors propagate up naturally.
- Removed redundant `rpcClient = null` assignments.
- Simplified user validation in `setActivity` using optional chaining (`client?.user`).
- Refactored `cleanupRPC` to correctly bubble up potential errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for targeting a specific Discord instance for the Rich Presence.
I personally use two Discord instances at the same time (Stable and PTB) for different accounts, and I wanted to be able to choose which account gets the Tidal Rich Presence. Previously, it would just default to whatever client was opened first.
Changes made
discord-ipc-x) are currently open.try/catchblocks to prevent the client from throwing annoyingCONNECTION_TIMEOUTUI errors when a pipe drops or fails to respond.