stream-tools/twitch/api/event.go

243 lines
7 KiB
Go
Raw Normal View History

package api
type (
ChannelEvent struct {
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
BroadcasterID string `json:"broadcaster_user_id"`
BroadcasterLogin string `json:"broadcaster_user_login"`
BroadcasterName string `json:"broadcaster_user_name"`
}
FollowEvent struct {
ChannelEvent
FollowedAt string `json:"followed_at"`
}
SubscribeEvent struct {
ChannelEvent
Tier string `json:"tier"`
IsGift bool `json:"is_gift"`
}
2026-09-02 22:32:45 +01:00
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"`
Bits int `json:"bits"`
IsAnonymous bool `json:"is_anonymous"`
}
RaidEvent struct {
FromUserID string `json:"from_broadcaster_user_id"`
FromUserLogin string `json:"from_broadcaster_user_login"`
FromUserName string `json:"from_broadcaster_user_name"`
ToUserID string `json:"to_broadcaster_user_id"`
ToUserLogin string `json:"to_broadcaster_user_login"`
ToUserName string `json:"to_broadcaster_user_name"`
Viewers int `json:"viewers"`
}
Reward struct {
ID string `json:"id"`
Title string `json:"title"`
Cost int `json:"cost"`
Prompt string `json:"prompt"`
}
ChannelPointCustomRewardRedeemEvent struct {
ChannelEvent
ID string `json:"id"`
UserInput string `json:"user_input"`
Status string `json:"status"`
RedeemedAt string `json:"redeemed_at"`
Reward Reward `json:"reward"`
}
ShoutoutCreate struct {
FromUserID string `json:"broadcaster_user_id"`
FromUserLogin string `json:"broadcaster_user_login"`
FromUserName string `json:"broadcaster_user_name"`
ToUserID string `json:"to_broadcaster_user_id"`
ToUserLogin string `json:"to_broadcaster_user_login"`
ToUserName string `json:"to_broadcaster_user_name"`
ModeratorID string `json:"moderator_broadcaster_user_id"`
ModeratorLogin string `json:"moderator_broadcaster_user_login"`
ModeratorName string `json:"moderator_broadcaster_user_name"`
ViewerCount int `json:"viewer_count"`
StartedAt string `json:"started_at"`
CooldownEndsAt string `json:"cooldown_ends_at"`
TargetCooldownEndsAt string `json:"target_cooldown_ends_at"`
}
ChatMessageCheermote struct {
Prefix string `json:"prefix"`
Bits int `json:"bits"`
Tier int `json:"tier"`
}
ChatMessageEmote struct {
ID string `json:"id"`
EmoteSetID string `json:"emote_set_id"`
OwnerID string `json:"owner_id"`
Format []string `json:"format"`
}
ChatMessageMention struct {
UserID string `json:"user_id"`
UserLogin string `json:"user_login"`
UserName string `json:"user_name"`
}
ChatMessageGif struct {
GifID string `json:"gif_id"`
Url string `json:"url"`
}
ChatMessageFragment struct {
Type string `json:"type"`
2026-09-02 22:32:45 +01:00
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"`
Fragments []ChatMessageFragment `json:"fragments"`
}
ChatBadge struct {
SetID string `json:"set_id"`
ID string `json:"id"`
Info string `json:"info"`
}
ChatCheer struct {
Bits int `json:"bits"`
}
ChatReply struct {
ParentMessageID string `json:"parent_message_id"`
ParentMessageBody string `json:"parent_message_body"`
ParentUserID string `json:"parent_user_id"`
ParentUserLogin string `json:"parent_user_login"`
ParentUserName string `json:"parent_user_name"`
ThreadMessageID string `json:"thread_message_id"`
ThreadUserID string `json:"thread_user_id"`
ThreadUserLogin string `json:"thread_user_login"`
ThreadUserName string `json:"thread_user_name"`
}
SourceBadges struct {
SetID string `json:"set_id"`
ID string `json:"id"`
Info string `json:"info"`
}
ChatEvent 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"`
ChatterLogin string `json:"chatter_user_login"`
ChatterName string `json:"chatter_user_name"`
MessageID string `json:"message_id"`
Message ChatMessage `json:"message"`
2026-09-02 22:32:45 +01:00
MessageType ChatMessageType `json:"message_type"`
Badges []ChatBadge `json:"badges"`
Cheer *ChatCheer `json:"cheer"`
Color string `json:"color"`
Reply *ChatReply `json:"reply"`
ChannelPointsCustomRewardID string `json:"channel_points_custom_reward_id"`
SourceBroadcasterUserID string `json:"source_broadcaster_user_id"`
SourceBroadcasterUserName string `json:"source_broadcaster_user_name"`
SourceBroadcasterUserLogin string `json:"source_broadcaster_user_login"`
SourceMessageID string `json:"source_message_id"`
SourceBadges *SourceBadges `json:"source_badges"`
IsSourceOnly bool `json:"is_source_only"`
}
2026-09-02 22:32:45 +01:00
ChatClearUserMessagesEvent struct {
BroadcasterID string `json:"broadcaster_user_id"`
BroadcasterLogin string `json:"broadcaster_user_login"`
BroadcasterName string `json:"broadcaster_user_name"`
TargetID string `json:"target_user_id"`
TargetLogin string `json:"target_user_login"`
TargetName string `json:"target_user_name"`
2026-09-02 22:32:45 +01:00
}
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"`
2026-09-02 22:32:45 +01:00
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"`
}
)