Skip to content

Fake Discord app for testing without Discord - #9

Open
NickMarcha wants to merge 1 commit into
platform-seamsfrom
fake-discord
Open

NickMarcha wants to merge 1 commit into
platform-seamsfrom
fake-discord

Conversation

@NickMarcha

Copy link
Copy Markdown
Owner

Stacked on #8 (base platform-seams); retarget to release once #8 is merged.

tools/fake-discord stands in for the Discord desktop app, so d-scribe can be tested without Discord, a second account or anyone to call. See tools/fake-discord/README.md.

What it does

  • Speaks the IPC protocol d-scribe uses: handshake, READY, AUTHORIZE (PKCE S256), AUTHENTICATE, GET_SELECTED_VOICE_CHANNEL, GET_GUILD, SUBSCRIBE/UNSUBSCRIBE to SPEAKING_START/STOP, PING, CLOSE. It follows Discord's rules where d-scribe depends on them: commands need AUTHENTICATE first, codes work once and need the right verifier and redirect_uri, refresh tokens rotate, speaking events only reach subscribed connections.
  • Serves POST /oauth2/token and GET /v10/users/@me/guilds.
  • Plays scenario files: join a server channel, DM or group DM; people joining, leaving and talking, with WAV clips or --tones (a pitch per person); Discord closing; a cancelled popup; a revoked login. Three examples are in scenarios/.
  • Typed commands change the call while it runs (join, speak 201 3, say 201 clip.wav, close, reject on...).
  • Its framing is written separately from d-scribe's on purpose, so a shared bug can't hide.

App changes (dev switches)

  • DSCRIBE_DISCORD_IPC: connect to this pipe/socket instead of discord-ipc-N (also used for the "Discord running" check).
  • DSCRIBE_DISCORD_API: replaces https://discord.com/api.
  • While either is set: the login goes to discord_tokens.fake.json (the real login is untouched), and the log says a fake Discord is in use.

Tests

  • The app's RPC test now uses the fake: sign-in with the popup and code exchange over the fake's HTTP server, channel info, speaking start and stop, refresh and rotation, auto-reconnect, a revoked token, a cancelled popup.
  • A new test connects to the fake on a real Windows named pipe through DSCRIBE_DISCORD_IPC.
  • 8 tests for the fake itself (tools/fake-discord/tests/protocol.rs).
  • Windows: 29 app tests and 8 fake tests pass. Linux (Docker, rust:1.91): 27 and 8, no warnings. CI runs the fake's tests too.
  • Not tried: the real app window against the tool, because the installed d-scribe was running on this machine. To try it, quit d-scribe and follow the README.

🤖 Generated with Claude Code

tools/fake-discord stands in for the Discord desktop app: the IPC protocol
d-scribe uses (with PKCE, single-use codes, rotating refresh tokens and
subscription rules), the token and guilds HTTP endpoints, and scenario files
with people joining, talking (WAV clips or tones) and leaving. Typed commands
change the call while it runs.

d-scribe connects to it when DSCRIBE_DISCORD_IPC and DSCRIBE_DISCORD_API are
set, and then keeps the login in discord_tokens.fake.json so the real one
is untouched.

The Rust tests now sign in against the fake (popup, code exchange over HTTP,
refresh, revoked token, cancelled popup) and connect to it on a real named
pipe. CI runs the fake's own tests too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@NickMarcha NickMarcha added the skip-changelog Leave this PR out of the release notes and the #updates post label Nov 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Leave this PR out of the release notes and the #updates post

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant