backend for twitch chat widgets

This commit is contained in:
ari melody 2026-09-02 22:32:45 +01:00
parent 09c11f11a1
commit 28b9492cb3
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
11 changed files with 725 additions and 94 deletions

View file

@ -22,6 +22,24 @@ type (
IsGift bool `json:"is_gift"`
}
SubscribeMessageEmote struct {
Begin int `json:"begin"`
End int `json:"end"`
ID string `json:"id"`
}
SubscribeMessageContent struct {
Text string `json:"text"`
Emotes []SubscribeMessageEmote `json:"emotes"`
}
SubscribeMessageEvent struct {
ChannelEvent
Tier string `json:"tier"`
Message SubscribeMessageContent `json:"message"`
CumulativeMonths int `json:"cumulative_months"`
StreakMonths int `json:"streak_months"`
DurationMonths int `json:"duration_months"`
}
CheerEvent struct {
ChannelEvent
Message string `json:"message"`
@ -97,11 +115,11 @@ type (
}
ChatMessageFragment struct {
Type string `json:"type"`
Text string `json:"text"`
Cheermote *ChatMessageCheermote `json:"cheermote"`
Emote *ChatMessageEmote `json:"emote"`
Mention *ChatMessageMention `json:"mention"`
Gif *ChatMessageGif `json:"gif"`
Text string `json:"text,omitempty"`
Cheermote *ChatMessageCheermote `json:"cheermote,omitempty"`
Emote *ChatMessageEmote `json:"emote,omitempty"`
Mention *ChatMessageMention `json:"mention,omitempty"`
Gif *ChatMessageGif `json:"gif,omitempty"`
}
ChatMessage struct {
Text string `json:"text"`
@ -143,7 +161,7 @@ type (
MessageID string `json:"message_id"`
Message ChatMessage `json:"message"`
MessageType string `json:"message_type"`
MessageType ChatMessageType `json:"message_type"`
Badges []ChatBadge `json:"badges"`
Cheer *ChatCheer `json:"cheer"`
@ -163,7 +181,7 @@ type (
IsSourceOnly bool `json:"is_source_only"`
}
ChatDeleteEvent struct {
ChatClearUserMessagesEvent struct {
BroadcasterID string `json:"broadcaster_user_id"`
BroadcasterLogin string `json:"broadcaster_user_login"`
BroadcasterName string `json:"broadcaster_user_name"`
@ -171,7 +189,54 @@ type (
TargetID string `json:"target_user_id"`
TargetLogin string `json:"target_user_login"`
TargetName string `json:"target_user_name"`
}
ChatDeleteEvent struct {
ChatClearUserMessagesEvent
MessageID string `json:"message_id"`
}
ChatAnnouncement struct {
Color string `json:"color"`
}
CharityDonationAmount struct {
Value int `json:"value"`
DecimalPlace int `json:"decimal_place"`
Currency string `json:"currency"`
}
CharityDonation struct {
CharityName string `json:"charity_name"`
Amount CharityDonationAmount `json:"amount"`
}
WatchStreak struct {
StreakCount int `json:"streak_count"`
ChannelPointsAwarded int `json:"channel_points_awarded"`
}
Modiversary struct {
Months int `json:"months"`
}
ChatNotificationEvent struct {
BroadcasterID string `json:"broadcaster_user_id"`
BroadcasterLogin string `json:"broadcaster_user_login"`
BroadcasterName string `json:"broadcaster_user_name"`
ChatterID string `json:"chatter_user_id"`
ChatterName string `json:"chatter_user_name"`
ChatterIsAnonymous bool `json:"chatter_is_anonymous"`
Color string `json:"color"`
Badges []ChatBadge `json:"badges"`
// The message Twitch shows in the chat room for this notice.
SystemMessage string `json:"system_message"`
MessageID string `json:"message_id"`
Message ChatMessage `json:"message"`
NoticeType ChatNoticeType `json:"notice_type"`
Announcement ChatAnnouncement `json:"announcement"`
CharityDonation CharityDonation `json:"charity_donation"`
WatchStreak WatchStreak `json:"watch_streak"`
Modiversary Modiversary `json:"modiversary"`
}
)