Skip to content

feat(chat): optimistic echo and moderation delivery notices - #19

Open
ChronoFinale wants to merge 1 commit into
Balatro-Multiplayer:mainfrom
ChronoFinale:feat/chat-moderation-ux
Open

feat(chat): optimistic echo and moderation delivery notices#19
ChronoFinale wants to merge 1 commit into
Balatro-Multiplayer:mainfrom
ChronoFinale:feat/chat-moderation-ux

Conversation

@ChronoFinale

@ChronoFinale ChronoFinale commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Client half of moderated chat. 78 lines, four files.

Optional. Without it chat still works and a refused message still shows the server's reason — you just lose the instant echo and the "what everyone else saw" notice. Server half: Balatro-Multiplayer/BalatroMultiplayerAPI-Server#44.

What a player sees

Your message appears the moment you press enter instead of after the round trip.

If it was refused, a notice below quotes the message it refers to and gives the server's reason:

You: that last blind went about as well as expected
[MultiplayerAPI] Not sent "that last blind went about...": Message was rejected by moderation

The quote matters — several sends can be in flight (fast typing, or a burst against the route's rate limiter), and an unattributed "not sent" tells you nothing about which one it refers to.

If moderation rewrote the message, a notice says what other players actually received, so a rewrite is never silent.

The api-client change

send_chat_message stops treating every non-2xx as player-facing copy. Only a decoded { error } body is a real reason; a proxy error page or a bare status is TRANSPORT now, so raw server text can't reach the chat overlay. It also passes the response body through, since a rewrite returns publishText.

Notes

  • Every string is ASCII and goes through localize(), following the existing [MultiplayerAPI] prefix convention.
  • No new endpoints. Works against the current server — the notices simply never fire until the moderation bridge is configured.
  • Built on main, so it includes the /say console behaviour and the report/mute work rather than conflicting with it.

Your message appears the moment you press enter rather than after the round
trip. If it was refused, a notice below quotes the message it refers to and
gives the server's reason - the quote matters because several sends can be in
flight, which is exactly what rate limiting produces. If moderation rewrote
it, a notice says what other players actually received, so a rewrite is never
silent.

The api client stops treating every non-2xx as player-facing copy: only a
decoded { error } body is a real reason. A proxy error page or a bare status
is a transport failure now, so raw server text cannot reach the chat overlay.
It also passes the response body through, since a rewrite returns publishText.

Needs the relay's moderation bridge to be configured to do anything: without
it the server never returns those reasons and the echo is all that changes.
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