package sneed // SneedPayload represents a full incoming WS payload. // Siropu Chat can send one message, multiple messages, // edits, deletes, or system events in a single payload. type SneedPayload struct { Type string `json:"type"` // "message", "edit", "delete", etc. Room int `json:"room"` // chat room ID Delete interface{} `json:"delete"` // can be int or []int Message *SneedMessage `json:"message"` // single message Messages []SneedMessage `json:"messages"` // batch User map[string]any `json:"user"` // sometimes present System string `json:"system"` // system messages Join string `json:"join"` // join notifications Leave string `json:"leave"` // leave notifications EventID string `json:"event_id"` // may exist for replies Timestamp int64 `json:"timestamp"` // unix timestamp } // SneedMessage represents an actual user message // as delivered by Siropu Chat's backend via WS. type SneedMessage struct { MessageID int `json:"id"` Message string `json:"message"` MessageRaw string `json:"message_raw"` Author map[string]interface{} `json:"author"` // contains: id, username, avatar, group, etc. Deleted bool `json:"deleted"` IsDeleted bool `json:"is_deleted"` MessageEditDate int `json:"edit_date"` // unix timestamp (0 if not edited) RoomID int `json:"room_id"` IPID int `json:"ipid"` // internal Siropu user/visitor ID } // Convenience structures for fast handlers. // These are used only after we split out the type. type IncomingMessage struct { ID int `json:"id"` UserID int `json:"user_id"` Username string `json:"username"` Message string `json:"message"` } type IncomingEdit struct { ID int `json:"id"` UserID int `json:"user_id"` Message string `json:"message"` } type IncomingDelete struct { ID int `json:"id"` UserID int `json:"user_id"` }