Fix support for custom discord clients - #3
Open
F1zzTao wants to merge 1 commit into
Open
Conversation
Owner
|
@greptile-apps Review this. |
|
Make sure you do the changes Sensei Greptile SummaryThis PR replaces process name-based Discord detection with IPC path checking using pypresence's Key changes:
Benefits:
Considerations:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as HytaleRPC App
participant RPC as HytaleRPC.run()
participant IPC as pypresence.get_ipc_path()
participant Process as is_process_running()
participant Discord as Discord Client (any)
App->>RPC: Start monitoring loop
loop Every 3 seconds
RPC->>IPC: get_ipc_path()
IPC->>Discord: Check IPC socket/pipe
alt IPC path exists
Discord-->>IPC: Return IPC path
IPC-->>RPC: Returns path string
RPC->>RPC: discord_on = True
else IPC path not found
Discord-->>IPC: No IPC available
IPC-->>RPC: Returns None
RPC->>RPC: discord_on = False
end
RPC->>Process: is_process_running(HYTALE_PROCESS_NAMES)
Process-->>RPC: hytale_on status
alt Hytale & Discord running + RPC inactive
RPC->>RPC: Connect to Discord RPC
RPC->>RPC: Set rpc_active = True
else Hytale stopped + RPC active
RPC->>RPC: Disconnect from Discord RPC
RPC->>RPC: Set rpc_active = False
else Discord stopped + RPC active
RPC->>RPC: Clear connection state
RPC->>RPC: Set rpc_active = False
else RPC active
RPC->>RPC: Update presence status
end
end
|
|
|
||
| while self.running: | ||
| discord_on = is_process_running(DISCORD_PROCESS_NAMES) | ||
| discord_on = True if get_ipc_path() else False |
There was a problem hiding this comment.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
Suggested change
| discord_on = True if get_ipc_path() else False | |
| try: | |
| discord_on = True if get_ipc_path() else False | |
| except Exception: | |
| discord_on = False |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc.py
Line: 79:79
Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully
```suggestion
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
```
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| while self.running: | ||
| discord_on = is_process_running(DISCORD_PROCESS_NAMES) | ||
| discord_on = True if get_ipc_path() else False |
There was a problem hiding this comment.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
Suggested change
| discord_on = True if get_ipc_path() else False | |
| try: | |
| discord_on = True if get_ipc_path() else False | |
| except Exception: | |
| discord_on = False |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc_macos.py
Line: 84:84
Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully
```suggestion
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
```
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| while self.running: | ||
| discord_on = is_process_running(DISCORD_PROCESS_NAMES) | ||
| discord_on = True if get_ipc_path() else False |
There was a problem hiding this comment.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
Suggested change
| discord_on = True if get_ipc_path() else False | |
| try: | |
| discord_on = True if get_ipc_path() else False | |
| except Exception: | |
| discord_on = False |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc_windows.py
Line: 87:87
Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully
```suggestion
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
```
How can I resolve this? If you propose a fix, please make it concise.
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 change replaces the built-in process checking system for a running discord client. The current system only checks for official discord client processes. However, some people use unofficial discord clients like Vesktop, Vencord, betterdiscord, etc., so this app doesn't work with them as it can't find the discord process.
By checking the IPC path instead, we can find any running discord clients.
Only tested on Linux (CachyOS) with Vesktop, don't know about support for other systems and clients, but they should work as well.