owncast/models/chatMessage.go

22 lines
541 B
Go
Raw Normal View History

package models
2020-05-24 02:57:49 +02:00
2020-07-12 04:08:47 +02:00
import "time"
//ChatMessage represents a single chat message
type ChatMessage struct {
ClientID string `json:"-"`
2020-07-12 04:08:47 +02:00
Author string `json:"author"`
Body string `json:"body"`
Image string `json:"image"`
ID string `json:"id"`
MessageType string `json:"type"`
2020-07-12 23:53:33 +02:00
Visible bool `json:"visible"`
2020-07-12 04:08:47 +02:00
Timestamp time.Time `json:"timestamp"`
2020-05-24 02:57:49 +02:00
}
//Valid checks to ensure the message is valid
func (s ChatMessage) Valid() bool {
return s.Author != "" && s.Body != "" && s.ID != ""
}