Skip to content

feat: Add Discord Rich Presence support#23

Closed
google-labs-jules[bot] wants to merge 4 commits intomainfrom
discord-rpc-support-15255933584195856215
Closed

feat: Add Discord Rich Presence support#23
google-labs-jules[bot] wants to merge 4 commits intomainfrom
discord-rpc-support-15255933584195856215

Conversation

@google-labs-jules
Copy link

This PR adds Discord Rich Presence support to Plezy. It displays the currently playing media title, artist (or show details), and playback state (Playing/Paused) with timestamps on the user's Discord profile.

Key changes:

  • Added flutter_discord_rpc package.
  • Implemented DiscordRPCService to manage the connection and presence updates.
  • Updated MediaControlsManager to sync playback state with Discord RPC.
  • Conditional initialization for desktop platforms in main.dart.

Note: The Discord Application ID in lib/services/discord_rpc_service.dart is a placeholder and needs to be updated with a valid ID from the Discord Developer Portal.


PR created automatically by Jules for task 15255933584195856215 started by @Doezer

@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@Doezer
Copy link
Owner

Doezer commented Dec 23, 2025

@jules fix the lines linked to what you changed

info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:453:21 • use_build_context_synchronously
info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:471:39 • use_build_context_synchronously
info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:478:35 • use_build_context_synchronously
warning • The left operand can't be null, so the right operand is never executed • lib/services/media_controls_manager.dart:213:46 • dead_null_aware_expression
warning • The value of the local variable 'startTime' isn't used • lib/services/media_controls_manager.dart:216:10 • unused_local_variable

@google-labs-jules
Copy link
Author

@jules fix the lines linked to what you changed

info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:453:21 • use_build_context_synchronously
info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:471:39 • use_build_context_synchronously
info • Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check • lib/screens/media_detail_screen.dart:478:35 • use_build_context_synchronously
warning • The left operand can't be null, so the right operand is never executed • lib/services/media_controls_manager.dart:213:46 • dead_null_aware_expression
warning • The value of the local variable 'startTime' isn't used • lib/services/media_controls_manager.dart:216:10 • unused_local_variable

I have fixed the lint warnings in lib/services/media_controls_manager.dart (removed dead null check and unused variable). The use_build_context_synchronously warnings in lib/screens/media_detail_screen.dart appear to be in pre-existing code that I did not touch in this PR, so I have left them as is to avoid scope creep.

Comment on lines +229 to +245
_discordRpc.updatePresence(
title: title,
subtitle: artist.isNotEmpty ? artist : null,
state: isPlaying ? null : 'Paused', // If paused, show "Paused" in state? Or maybe in small text?
// Actually state is usually the second line. details is the first line.
// If paused, we can set small image text to "Paused".
// Let's refine:
// details: Title
// state: Artist (Show - S01E01)
// smallImage: playing/paused icon? or just keep it simple.

startTime: isPlaying && endTime == null ? DateTime.now().millisecondsSinceEpoch : null, // Show elapsed if no duration
endTime: isPlaying ? endTime : null,
largeImageKey: 'plezy', // Assuming we have this asset uploaded to Discord App
largeImageText: 'Plezy',
smallImageKey: isPlaying ? 'play' : 'pause', // Assuming these assets exist, or remove if not
smallImageText: isPlaying ? 'Playing' : 'Paused',
Copy link
Owner

Choose a reason for hiding this comment

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

Make comments simple and concise, remove if unnecessary and "make it simple" for the implem

Copy link
Author

Choose a reason for hiding this comment

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

Simplified the logic and removed unnecessary comments.

@Doezer Doezer marked this pull request as ready for review December 23, 2025 12:42
- Added `flutter_discord_rpc` dependency.
- Created `DiscordRPCService` to handle RPC logic.
- Integrated RPC updates into `MediaControlsManager`.
- Initialized RPC service in `main.dart` for desktop platforms.
- Added TODO for configuring valid Discord Application ID.
@Doezer Doezer force-pushed the discord-rpc-support-15255933584195856215 branch from 0846eaf to c16c79a Compare December 24, 2025 06:50
@Doezer Doezer closed this Feb 8, 2026
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.

1 participant