-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.go
148 lines (122 loc) · 3.27 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package youtubelive
import (
"fmt"
"time"
)
type LiveEvent interface {
ID() string
}
type BotEvent interface {
}
type AuthorDetails struct {
ChannelId string `json:"channelId,omitempty"`
ChannelUrl string `json:"channelUrl,omitempty"`
DisplayName string `json:"displayName,omitempty"`
IsChatModerator bool `json:"isChatModerator,omitempty"`
IsChatOwner bool `json:"isChatOwner,omitempty"`
IsChatSponsor bool `json:"isChatSponsor,omitempty"`
IsVerified bool `json:"isVerified,omitempty"`
ProfileImageUrl string `json:"profileImageUrl,omitempty"`
}
type ChatMessageEvent struct {
Message string
DisplayName string
AuthorDetails AuthorDetails
Timestamp time.Time
NextPageToken string
}
func (c ChatMessageEvent) ID() string {
return fmt.Sprintf("chat-%s-%d", c.DisplayName, c.Timestamp.UnixNano())
}
type SuperChatEvent struct {
Message string
Amount float64
Currency string
DisplayName string
AuthorDetails AuthorDetails
Timestamp time.Time
NextPageToken string
}
func (s SuperChatEvent) ID() string {
return fmt.Sprintf("superchat-%s-%d", s.DisplayName, s.Timestamp.UnixNano())
}
type SuperStickerEvent struct {
StickerID string
Amount float64
Currency string
DisplayName string
AuthorDetails AuthorDetails
Timestamp time.Time
NextPageToken string
}
func (s SuperStickerEvent) ID() string {
return fmt.Sprintf("sticker-%s-%d", s.DisplayName, s.Timestamp.UnixNano())
}
type MemberMilestoneEvent struct {
DisplayName string
AuthorDetails AuthorDetails
Level string // "new", "returning", "creator"
Timestamp time.Time
NextPageToken string
Months int
}
func (s MemberMilestoneEvent) ID() string {
return fmt.Sprintf("join-%s-%d", s.DisplayName, s.Timestamp.UnixNano())
}
type MembershipGiftEvent struct {
DisplayName string
AuthorDetails AuthorDetails
Total int
Tier string
Timestamp time.Time
NextPageToken string
}
func (s MembershipGiftEvent) ID() string {
return fmt.Sprintf("gift-%s-%d", s.DisplayName, s.Timestamp.UnixNano())
}
type ChatEndedEvent struct {
Timestamp time.Time
NextPageToken string
}
func (s ChatEndedEvent) ID() string {
return fmt.Sprintf("end-%d", s.Timestamp.UnixNano())
}
type StreamEndEvent struct{}
func (s StreamEndEvent) ID() string {
return "stream-end"
}
type BotChatMessage struct {
Message string
}
type BotDeleteMessage struct {
MessageID string
}
type UserBannedEvent struct {
BannedUserID string
BanType string // "permanent" or "temporary"
Duration time.Duration
ModeratorID string
Timestamp time.Time
NextPageToken string
BannedUserDisplayName string
ModeratorDisplayName string
}
func (u UserBannedEvent) ID() string {
return fmt.Sprintf("ban-%s-%s-%d", u.ModeratorID, u.BannedUserID, u.Timestamp.Unix())
}
type MembershipGiftReceivedEvent struct {
DisplayText string
Level string
GifterID string
Timestamp time.Time
}
func (m MembershipGiftReceivedEvent) ID() string {
return fmt.Sprintf("giftreceived-%s-%d", m.GifterID, m.Timestamp.Unix())
}
type ErrorEvent struct {
Timestamp time.Time
Error error
}
func (e ErrorEvent) ID() string {
return fmt.Sprintf("error-%d", e.Timestamp.Unix())
}