Files
gerbeur/shared/chat.ts

36 lines
1.0 KiB
TypeScript

/**
* A message of the site-wide chat.
*
* @module
*/
/** A chat message, with what the chat shows of its author and its reply. */
export interface ChatMessage {
/** The message's id. */
id: string;
/** The author's id. */
userId: string;
/** The message, in Markdown. */
body: string;
/** When the message was sent. */
createdAt: Date;
/** When the message was last edited, if ever. */
updatedAt?: Date;
/** The author's name. */
authorUsername: string;
/** The author's avatar type, undefined without one. */
authorAvatarMime?: string;
/**
* Id of the message this one replies to, if any. Retained even when the
* target is later deleted (the preview fields below then go undefined).
*/
replyToId?: string;
/**
* Author of the replied-to message, for a subtle inline reference. Absent
* when there's no reply, or the target has since been deleted.
*/
replyToAuthor?: string;
/** Body of the replied-to message, absent under the same conditions. */
replyToBody?: string;
}