add twitch API stuff, add follow/sub/cheer labels
This commit is contained in:
parent
8a7210ad56
commit
626540e728
17 changed files with 1143 additions and 3 deletions
52
twitch/api/api.go
Normal file
52
twitch/api/api.go
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package api
|
||||
|
||||
type (
|
||||
EventSubMetadata struct {
|
||||
MessageID string `json:"message_id"`
|
||||
MessageType string `json:"message_type"`
|
||||
MessageTimestamp string `json:"message_timestamp"`
|
||||
}
|
||||
|
||||
EventSubSession struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
KeepaliveTimeoutSeconds int `json:"keepalive_timeout_seconds"`
|
||||
ReconnectURL string `json:"reconnect_url"`
|
||||
ConnectedAt string `json:"connected_at"`
|
||||
}
|
||||
|
||||
EventSubSubscriptionTransport struct {
|
||||
Method string `json:"method"`
|
||||
SessionID string `json:"session_id"`
|
||||
}
|
||||
EventSubSubscription struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Version string `json:"version"`
|
||||
Cost int `json:"cost"`
|
||||
Condition any `json:"condition"`
|
||||
Transport EventSubSubscriptionTransport `json:"transport"`
|
||||
CreatedAt string `json:"connected_at"`
|
||||
}
|
||||
|
||||
EventSubPayload struct {
|
||||
Session *EventSubSession `json:"session"`
|
||||
Subscription *EventSubSubscription `json:"subscription"`
|
||||
Event any `json:"event"`
|
||||
}
|
||||
|
||||
EventSubMessage struct {
|
||||
Metadata EventSubMetadata `json:"metadata"`
|
||||
Payload EventSubPayload `json:"payload"`
|
||||
}
|
||||
)
|
||||
|
||||
type MessageType string
|
||||
const (
|
||||
SESSION_WELCOME MessageType = "session_welcome"
|
||||
SESSION_KEEPALIVE MessageType = "session_keepalive"
|
||||
NOTIFICATION MessageType = "notification"
|
||||
SESSION_RECONNECT MessageType = "session_reconnect"
|
||||
SESSION_RECOVATION MessageType = "session_revocation"
|
||||
)
|
||||
177
twitch/api/event.go
Normal file
177
twitch/api/event.go
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
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"`
|
||||
}
|
||||
|
||||
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"`
|
||||
Text string `json:"text"`
|
||||
Cheermote *ChatMessageCheermote `json:"cheermote"`
|
||||
Emote *ChatMessageEmote `json:"emote"`
|
||||
Mention *ChatMessageMention `json:"mention"`
|
||||
Gif *ChatMessageGif `json:"gif"`
|
||||
}
|
||||
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"`
|
||||
MessageType string `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"`
|
||||
}
|
||||
|
||||
ChatDeleteEvent 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"`
|
||||
|
||||
MessageID string `json:"message_id"`
|
||||
}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue