Discord Rich Presence: register the app and ship the presence card #48

Open
opened 2026-08-28 19:08:29 +00:00 by ImBenji · 1 comment
Owner

The client is implemented and sits on development. lib/utils/discord/ speaks Discord's local IPC directly - a unix domain socket on macOS/Linux, a hand-rolled kernel32 named-pipe binding on Windows - so there is no native dependency and no dead upstream SDK involved. The card shows Editing <map name>, line and station counts, an elapsed timer and a link button. Framing and payload shaping are covered by test/discord_presence_test.dart.

Settings live under Preferences > Integrations. Rich presence defaults on; "Show map name" defaults off, because the map name goes out to every server the user is in and un-broadcasting is not a thing.

What is left is all account-side and cannot be done from the repo: create the application at discord.com/developers/applications, paste its Application ID into _kDiscordAppIdDefault in lib/constants.dart (or pass --dart-define=DISCORD_APP_ID), and upload a Rich Presence art asset keyed logo. Until the ID is set the feature no-ops and logs why, so nothing breaks in the meantime.

Worth confirming on Linux once it is live: Flatpak and Snap Discord put their socket in a sandboxed runtime dir. The connector already sweeps those paths but nobody has tested it against a real install.

The client is implemented and sits on `development`. `lib/utils/discord/` speaks Discord's local IPC directly - a unix domain socket on macOS/Linux, a hand-rolled kernel32 named-pipe binding on Windows - so there is no native dependency and no dead upstream SDK involved. The card shows `Editing <map name>`, line and station counts, an elapsed timer and a link button. Framing and payload shaping are covered by `test/discord_presence_test.dart`. Settings live under Preferences > Integrations. Rich presence defaults on; "Show map name" defaults off, because the map name goes out to every server the user is in and un-broadcasting is not a thing. What is left is all account-side and cannot be done from the repo: create the application at discord.com/developers/applications, paste its Application ID into `_kDiscordAppIdDefault` in `lib/constants.dart` (or pass `--dart-define=DISCORD_APP_ID`), and upload a Rich Presence art asset keyed `logo`. Until the ID is set the feature no-ops and logs why, so nothing breaks in the meantime. Worth confirming on Linux once it is live: Flatpak and Snap Discord put their socket in a sandboxed runtime dir. The connector already sweeps those paths but nobody has tested it against a real install.
ImBenji added the enhancement label 2026-08-28 19:08:29 +00:00
ImBenji added this to the Arcs & Angles project 2026-08-28 19:08:29 +00:00
Author
Owner

Partial update from the roadmap audit, 2026-09-05.

The application is registered - _kDiscordAppIdDefault in lib/constants.dart:492 now holds a real ID rather than an empty string, so the feature is no longer no-opping on a missing ID.

Still outstanding, both still account-side or hardware-side:

  1. Upload the Rich Presence art asset keyed logo. Without it the card shows with no image.
    1. Verify against a real Flatpak and Snap Discord on Linux. The connector sweeps the sandboxed runtime dirs but that path has never been exercised against an actual install.
      Everything in the repo is done: lib/utils/discord/ (conditional-export facade, length-prefixed IPC framing, unix socket on macOS/Linux, hand-rolled kernel32 named pipe on Windows), settings under Preferences > Integrations with "Show map name" defaulting OFF, and test/discord_presence_test.dart covering framing and payload shaping.
Partial update from the roadmap audit, 2026-09-05. The application is registered - `_kDiscordAppIdDefault` in `lib/constants.dart:492` now holds a real ID rather than an empty string, so the feature is no longer no-opping on a missing ID. Still outstanding, both still account-side or hardware-side: 1. Upload the Rich Presence art asset keyed `logo`. Without it the card shows with no image. 2. 2. Verify against a real Flatpak and Snap Discord on Linux. The connector sweeps the sandboxed runtime dirs but that path has never been exercised against an actual install. Everything in the repo is done: `lib/utils/discord/` (conditional-export facade, length-prefixed IPC framing, unix socket on macOS/Linux, hand-rolled kernel32 named pipe on Windows), settings under Preferences > Integrations with "Show map name" defaulting OFF, and `test/discord_presence_test.dart` covering framing and payload shaping.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#48