-
Notifications
You must be signed in to change notification settings - Fork 3
Fix support for custom discord clients #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7 files reviewed, 3 comments
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully
| 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 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.