2020-05-24 02:57:49 +02:00
|
|
|
package main
|
|
|
|
|
2020-06-15 01:44:38 +02:00
|
|
|
type ChatMessage struct {
|
|
|
|
Author string `json:"author"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Image string `json:"image"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
MessageType string `json:"type"`
|
2020-05-24 02:57:49 +02:00
|
|
|
}
|
|
|
|
|
2020-06-15 01:44:38 +02:00
|
|
|
func (s *ChatMessage) AsJson() string {
|
|
|
|
return s.Author + " says " + s.Body
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *ChatMessage) String() string {
|
|
|
|
return s.Author + " says " + s.Body
|
|
|
|
}
|
|
|
|
|
|
|
|
type PingMessage struct {
|
|
|
|
MessageType string `json:"type"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *PingMessage) AsJson() string {
|
|
|
|
return "{type: \"PING\"}"
|
2020-05-24 02:57:49 +02:00
|
|
|
}
|