owncast-webhook/internal/web/webhook/owncast/message.go

48 lines
1.4 KiB
Go

package webhook
import (
"time"
)
type WebhookNewMessage struct {
Type string `json:"type"`
EventData Message `json:"eventData"`
}
type MessageUser struct {
Id string `json:"id"`
DisplayName string `json:"displayName"`
DisplayColor int32 `json:"displayColor"`
Authenticated bool `json:"authenticated"`
}
type Message struct {
Id string `json:"id"`
Visible bool `json:"visible"`
Date time.Time `json:"timestamp"`
Body string `json:"body"`
RawBody string `json:"rawBody"`
User MessageUser `json:"user"`
}
// {
// "type": "CHAT",
// "eventData": {
// "user": {
// "id": "qSRQpeM7R",
// "displayName": "lazyDaisy",
// "displayColor": 182,
// "createdAt": "2021-08-12T07:51:37.470812684Z",
// "previousNames": ["lazyDaisy"],
// "nameChangedAt": "2022-09-19T12:33:59.42313245+02:00",
// "isBot": false,
// "authenticated": false
// },
// "clientId": 2,
// "body": "hello world \u003cimg class=\"emoji\" alt=\":beerparrot:\" title=\":beerparrot:\" src=\"/img/emoji/beerparrot.gif\"\u003e",
// "rawBody": "hello world \u003cimg class=\"emoji\" alt=\":beerparrot:\" title=\":beerparrot:\" src=\"/img/emoji/beerparrot.gif\"\u003e",
// "id": "j-rXteG7R",
// "visible": true,
// "timestamp": "2021-08-12T07:53:12.061982913Z"
// }
// }