The site-wide chat lets signed-in users talk live. This module types one of its messages, as the server sends it to the chatbox.
Returned by GET /api/chat, and sent by the server in chat_message and
chat_message_updated. The client reads it through
deserializeChatMessage, which turns its dates back into Dates.
- authorAvatarMime: string
- authorUsername: string
-
body: string
In Markdown, trimmed by the server.
- createdAt: Date
- id: string
-
mentionsEveryone: boolean
Set when the body says
@everyoneand its author's role hadchat:everyonewhen it was last written; absent otherwise. The client highlights the message for everyone and shows@everyoneas a mention by it, never by the text, which anyone may type. - replyToAuthor: string
-
replyToBody: string
The first 300 characters of the replied-to body, in Markdown.
-
replyToId: string
Kept when the message it points to is deleted, while
replyToAuthorandreplyToBodythen go absent. -
updatedAt: Date
Absent until the first edit.
- userId: string
Usage
import * as mod from "shared/chat.ts";