Added raid and sub fields to chat view
This commit is contained in:
parent
3818644bb0
commit
a4125e8de8
21
chat.go
21
chat.go
|
@ -258,6 +258,15 @@ type ChatEventBlock struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ChatEventNotification struct {
|
||||||
|
Badge string `json:"badge"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChatEventRaidNotification struct {
|
||||||
|
StartTs int64 `json:"start_ts"`
|
||||||
|
}
|
||||||
|
|
||||||
type ChatEventRant struct {
|
type ChatEventRant struct {
|
||||||
Duration int `json:"duration"`
|
Duration int `json:"duration"`
|
||||||
ExpiresOn string `json:"expires_on"`
|
ExpiresOn string `json:"expires_on"`
|
||||||
|
@ -268,6 +277,8 @@ type ChatEventMessage struct {
|
||||||
Blocks []ChatEventBlock `json:"blocks"`
|
Blocks []ChatEventBlock `json:"blocks"`
|
||||||
ChannelID *int64 `json:"channel_id"`
|
ChannelID *int64 `json:"channel_id"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
Notification *ChatEventNotification `json:"notification"`
|
||||||
|
RaidNotification *ChatEventRaidNotification `json:"raid_notification"`
|
||||||
Rant *ChatEventRant `json:"rant"`
|
Rant *ChatEventRant `json:"rant"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
Time string `json:"time"`
|
Time string `json:"time"`
|
||||||
|
@ -392,7 +403,9 @@ type ChatView struct {
|
||||||
ImageUrl string
|
ImageUrl string
|
||||||
Init bool
|
Init bool
|
||||||
IsFollower bool
|
IsFollower bool
|
||||||
|
Raid bool
|
||||||
Rant int
|
Rant int
|
||||||
|
Sub bool
|
||||||
Text string
|
Text string
|
||||||
Time time.Time
|
Time time.Time
|
||||||
Type string
|
Type string
|
||||||
|
@ -456,9 +469,17 @@ func parseMessages(eventType string, messages []ChatEventMessage, users map[stri
|
||||||
view.Color = user.Color
|
view.Color = user.Color
|
||||||
view.ImageUrl = user.Image1
|
view.ImageUrl = user.Image1
|
||||||
view.IsFollower = user.IsFollower
|
view.IsFollower = user.IsFollower
|
||||||
|
if message.RaidNotification != nil {
|
||||||
|
view.Raid = true
|
||||||
|
}
|
||||||
if message.Rant != nil {
|
if message.Rant != nil {
|
||||||
view.Rant = message.Rant.PriceCents
|
view.Rant = message.Rant.PriceCents
|
||||||
}
|
}
|
||||||
|
if message.Notification != nil {
|
||||||
|
if message.Notification.Badge == ChatBadgeRecurringSubscription {
|
||||||
|
view.Sub = true
|
||||||
|
}
|
||||||
|
}
|
||||||
view.Text = message.Text
|
view.Text = message.Text
|
||||||
t, err := time.Parse(time.RFC3339, message.Time)
|
t, err := time.Parse(time.RFC3339, message.Time)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue