553 lines
19 KiB
Go
553 lines
19 KiB
Go
package events
|
||
|
||
import "time"
|
||
|
||
type ChannelBanEvent struct {
|
||
// The user ID for the user who was banned on the specified channel.
|
||
UserID string `json:"user_id"`
|
||
|
||
// The user login for the user who was banned on the specified channel.
|
||
UserLogin string `json:"user_login"`
|
||
|
||
// The user display name for the user who was banned on the specified channel.
|
||
UserName string `json:"user_name"`
|
||
|
||
// The requested broadcaster ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The requested broadcaster login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The requested broadcaster display name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// The user ID of the issuer of the ban.
|
||
ModeratorUserID string `json:"moderator_user_id"`
|
||
|
||
// The user login of the issuer of the ban.
|
||
ModeratorUserLogin string `json:"moderator_user_login"`
|
||
|
||
// The user name of the issuer of the ban.
|
||
ModeratorUserName string `json:"moderator_user_name"`
|
||
|
||
// The reason behind the ban.
|
||
Reason string `json:"reason"`
|
||
|
||
// The UTC date and time (in RFC3339 format) of when the user was banned or put in a timeout.
|
||
BannedAt time.Time `json:"banned_at"`
|
||
|
||
// The UTC date and time (in RFC3339 format) of when the timeout ends.
|
||
// Is null if the user was banned instead of put in a timeout.
|
||
EndsAt *time.Time `json:"ends_at"`
|
||
|
||
// Indicates whether the ban is permanent (true) or a timeout (false). If true, ends_at will be null.
|
||
IsPermanent bool `json:"is_permanent"`
|
||
}
|
||
|
||
type ChannelChatClearEvent struct {
|
||
// The broadcaster user ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The broadcaster user login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The broadcaster user display name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
}
|
||
|
||
type ChannelChatClearUserMessagesEvent struct {
|
||
// The broadcaster user ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The broadcaster user login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The broadcaster user display name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// The ID of the user that was banned or put in a timeout. All of their messages are deleted.
|
||
TargetUserID string `json:"target_user_id"`
|
||
|
||
// The user name of the user that was banned or put in a timeout.
|
||
TargetUserName string `json:"target_user_name"`
|
||
|
||
// The user login of the user that was banned or put in a timeout.
|
||
TargetUserLogin string `json:"target_user_login"`
|
||
}
|
||
|
||
type Badge struct {
|
||
// An ID that identifies this set of chat badges. For example, Bits or Subscriber.
|
||
SetID string `json:"set_id"`
|
||
|
||
// An ID that identifies this version of the badge.
|
||
// The ID can be any value. For example, for Bits, the ID is the Bits tier level, but for World of Warcraft, it could be Alliance or Horde.
|
||
ID string `json:"id"`
|
||
|
||
// Contains metadata related to the chat badges in the badges tag.
|
||
// Currently, this tag contains metadata only for subscriber badges, to indicate the number of months the user has been a subscriber.
|
||
Info string `json:"info"`
|
||
}
|
||
|
||
type MessageData struct {
|
||
// The chat message in plain text.
|
||
Text string `json:"text"`
|
||
|
||
// Ordered list of chat message fragments.
|
||
Framgments []struct {
|
||
// The type of chat message fragment.
|
||
// Possible values:
|
||
//
|
||
// text, cheermote, emote, mention
|
||
Type string `json:"type"`
|
||
|
||
// Message text in fragment.
|
||
Text string `json:"text"`
|
||
|
||
// Metadata pertaining to the cheermote.
|
||
Cheermote *struct {
|
||
// The name portion of the Cheermote string that you use in chat to cheer Bits.
|
||
// The full Cheermote string is the concatenation of {prefix} + {number of Bits}.
|
||
// For example, if the prefix is “Cheer” and you want to cheer 100 Bits, the full Cheermote string is Cheer100.
|
||
// When the Cheermote string is entered in chat, Twitch converts it to the image associated with the Bits tier that was cheered.
|
||
Prefix string `json:"prefix"`
|
||
|
||
// The amount of bits cheered.
|
||
Bits int `json:"bits"`
|
||
|
||
// The tier level of the cheermote.
|
||
Tier int `json:"tier"`
|
||
} `json:"cheermote"`
|
||
|
||
// Metadata pertaining to the emote.
|
||
Emote *struct {
|
||
// An ID that uniquely identifies this emote.
|
||
ID string `json:"id"`
|
||
|
||
// An ID that identifies the emote set that the emote belongs to.
|
||
EmoteSetID string `json:"emote_set_id"`
|
||
|
||
// The ID of the broadcaster who owns the emote.
|
||
OwnerID string `json:"owner_id"`
|
||
|
||
// The formats that the emote is available in.
|
||
// For example, if the emote is available only as a static PNG, the array contains only static.
|
||
// But if the emote is available as a static PNG and an animated GIF, the array contains static and animated.
|
||
// The possible formats are:
|
||
//
|
||
// animated - An animated GIF is available for this emote.
|
||
//
|
||
// static - A static PNG file is available for this emote.
|
||
Format []string `json:"format"`
|
||
} `json:"emote"`
|
||
|
||
// Metadata pertaining to the mention.
|
||
Mention *struct {
|
||
// The user ID of the mentioned user.
|
||
UserID string `json:"user_id"`
|
||
|
||
// The user name of the mentioned user.
|
||
UserName string `json:"user_name"`
|
||
|
||
// The user login of the mentioned user.
|
||
UserLogin string `json:"user_login"`
|
||
} `json:"mention"`
|
||
}
|
||
}
|
||
|
||
type ChannelChatMessageEvent struct {
|
||
// The broadcaster user ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The broadcaster user login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The broadcaster user display name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// The user ID of the user that sent the message.
|
||
ChatterUserID string `json:"chatter_user_id"`
|
||
|
||
// The user name of the user that sent the message.
|
||
ChatterUserName string `json:"chatter_user_name"`
|
||
|
||
// The user login of the user that sent the message.
|
||
ChatterUserLogin string `json:"chatter_user_login"`
|
||
|
||
// A UUID that identifies the message.
|
||
MessageID string `json:"message_id"`
|
||
|
||
// The structured chat message.
|
||
Message MessageData `json:"message"`
|
||
|
||
// The type of message. Possible values:
|
||
//
|
||
// text, channel_points_highlighted, channel_points_sub_only, user_intro
|
||
MessageType string `json:"message_type"`
|
||
|
||
// List of chat badges.
|
||
Badges []Badge `json:"badges"`
|
||
|
||
// Metadata if this message is a cheer.
|
||
Cheer *struct {
|
||
// The amount of Bits the user cheered.
|
||
Bits int `json:"bits"`
|
||
}
|
||
|
||
// The color of the user’s name in the chat room.
|
||
// This is a hexadecimal RGB color code in the form, #<RGB>.
|
||
// This tag may be empty if it is never set.
|
||
Color string `json:"color"`
|
||
|
||
// Metadata if this message is a reply.
|
||
Reply *struct {
|
||
// An ID that uniquely identifies the parent message that this message is replying to.
|
||
ParentMessageID string `json:"parent_message_id"`
|
||
|
||
// The message body of the parent message.
|
||
ParentMessageBody string `json:"parent_message_body"`
|
||
|
||
// User ID of the sender of the parent message.
|
||
ParentUserID string `json:"parent_user_id"`
|
||
|
||
// User name of the sender of the parent message.
|
||
ParentUserName string `json:"parent_user_name"`
|
||
|
||
// User login of the sender of the parent message.
|
||
ParentUserLogin string `json:"parent_user_login"`
|
||
|
||
// An ID that identifies the parent message of the reply thread.
|
||
ThreadMessageID string `json:"thread_message_id"`
|
||
|
||
// User ID of the sender of the thread’s parent message.
|
||
ThreadUserID string `json:"thread_user_id"`
|
||
|
||
// User name of the sender of the thread’s parent message.
|
||
ThreadUserName string `json:"thread_user_name"`
|
||
|
||
// User login of the sender of the thread’s parent message.
|
||
ThreadUserLogin string `json:"thread_user_login"`
|
||
} `json:"reply"`
|
||
|
||
// The ID of a channel points custom reward that was redeemed.
|
||
ChannelPointsCustomRewardID *string `json:"channel_points_custom_reward_id"`
|
||
}
|
||
|
||
type ChannelChatMessageDeleteEvent struct {
|
||
// The broadcaster user ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The broadcaster user login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The broadcaster user display name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// The ID of the user whose message was deleted.
|
||
TargetUserID string `json:"target_user_id"`
|
||
|
||
// The user name of the user whose message was deleted.
|
||
TargetUserName string `json:"target_user_name"`
|
||
|
||
// The user login of the user whose message was deleted.
|
||
TargetUserLogin string `json:"target_user_login"`
|
||
|
||
// A UUID that identifies the message that was removed.
|
||
MessageID string `json:"message_id"`
|
||
}
|
||
|
||
type ChannelChatNotificationEvent struct {
|
||
// The broadcaster user ID.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The broadcaster user login.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The broadcaster user name.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// The user ID of the user that sent the message.
|
||
ChatterUserID string `json:"chatter_user_id"`
|
||
|
||
// The user login of the user that sent the message.
|
||
ChatterUserLogin string `json:"chatter_user_login"`
|
||
|
||
// The user name of the user that sent the message.
|
||
ChatterUserName string `json:"chatter_user_name"`
|
||
|
||
// Whether or not the chatter is anonymous.
|
||
ChatterIsAnonymous bool `json:"chatter_is_anonymous"`
|
||
|
||
// The color of the user's name in the chat room.
|
||
Color string `json:"color"`
|
||
|
||
// List of chat badges
|
||
Badges []Badge `json:"badges"`
|
||
|
||
// The message Twitch shows in the chat room for this notice.
|
||
SystemMessage string `json:"system_message"`
|
||
|
||
// A UUID that identifies the message.
|
||
MessageID string `json:"message_id"`
|
||
|
||
// The structured chat message.
|
||
Message MessageData `json:"message"`
|
||
|
||
// The type of notice.
|
||
// Possible values are:
|
||
//
|
||
// sub, resub, sub_gift, community_sub_gift, gift_paid_upgrade, raid, unraid, pay_it_forward, announcement, bits_badge_tier, charity_donation
|
||
NoticeType string `json:"notice_type"`
|
||
|
||
// Information about the sub event. Null if notice_type is not sub.
|
||
Sub *struct {
|
||
// The type of subscription plan being used. Possible values are:
|
||
//
|
||
// 1000 - First level of paid or Prime subscription.
|
||
//
|
||
// 2000 - Second level of paid subscription.
|
||
//
|
||
// 3000 - Third level of paid subscription.
|
||
SubTier string `json:"sub_tier"`
|
||
|
||
// Indicates if the subscription was obtained through Amazon Prime.
|
||
IsPrime bool `json:"is_prime"`
|
||
|
||
// The number of months the subscription is for.
|
||
DurationMonths int `json:"duration_months"`
|
||
} `json:"sub"`
|
||
|
||
// Information about the resub event. Null if notice_type is not resub.
|
||
Resub *struct {
|
||
// The total number of months the user has subscribed.
|
||
CumulativeMonths int `json:"cumulative_months"`
|
||
|
||
// The number of months the subscription is for.
|
||
DurationMonths int `json:"duration_months"`
|
||
|
||
// The total number of months the user has subscribed consecutively.
|
||
StreakMonths int `json:"streak_months"`
|
||
|
||
// The type of subscription plan being used. Possible values are:
|
||
//
|
||
// 1000 - First level of paid or Prime subscription.
|
||
//
|
||
// 2000 - Second level of paid subscription.
|
||
//
|
||
// 3000 - Third level of paid subscription.
|
||
SubTier string `json:"sub_tier"`
|
||
|
||
// Whether or not the resub was prime resub.
|
||
IsPrime bool `json:"is_prime"`
|
||
|
||
// Whether or not the resub was a result of a gift
|
||
IsGift bool `json:"is_gift"`
|
||
|
||
// Whether or not the gift was anonymous.
|
||
GifterIsAnonymous bool `json:"gifter_is_anonymous"`
|
||
|
||
// The user ID of the user who sent the gift.
|
||
GifterUserID string `json:"gifter_user_id"`
|
||
|
||
// The user login of the user who sent the gift.
|
||
GifterUserLogin string `json:"gifter_user_login"`
|
||
|
||
// The user name of the user who sent the gift.
|
||
GifterUserName string `json:"gifter_user_name"`
|
||
} `json:"resub"`
|
||
|
||
// Information about the gift sub event. Null if notice_type is not sub_gift.
|
||
SubGift *struct {
|
||
// The number of months the subscription is for.
|
||
DurationMonths int `json:"duration_months"`
|
||
|
||
// The amount of gifts the gifter has given in this channel. Null if anonymous.
|
||
CumulativeTotal *int `json:"cumulative_total"`
|
||
|
||
// The user ID of the subscription gift recipient.
|
||
RecipientUserID string `json:"recipient_user_id"`
|
||
|
||
// The user login of the subscription gift recipient.
|
||
RecipientUserLogin string `json:"recipient_user_login"`
|
||
|
||
// The user name of the subscription gift recipient.
|
||
RecipientUserName string `json:"recipient_user_name"`
|
||
|
||
// The type of subscription plan being used. Possible values are:
|
||
//
|
||
// 1000 - First level of paid or Prime subscription.
|
||
//
|
||
// 2000 - Second level of paid subscription.
|
||
//
|
||
// 3000 - Third level of paid subscription.
|
||
SubTier string `json:"sub_tier"`
|
||
|
||
// The ID of the associated community gift. Null if not associated with a community gift.
|
||
CommunityGiftID *string `json:"community_gift_id"`
|
||
} `json:"sub_gift"`
|
||
|
||
// Information about the community gift sub event. Null if notice_type is not community_sub_gift.
|
||
CommunitySubGift *struct {
|
||
// The ID of the associated community gift.
|
||
ID string `json:"id"`
|
||
|
||
// The number of subscriptions being gifted.
|
||
Total int `json:"total"`
|
||
|
||
// The type of subscription plan being used. Possible values are:
|
||
//
|
||
// 1000 - First level of paid or Prime subscription.
|
||
//
|
||
// 2000 - Second level of paid subscription.
|
||
//
|
||
// 3000 - Third level of paid subscription.
|
||
SubTier string `json:"sub_tier"`
|
||
|
||
// The amount of gifts the gifter has given in this channel. Null if anonymous.
|
||
CumulativeTotal *int `json:"cumulative_total"`
|
||
} `json:"community_sub_gift"`
|
||
|
||
// Information about the community gift paid upgrade event. Null if notice_type is not gift_paid_upgrade.
|
||
GiftPaidUpgrade *struct {
|
||
// Whether the gift was given anonymously.
|
||
GifterIsAnonymous bool `json:"gifter_is_anonymous"`
|
||
|
||
// The user ID of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserID *string `json:"gifter_user_id"`
|
||
|
||
// The user login of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserLogin *string `json:"gifter_user_login"`
|
||
|
||
// The user name of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserName *string `json:"gifter_user_name"`
|
||
} `json:"gift_paid_upgrade"`
|
||
|
||
// Information about the Prime gift paid upgrade event. Null if notice_type is not prime_paid_upgrade.
|
||
PrimePaidUpgrade *struct {
|
||
// The type of subscription plan being used. Possible values are:
|
||
//
|
||
// 1000 - First level of paid or Prime subscription.
|
||
//
|
||
// 2000 - Second level of paid subscription.
|
||
//
|
||
// 3000 - Third level of paid subscription.
|
||
SubTier string `json:"sub_tier"`
|
||
} `json:"prime_paid_upgrade"`
|
||
|
||
// Information about the raid event. Null if notice_type is not raid.
|
||
Raid *struct {
|
||
// The user ID of the broadcaster raiding this channel.
|
||
UserID string `json:"user_id"`
|
||
|
||
// The user name of the broadcaster raiding this channel.
|
||
UserName string `json:"user_name"`
|
||
|
||
// The user login of the broadcaster raiding this channel.
|
||
UserLogin string `json:"user_login"`
|
||
|
||
// The number of viewers raiding this channel from the broadcaster’s channel.
|
||
ViewerCount int `json:"viewer_count"`
|
||
|
||
// Profile image URL of the broadcaster raiding this channel.
|
||
ProfileImageURL string `json:"profile_image_url"`
|
||
} `json:"raid"`
|
||
|
||
// Returns an empty payload if notice_type is unraid, otherwise returns null.
|
||
Unraid *struct{} `json:"unraid"`
|
||
|
||
// Information about the pay it forward event. Null if notice_type is not pay_it_forward.
|
||
PayItForward *struct {
|
||
// Whether the gift was given anonymously.
|
||
GifterIsAnonymous bool `json:"gifter_is_anonymous"`
|
||
|
||
// The user ID of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserID *string `json:"gifter_user_id"`
|
||
|
||
// The user login of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserLogin *string `json:"gifter_user_login"`
|
||
|
||
// The user name of the user who gifted the subscription. Null if anonymous.
|
||
GifterUserName *string `json:"gifter_user_name"`
|
||
} `json:"pay_it_forward"`
|
||
|
||
// Information about the announcement event. Null if notice_type is not announcement.
|
||
Announcement *struct {
|
||
// Color of the announcement.
|
||
Color string `json:"color"`
|
||
} `json:"announcement"`
|
||
|
||
// Information about the charity donation event. Null if notice_type is not charity_donation.
|
||
CharityDonation *struct {
|
||
// Name of the charity.
|
||
CharityName string `json:"charity_name"`
|
||
|
||
// An object that contains the amount of money that the user paid.
|
||
Amount struct {
|
||
// The monetary amount. The amount is specified in the currency’s minor unit.
|
||
// For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550.
|
||
Value int `json:"value"`
|
||
|
||
// The number of decimal places used by the currency.
|
||
// For example, USD uses two decimal places.
|
||
DecimalPlace int `json:"decimal_place"`
|
||
|
||
// The ISO-4217 three-letter currency code that identifies the type of currency in value.
|
||
Currency string `json:"currency"`
|
||
} `json:"amount"`
|
||
} `json:"charity_donation"`
|
||
|
||
// Information about the bits badge tier event. Null if notice_type is not bits_badge_tier.
|
||
BitsBadgeTier *struct {
|
||
// The tier of the Bits badge the user just earned. For example, 100, 1000, or 10000.
|
||
Tier int `json:"tier"`
|
||
} `json:"bits_badge_tier"`
|
||
}
|
||
|
||
type ChannelChatSettingsUpdateEvent struct {
|
||
// The ID of the broadcaster specified in the request.
|
||
BroadcasterUserID string `json:"broadcaster_user_id"`
|
||
|
||
// The login of the broadcaster specified in the request.
|
||
BroadcasterUserLogin string `json:"broadcaster_user_login"`
|
||
|
||
// The user name of the broadcaster specified in the request.
|
||
BroadcasterUserName string `json:"broadcaster_user_name"`
|
||
|
||
// A Boolean value that determines whether chat messages must contain only emotes.
|
||
// True if only messages that are 100% emotes are allowed; otherwise false.
|
||
EmoteMode bool `json:"emote_mode"`
|
||
|
||
// A Boolean value that determines whether the broadcaster restricts the chat room to followers only, based on how long they’ve followed.
|
||
//
|
||
// True if the broadcaster restricts the chat room to followers only; otherwise false.
|
||
//
|
||
// See follower_mode_duration_minutes for how long the followers must have followed the broadcaster to participate in the chat room.
|
||
FollowerMode bool `json:"follower_mode"`
|
||
|
||
// The length of time, in minutes, that the followers must have followed the broadcaster to participate in the chat room. See follower_mode.
|
||
//
|
||
// Null if follower_mode is false.
|
||
FollowerModeDurationMinutes *int `json:"follower_mode_duration_minutes"`
|
||
|
||
// A Boolean value that determines whether the broadcaster limits how often users in the chat room are allowed to send messages.
|
||
//
|
||
// Is true, if the broadcaster applies a delay; otherwise, false.
|
||
//
|
||
// See slow_mode_wait_time_seconds for the delay.
|
||
SlowMode bool `json:"slow_mode"`
|
||
|
||
// The amount of time, in seconds, that users need to wait between sending messages. See slow_mode.
|
||
//
|
||
// Null if slow_mode is false.
|
||
SlowModeWaitTimeSeconds *int `json:"slow_mode_wait_time_seconds"`
|
||
|
||
// A Boolean value that determines whether only users that subscribe to the broadcaster’s channel can talk in the chat room.
|
||
//
|
||
// True if the broadcaster restricts the chat room to subscribers only; otherwise false.
|
||
SubscriberMode bool `json:"subscriber_mode"`
|
||
|
||
// A Boolean value that determines whether the broadcaster requires users to post only unique messages in the chat room.
|
||
//
|
||
// True if the broadcaster requires unique messages only; otherwise false.
|
||
UniqueChatMode bool `json:"unique_chat_mode"`
|
||
}
|