Skip to content

Conversation

sukitsubaki
Copy link

This PR enhances the robustness of the Discord Rich Presence functionality by adding detection for various Discord client variants before attempting to establish a connection.

Changes

  • Added a new DiscordClientName type to support all known Discord variants (Standard, Canary, PTB, Development)
  • Created a constant array of all Discord client names for detection
  • Implemented an isAnyDiscordRunning() function that checks if any Discord variant is running
  • Modified the setActivityLoop() method to verify Discord is running before connection attempts

Benefits

  • Prevents unnecessary connection attempts when no Discord client is running
  • Reduces error logs and resource usage when Discord is not active
  • Improves overall script stability and responsiveness
  • Works seamlessly with all Discord variants (Discord, Discord Canary, Discord PTB, Discord Development)

Testing

Tested with Discord Canary and Discord and verified that the Rich Presence status is correctly displayed only when a Discord client is running.

Notes

This change is backward compatible and doesn't affect any existing functionality. It simply adds a verification step before attempting to connect to the Discord RPC.

Copy link
Owner

@NextFire NextFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 👍
Can you address my few suggestions and apply the formatter?

sukitsubaki and others added 5 commits May 1, 2025 18:48
@sukitsubaki sukitsubaki requested a review from NextFire May 2, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants