package chat import ( "git.sr.ht/~ashkeel/strimertul/database" "go.uber.org/zap" ) // WriteMessageRequest is an RPC to send a chat message with extra options type WriteMessageRequest struct { Message string `json:"message" desc:"Chat message to send"` ReplyTo string `json:"reply_to,omitempty" desc:"If specified, send as reply to a message ID"` WhisperTo string `json:"whisper_to,omitempty" desc:"If specified, send as whisper to user ID"` Announce bool `json:"announce" desc:"If true, send as announcement"` } func WriteMessage(db database.Database, logger *zap.Logger, m WriteMessageRequest) { err := db.PutJSON(WriteMessageRPC, m) if err != nil { logger.Error("Failed to write chat message", zap.Error(err)) } }