diff --git a/api/chat/get_user_emotes.go b/api/chat/get_user_emotes.go new file mode 100644 index 0000000..cc8fddc --- /dev/null +++ b/api/chat/get_user_emotes.go @@ -0,0 +1,106 @@ +package chat + +import "go.fifitido.net/twitch/api/types" + +type GetUserEmotesParams struct { + // The ID of the user. This ID must match the user ID in the user access token. + UserID string `url:"user_id"` + + // The cursor used to get the next page of results. The Pagination object in the response contains the cursor’s value. + After *types.Cursor `url:"after"` + + // The User ID of a broadcaster you wish to get follower emotes of. + // Using this query parameter will guarantee inclusion of the broadcaster’s follower emotes in the response body. + // + // Note: If the user specified in user_id is subscribed to the broadcaster specified, + // their follower emotes will appear in the response body regardless if this query parameter is used. + BroadcasterID *string `url:"broadcaster_id"` +} + +type GetUserEmotesResponse struct { + // A list that contains information about the user’s emotes. + Data []GetUserEmotesResponseData `json:"data"` + + // A templated URL. Uses the values from the id, format, scale, and theme_mode fields + // to replace the like-named placeholder strings in the templated URL to create a + // CDN (content delivery network) URL that you use to fetch the emote. + // + // For information about what the template looks like and how to use it to fetch emotes, + // see Emote CDN URL format: https://dev.twitch.tv/docs/irc/emotes#cdn-template + Template string `json:"template"` + + // Contains the information used to page through the list of results. + // The object is empty if there are no more pages left to page through. + // + // For more information about pagination support, + // see Twitch API Guide - Pagination: https://dev.twitch.tv/docs/api/guide/#pagination + Pagination types.Pagination `json:"pagination"` +} + +type GetUserEmotesResponseData struct { + // An ID that uniquely identifies this emote. + ID string `json:"id"` + + // The name of the emote + Name string `json:"name"` + + // The type of emote. The possible values are: + // + // none — No emote type was assigned to this emote. + // + // bitstier — A Bits tier emote. + // + // follower — A follower emote. + // + // subscriptions — A subscriber emote. + // + // channelpoints — An emote granted by using channel points. + // + // rewards — An emote granted to the user through a special event. + // + // hypetrain — An emote granted for participation in a Hype Train. + // + // prime — An emote granted for linking an Amazon Prime account. + // + // turbo — An emote granted for having Twitch Turbo. + // + // smilies — Emoticons supported by Twitch. + // + // globals — An emote accessible by everyone. + // + // owl2019 — Emotes related to Overwatch League 2019. + // + // twofactor — Emotes granted by enabling two-factor authentication on an account. + // + // limitedtime — Emotes that were granted for only a limited time. + EmoteType string `json:"emote_type"` + + // 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. + // + // animated — An animated GIF is available for this emote. + // + // static — A static PNG file is available for this emote. + Format []string `json:"format"` + + // The sizes that the emote is available in. + // For example, if the emote is available in small and medium sizes, the array contains 1.0 and 2.0. + // + // 1.0 — A small version (28px x 28px) is available. + // + // 2.0 — A medium version (56px x 56px) is available. + // + // 3.0 — A large version (112px x 112px) is available. + Scale []string `json:"scale"` + + // The background themes that the emote is available in. + // Possible values: dark, light + ThemeMode []string `json:"theme_mode"` +} diff --git a/api/eventsub/models.go b/api/eventsub/models.go index 5a181f5..a0f1f84 100644 --- a/api/eventsub/models.go +++ b/api/eventsub/models.go @@ -8,12 +8,8 @@ type Subscription struct { // An ID that identifies the subscription. ID string `json:"id"` - // The subscription’s status. The subscriber receives events only for enabled subscriptions. Possible values are: - // - // enabled — The subscription is enabled. - // - // webhook_callback_verification_pending — The subscription is pending verification of the specified callback URL (see Responding to a challenge request). - Status string `json:"status"` + // The subscription’s status. The subscriber receives events only for enabled subscriptions. + Status Status `json:"status"` // The subscription’s type. // See Subscription Types: https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#subscription-types @@ -44,53 +40,59 @@ type Status string const ( // enabled — The subscription is enabled. - StatusEnabled = "enabled" + StatusEnabled Status = "enabled" // webhook_callback_verification_pending — The subscription is pending verification of the specified callback URL. - StatusWebhookCallbackVerificationPending = "webhook_callback_verification_pending" + StatusWebhookCallbackVerificationPending Status = "webhook_callback_verification_pending" // webhook_callback_verification_failed — The specified callback URL failed verification. - StatusWebhookCallbackVerificationFailed = "webhook_callback_verification_failed" + StatusWebhookCallbackVerificationFailed Status = "webhook_callback_verification_failed" // notification_failures_exceeded — The notification delivery failure rate was too high. - NotificationFailuresExceeded = "notification_failures_exceeded" + StatusNotificationFailuresExceeded Status = "notification_failures_exceeded" // authorization_revoked — The authorization was revoked for one or more users specified in the Condition object. - AuthorizationRevoked = "authorization_revoked" + StatusAuthorizationRevoked Status = "authorization_revoked" // moderator_removed — The moderator that authorized the subscription is no longer one of the broadcaster's moderators. - ModeratorRemoved = "moderator_removed" + StatusModeratorRemoved Status = "moderator_removed" // user_removed — One of the users specified in the Condition object was removed. - UserRemoved = "user_removed" + StatusUserRemoved Status = "user_removed" + + // chat_user_banned - The user specified in the Condition object was banned from the broadcaster's chat. + StatusChatUserBanned Status = "chat_user_banned" // version_removed — The subscription to subscription type and version is no longer supported. - VersionRemoved = "version_removed" + StatusVersionRemoved Status = "version_removed" // beta_maintenance — The subscription to the beta subscription type was removed due to maintenance. - BetaMaintenance = "beta_maintenance" + StatusBetaMaintenance Status = "beta_maintenance" // websocket_disconnected — The client closed the connection. - WebsocketDisconnected = "websocket_disconnected" + StatusWebsocketDisconnected Status = "websocket_disconnected" // websocket_failed_ping_pong — The client failed to respond to a ping message. - WebsocketFailedPingPong = "websocket_failed_ping_pong" + StatusWebsocketFailedPingPong Status = "websocket_failed_ping_pong" // websocket_received_inbound_traffic — The client sent a non-pong message. // Clients may only send pong messages (and only in response to a ping message). - WebsocketReceivedInboundTraffic = "websocket_received_inbound_traffic" + StatusWebsocketReceivedInboundTraffic Status = "websocket_received_inbound_traffic" // websocket_connection_unused — The client failed to subscribe to events within the required time. - WebsocketConnectionUnused = "websocket_connection_unused" + StatusWebsocketConnectionUnused Status = "websocket_connection_unused" // websocket_internal_error — The Twitch WebSocket server experienced an unexpected error. - WebsocketInternalError = "websocket_internal_error" + StatusWebsocketInternalError Status = "websocket_internal_error" // websocket_network_timeout — The Twitch WebSocket server timed out writing the message to the client. - WebsocketNetworkTimeout = "websocket_network_timeout" + StatusWebsocketNetworkTimeout Status = "websocket_network_timeout" // websocket_network_error — The Twitch WebSocket server experienced a network error writing the message to the client. - WebsocketnetworkError = "websocket_network_error" + StatusWebsocketnetworkError Status = "websocket_network_error" + + // websocket_failed_to_reconnect - The client failed to reconnect to the Twitch WebSocket server within the required time after a Reconnect Message. + StatusWebsocketFailedToReconnect Status = "websocket_failed_to_reconnect" ) type Transport struct { @@ -161,61 +163,219 @@ type SubscriptionType struct { } var ( - ChannelUpdate = SubscriptionType{Name: "channel.update", Version: "2"} - ChannelFollow = SubscriptionType{Name: "channel.follow", Version: "2"} - ChannelAdBreakBegin = SubscriptionType{Name: "channel.ad_break_begin", Version: "1"} - ChannelChatClear = SubscriptionType{Name: "channel.chat.clear", Version: "1"} - ChannelChatClearUserMessages = SubscriptionType{Name: "channel.chat.clear_user_messages", Version: "1"} - ChannelChatMessage = SubscriptionType{Name: "channel.chat.message", Version: "1"} - ChannelChatMessageDelete = SubscriptionType{Name: "channel.chat.message_delete", Version: "1"} - ChannelChatNotification = SubscriptionType{Name: "channel.chat.notification", Version: "1"} - ChannelChatSettingsUpdate = SubscriptionType{Name: "channel.chat_settings.update", Version: "beta"} - ChannelSubscribe = SubscriptionType{Name: "channel.subscribe", Version: "1"} - ChannelSubscriptionEnd = SubscriptionType{Name: "channel.subscription.end", Version: "1"} - ChannelSubscriptionGift = SubscriptionType{Name: "channel.subscription.gift", Version: "1"} - ChannelSubscriptionMessage = SubscriptionType{Name: "channel.subscription.message", Version: "1"} - ChannelCheer = SubscriptionType{Name: "channel.cheer", Version: "1"} - ChannelRaid = SubscriptionType{Name: "channel.raid", Version: "1"} - ChannelBan = SubscriptionType{Name: "channel.ban", Version: "1"} - ChannelUnban = SubscriptionType{Name: "channel.unban", Version: "1"} - ChannelModeratorAdd = SubscriptionType{Name: "channel.moderator.add", Version: "1"} - ChannelModeratorRemove = SubscriptionType{Name: "channel.moderator.remove", Version: "1"} - ChannelGuestStarSessionBegin = SubscriptionType{Name: "channel.guest_star_session.begin", Version: "beta"} - ChannelGuestStarSessionEnd = SubscriptionType{Name: "channel.guest_star_session.end", Version: "beta"} - ChannelGuestStarGuestUpdate = SubscriptionType{Name: "channel.guest_star_guest.update", Version: "beta"} - ChannelGuestStarSettingsUpdate = SubscriptionType{Name: "channel.guest_star_settings.update", Version: "beta"} - ChannelPointsCustomRewardAdd = SubscriptionType{Name: "channel.channel_points_custom_reward.add", Version: "1"} - ChannelPointsCustomRewardUpdate = SubscriptionType{Name: "channel.channel_points_custom_reward.update", Version: "1"} - ChannelPointsCustomRewardRemove = SubscriptionType{Name: "channel.channel_points_custom_reward.remove", Version: "1"} - ChannelPointsCustomRewardRedemptionAdd = SubscriptionType{Name: "channel.channel_points_custom_reward_redemption.add", Version: "1"} + // A user is notified if a message is caught by automod for review. + AutomodMessageHold = SubscriptionType{Name: "automod.message.hold", Version: "1"} + + // A message in the automod queue had its status changed. + AutomodMessageUpdate = SubscriptionType{Name: "automod.message.update", Version: "1"} + + // A notification is sent when a broadcaster’s automod settings are updated. + AutomodSettingsUpdate = SubscriptionType{Name: "automod.settings.update", Version: "1"} + + // A notification is sent when a broadcaster’s automod terms are updated. Changes to private terms are not sent. + AutomodTermsUpdate = SubscriptionType{Name: "automod.terms.update", Version: "1"} + + // A broadcaster updates their channel properties e.g., category, title, content classification labels, broadcast, or language. + ChannelUpdate = SubscriptionType{Name: "channel.update", Version: "2"} + + // A specified channel receives a follow. + ChannelFollow = SubscriptionType{Name: "channel.follow", Version: "2"} + + // A midroll commercial break has started running. + ChannelAdBreakBegin = SubscriptionType{Name: "channel.ad_break_begin", Version: "1"} + + // A moderator or bot has cleared all messages from the chat room. + ChannelChatClear = SubscriptionType{Name: "channel.chat.clear", Version: "1"} + + // A moderator or bot has cleared all messages from a specific user. + ChannelChatClearUserMessages = SubscriptionType{Name: "channel.chat.clear_user_messages", Version: "1"} + + // Any user sends a message to a specific chat room. + ChannelChatMessage = SubscriptionType{Name: "channel.chat.message", Version: "1"} + + // A moderator has removed a specific message. + ChannelChatMessageDelete = SubscriptionType{Name: "channel.chat.message_delete", Version: "1"} + + // A notification for when an event that appears in chat has occurred. + ChannelChatNotification = SubscriptionType{Name: "channel.chat.notification", Version: "1"} + + // A notification for when a broadcaster’s chat settings are updated. + ChannelChatSettingsUpdate = SubscriptionType{Name: "channel.chat_settings.update", Version: "1"} + + // A user is notified if their message is caught by automod. + ChannelChatUserMessageHold = SubscriptionType{Name: "channel.chat.user_message_hold", Version: "1"} + + // A user is notified if their message’s automod status is updated. + ChannelChatUserMessageUpdate = SubscriptionType{Name: "channel.chat.user_message_update", Version: "1"} + + // A notification when a specified channel receives a subscriber. This does not include resubscribes. + ChannelSubscribe = SubscriptionType{Name: "channel.subscribe", Version: "1"} + + // A notification when a subscription to the specified channel ends. + ChannelSubscriptionEnd = SubscriptionType{Name: "channel.subscription.end", Version: "1"} + + // A notification when a viewer gives a gift subscription to one or more users in the specified channel. + ChannelSubscriptionGift = SubscriptionType{Name: "channel.subscription.gift", Version: "1"} + + // A notification when a user sends a resubscription chat message in a specific channel. + ChannelSubscriptionMessage = SubscriptionType{Name: "channel.subscription.message", Version: "1"} + + // A user cheers on the specified channel. + ChannelCheer = SubscriptionType{Name: "channel.cheer", Version: "1"} + + // A broadcaster raids another broadcaster’s channel. + ChannelRaid = SubscriptionType{Name: "channel.raid", Version: "1"} + + // A viewer is banned from the specified channel. + ChannelBan = SubscriptionType{Name: "channel.ban", Version: "1"} + + // A viewer is unbanned from the specified channel. + ChannelUnban = SubscriptionType{Name: "channel.unban", Version: "1"} + + // A user creates an unban request. + ChannelUnbanRequestCreate = SubscriptionType{Name: "channel.unban_request.create", Version: "1"} + + // An unban request has been resolved. + ChannelUnbanRequestResolve = SubscriptionType{Name: "channel.unban_request.resolve", Version: "1"} + + // A moderator performs a moderation action in a channel. + ChannelModerate = SubscriptionType{Name: "channel.moderate", Version: "1"} + + // Moderator privileges were added to a user on a specified channel. + ChannelModeratorAdd = SubscriptionType{Name: "channel.moderator.add", Version: "1"} + + // Moderator privileges were removed from a user on a specified channel. + ChannelModeratorRemove = SubscriptionType{Name: "channel.moderator.remove", Version: "1"} + + // The host began a new Guest Star session. + ChannelGuestStarSessionBegin = SubscriptionType{Name: "channel.guest_star_session.begin", Version: "beta"} + + // A running Guest Star session has ended. + ChannelGuestStarSessionEnd = SubscriptionType{Name: "channel.guest_star_session.end", Version: "beta"} + + // A guest or a slot is updated in an active Guest Star session. + ChannelGuestStarGuestUpdate = SubscriptionType{Name: "channel.guest_star_guest.update", Version: "beta"} + + // The host preferences for Guest Star have been updated. + ChannelGuestStarSettingsUpdate = SubscriptionType{Name: "channel.guest_star_settings.update", Version: "beta"} + + // A viewer has redeemed an automatic channel points reward on the specified channel. + ChannelPointsAutomaticRewardAdd = SubscriptionType{Name: "channel.channel_points_automatic_reward.add", Version: "1"} + + // A custom channel points reward has been created for the specified channel. + ChannelPointsCustomRewardAdd = SubscriptionType{Name: "channel.channel_points_custom_reward.add", Version: "1"} + + // A custom channel points reward has been updated for the specified channel. + ChannelPointsCustomRewardUpdate = SubscriptionType{Name: "channel.channel_points_custom_reward.update", Version: "1"} + + // A custom channel points reward has been removed from the specified channel. + ChannelPointsCustomRewardRemove = SubscriptionType{Name: "channel.channel_points_custom_reward.remove", Version: "1"} + + // A viewer has redeemed a custom channel points reward on the specified channel. + ChannelPointsCustomRewardRedemptionAdd = SubscriptionType{Name: "channel.channel_points_custom_reward_redemption.add", Version: "1"} + + // A redemption of a channel points custom reward has been updated for the specified channel. ChannelPointsCustomRewardRedemptionUpdate = SubscriptionType{Name: "channel.channel_points_custom_reward_redemption.update", Version: "1"} - ChannelPollBegin = SubscriptionType{Name: "channel.poll.begin", Version: "1"} - ChannelPollProgress = SubscriptionType{Name: "channel.poll.progress", Version: "1"} - ChannelPollEnd = SubscriptionType{Name: "channel.poll.end", Version: "1"} - ChannelPredictionBegin = SubscriptionType{Name: "channel.prediction.begin", Version: "1"} - ChannelPredictionProgress = SubscriptionType{Name: "channel.prediction.progress", Version: "1"} - ChannelPredictionLock = SubscriptionType{Name: "channel.prediction.lock", Version: "1"} - ChannelPredictionEnd = SubscriptionType{Name: "channel.prediction.end", Version: "1"} - CharityCampaignDonate = SubscriptionType{Name: "channel.charity_campaign.donate", Version: "1"} - CharityCampaignStart = SubscriptionType{Name: "channel.charity_campaign.start", Version: "1"} - CharityCampaignProgress = SubscriptionType{Name: "channel.charity_campaign.progress", Version: "1"} - CharityCampaignStop = SubscriptionType{Name: "channel.charity_campaign.stop", Version: "1"} - ConduitShardDisabled = SubscriptionType{Name: "conduit.shard.disabled", Version: "1"} - DropEntitlementGrant = SubscriptionType{Name: "drop.entitlement.grant", Version: "1"} - ExtensionBitsTransactionCreate = SubscriptionType{Name: "extension.bits.transaction.create", Version: "1"} - GoalBegin = SubscriptionType{Name: "goal.begin", Version: "1"} - GoalProgress = SubscriptionType{Name: "goal.progress", Version: "1"} - GoalEnd = SubscriptionType{Name: "goal.end", Version: "1"} - HypeTrainBegin = SubscriptionType{Name: "hype_train.begin", Version: "1"} - HypeTrainProgress = SubscriptionType{Name: "hype_train.progress", Version: "1"} - HypeTrainEnd = SubscriptionType{Name: "hype_train.end", Version: "1"} - ShieldModeBegin = SubscriptionType{Name: "shield_mode.begin", Version: "1"} - ShieldModeEnd = SubscriptionType{Name: "shield_mode.end", Version: "1"} - ShoutoutCreate = SubscriptionType{Name: "shoutout.create", Version: "1"} - ShoutoutReceived = SubscriptionType{Name: "shoutout.received", Version: "1"} - StreamOnline = SubscriptionType{Name: "stream.online", Version: "1"} - StreamOffline = SubscriptionType{Name: "stream.offline", Version: "1"} - UserAuthorizationGrant = SubscriptionType{Name: "user.authorization.grant", Version: "1"} - UserAuthorizationRevoke = SubscriptionType{Name: "user.authorization.revoke", Version: "1"} - UserUpdate = SubscriptionType{Name: "user.update", Version: "1"} + + // A poll started on a specified channel. + ChannelPollBegin = SubscriptionType{Name: "channel.poll.begin", Version: "1"} + + // Users respond to a poll on a specified channel. + ChannelPollProgress = SubscriptionType{Name: "channel.poll.progress", Version: "1"} + + // A poll ended on a specified channel. + ChannelPollEnd = SubscriptionType{Name: "channel.poll.end", Version: "1"} + + // A Prediction started on a specified channel. + ChannelPredictionBegin = SubscriptionType{Name: "channel.prediction.begin", Version: "1"} + + // Users participated in a Prediction on a specified channel. + ChannelPredictionProgress = SubscriptionType{Name: "channel.prediction.progress", Version: "1"} + + // A Prediction was locked on a specified channel. + ChannelPredictionLock = SubscriptionType{Name: "channel.prediction.lock", Version: "1"} + + // A Prediction ended on a specified channel. + ChannelPredictionEnd = SubscriptionType{Name: "channel.prediction.end", Version: "1"} + + // A chat message has been sent by a suspicious user. + ChannelSuspiciousUserMessage = SubscriptionType{Name: "channel.suspicious_user.message", Version: "1"} + + // A suspicious user has been updated. + ChannelSuspiciousUserUpdate = SubscriptionType{Name: "channel.suspicious_user.update", Version: "1"} + + // A VIP is added to the channel. + ChannelVipAdd = SubscriptionType{Name: "channel.vip.add", Version: "1"} + + // A VIP is removed from the channel. + ChannelVipRemove = SubscriptionType{Name: "channel.vip.remove", Version: "1"} + + // Sends an event notification when a user donates to the broadcaster’s charity campaign. + CharityCampaignDonate = SubscriptionType{Name: "channel.charity_campaign.donate", Version: "1"} + + // Sends an event notification when the broadcaster starts a charity campaign. + CharityCampaignStart = SubscriptionType{Name: "channel.charity_campaign.start", Version: "1"} + + // Sends an event notification when progress is made towards the campaign’s goal or when the broadcaster changes the fundraising goal. + CharityCampaignProgress = SubscriptionType{Name: "channel.charity_campaign.progress", Version: "1"} + + // Sends an event notification when the broadcaster stops a charity campaign. + CharityCampaignStop = SubscriptionType{Name: "channel.charity_campaign.stop", Version: "1"} + + // Sends a notification when EventSub disables a shard due to the status of the underlying transport changing. + ConduitShardDisabled = SubscriptionType{Name: "conduit.shard.disabled", Version: "1"} + + // An entitlement for a Drop is granted to a user. + DropEntitlementGrant = SubscriptionType{Name: "drop.entitlement.grant", Version: "1"} + + // A Bits transaction occurred for a specified Twitch Extension. + ExtensionBitsTransactionCreate = SubscriptionType{Name: "extension.bits.transaction.create", Version: "1"} + + // Get notified when a broadcaster begins a goal. + GoalBegin = SubscriptionType{Name: "goal.begin", Version: "1"} + + // Get notified when progress (either positive or negative) is made towards a broadcaster’s goal. + GoalProgress = SubscriptionType{Name: "goal.progress", Version: "1"} + + // Get notified when a broadcaster ends a goal. + GoalEnd = SubscriptionType{Name: "goal.end", Version: "1"} + + // A Hype Train begins on the specified channel. + HypeTrainBegin = SubscriptionType{Name: "hype_train.begin", Version: "1"} + + // A Hype Train makes progress on the specified channel. + HypeTrainProgress = SubscriptionType{Name: "hype_train.progress", Version: "1"} + + // A Hype Train ends on the specified channel. + HypeTrainEnd = SubscriptionType{Name: "hype_train.end", Version: "1"} + + // Sends a notification when the broadcaster activates Shield Mode. + ShieldModeBegin = SubscriptionType{Name: "shield_mode.begin", Version: "1"} + + // Sends a notification when the broadcaster deactivates Shield Mode. + ShieldModeEnd = SubscriptionType{Name: "shield_mode.end", Version: "1"} + + // Sends a notification when the specified broadcaster sends a Shoutout. + ShoutoutCreate = SubscriptionType{Name: "shoutout.create", Version: "1"} + + // Sends a notification when the specified broadcaster receives a Shoutout. + ShoutoutReceived = SubscriptionType{Name: "shoutout.received", Version: "1"} + + // The specified broadcaster starts a stream. + StreamOnline = SubscriptionType{Name: "stream.online", Version: "1"} + + // The specified broadcaster stops a stream. + StreamOffline = SubscriptionType{Name: "stream.offline", Version: "1"} + + // A user’s authorization has been granted to your client id. + UserAuthorizationGrant = SubscriptionType{Name: "user.authorization.grant", Version: "1"} + + // A user’s authorization has been revoked for your client id. + UserAuthorizationRevoke = SubscriptionType{Name: "user.authorization.revoke", Version: "1"} + + // A user has updated their account. + UserUpdate = SubscriptionType{Name: "user.update", Version: "1"} + + // A user receives a whisper. + UserWhisperMessage = SubscriptionType{Name: "user.whisper.message", Version: "1"} ) diff --git a/api/moderation/get_unban_requests.go b/api/moderation/get_unban_requests.go new file mode 100644 index 0000000..99f1f21 --- /dev/null +++ b/api/moderation/get_unban_requests.go @@ -0,0 +1,123 @@ +package moderation + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/google/go-querystring/query" + "go.fifitido.net/twitch/api/endpoint" + "go.fifitido.net/twitch/api/types" +) + +type GetUnbanRequestsParams struct { + // The ID of the broadcaster whose chat room the user is banned from chatting in. + BroadcasterID string `url:"broadcaster_id"` + + // The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. + // This ID must match the user ID in the user access token. + ModeratorID string `url:"moderator_id"` + + // Filter by a status. Accepted values: + // pending, approved, denied, acknowledged, or canceled + Status string `url:"status"` + + // The ID used to filter what unban requests are returned. + UserID *string `url:"user_id"` + + // Cursor used to get next page of results. Pagination object in response contains cursor value. + After *types.Cursor `url:"after"` + + // The maximum number of items to return per page in response + First *int `url:"first"` +} + +type GetUnbanRequestsResponse struct { + // A list that contains information about the channel's unban requests. + Data []GetUnbanRequestsResponseData `json:"data"` + + // Contains information used to page through a list of results. + // The object is empty if there are no more pages left to page through. + Pagination types.Pagination `json:"pagination"` +} + +type GetUnbanRequestsResponseData struct { + // Unban request ID. + ID string `json:"id"` + + // User ID of broadcaster whose channel is receiving the unban request. + BroadcasterID string `json:"broadcaster_id"` + + // The broadcaster's display name. + BroadcasterName string `json:"broadcaster_name"` + + // The broadcaster's login name. + BroadcasterLogin string `json:"broadcaster_login"` + + // User ID of moderator who approved/denied the request. + ModeratorID string `json:"moderator_id"` + + // The moderator's login name + ModeratorLogin string `json:"moderator_login"` + + // The moderator's display name + ModeratorName string `json:"moderator_name"` + + // User ID of the requestor who is asking for an unban. + UserID string `json:"user_id"` + + // The user's login name. + UserLogin string `json:"user_login"` + + // The user's display name. + UserName string `json:"user_name"` + + // Text of the request from the requesting user. + Text string `json:"text"` + + // Status of the request. One of: + // pending, approved, denied, acknowledged, or canceled + Status string `json:"status"` + + // Timestamp of when the unban request was created. + CreatedAt time.Time `json:"created_at"` + + // Timestamp of when moderator/broadcaster approved or denied the request. + ResolvedAt *time.Time `json:"resolved_at"` + + // Text input by the resolver (moderator) of the unban. request + ResolutionText string `json:"resolution_text"` +} + +// Gets a list of unban requests for a broadcaster’s channel. +// +// Requires a user access token that includes the moderator:read:unban_requests or moderator:manage:unban_requests scope. +// Query parameter moderator_id must match the user_id in the user access token. +func (m *Moderation) GetUnbanRequests(ctx context.Context, params *GetUnbanRequestsParams) (*GetUnbanRequestsResponse, error) { + v, _ := query.Values(params) + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint.Make(m.baseUrl, "moderation/unban_requests", v), nil) + if err != nil { + return nil, err + } + + res, err := m.client.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + + statusOK := res.StatusCode >= 200 && res.StatusCode < 300 + if !statusOK { + return nil, fmt.Errorf("failed to get unban requests (%d)", res.StatusCode) + } + + var data GetUnbanRequestsResponse + if err := json.NewDecoder(res.Body).Decode(&data); err != nil { + return nil, err + } + + return &data, nil +} diff --git a/api/moderation/resolve_unban_requests.go b/api/moderation/resolve_unban_requests.go new file mode 100644 index 0000000..7ae4fec --- /dev/null +++ b/api/moderation/resolve_unban_requests.go @@ -0,0 +1,115 @@ +package moderation + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "time" + + "github.com/google/go-querystring/query" + "go.fifitido.net/twitch/api/endpoint" +) + +type ResolveUnbanRequestsParams struct { + // The ID of the broadcaster whose chat room the user is banned from chatting in. + BroadcasterID string `url:"broadcaster_id"` + + // The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. + // This ID must match the user ID in the user access token. + ModeratorID string `url:"moderator_id"` + + // The ID of the unban request. + UnbanRequestID string `url:"unban_request_id"` + + // Resolution status. Accepted values: + // approved or denied + Status string `url:"status"` + + // Message supplied by the unban request resolver. The message is limited to a maximum of 500 characters. + ResolutionText *string `url:"resolution_text,omitempty"` +} + +type ResolveUnbanRequestsResponse struct { + // An array containing the information about the resolved unban request. + Data []ResolveUnbanRequestsResponseData `json:"data"` +} + +type ResolveUnbanRequestsResponseData struct { + // Unban request ID. + ID string `json:"id"` + + // User ID of broadcaster whose channel is receiving the unban request. + BroadcasterID string `json:"broadcaster_id"` + + // The broadcaster's display name. + BroadcasterName string `json:"broadcaster_name"` + + // The broadcaster's login name. + BroadcasterLogin string `json:"broadcaster_login"` + + // User ID of moderator who approved/denied the request. + ModeratorID string `json:"moderator_id"` + + // The moderator's login name + ModeratorLogin string `json:"moderator_login"` + + // The moderator's display name + ModeratorName string `json:"moderator_name"` + + // User ID of the requestor who is asking for an unban. + UserID string `json:"user_id"` + + // The user's login name. + UserLogin string `json:"user_login"` + + // The user's display name. + UserName string `json:"user_name"` + + // Text of the request from the requesting user. + Text string `json:"text"` + + // Status of the request. One of: + // approved or denied + Status string `json:"status"` + + // Timestamp of when the unban request was created. + CreatedAt time.Time `json:"created_at"` + + // Timestamp of when moderator/broadcaster approved or denied the request. + ResolvedAt time.Time `json:"resolved_at"` + + // Text input by the resolver (moderator) of the unban. request + ResolutionText string `json:"resolution_text"` +} + +// Resolves an unban request by approving or denying it. +// +// Requires a user access token that includes the moderator:manage:unban_requests scope. +// Query parameter moderator_id must match the user_id in the user access token. +func (m *Moderation) ResolveUnbanRequests(ctx context.Context, params *ResolveUnbanRequestsParams) (*ResolveUnbanRequestsResponse, error) { + v, _ := query.Values(params) + + req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.Make(m.baseUrl, "moderation/unban_requests", v), nil) + if err != nil { + return nil, err + } + + res, err := m.client.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + + statusOK := res.StatusCode >= 200 && res.StatusCode < 300 + if !statusOK { + return nil, fmt.Errorf("failed to resolve unban requests (%d)", res.StatusCode) + } + + var data ResolveUnbanRequestsResponse + if err := json.NewDecoder(res.Body).Decode(&data); err != nil { + return nil, err + } + + return &data, nil +} diff --git a/eventsub/events/automod.go b/eventsub/events/automod.go new file mode 100644 index 0000000..0823337 --- /dev/null +++ b/eventsub/events/automod.go @@ -0,0 +1,149 @@ +package events + +import "time" + +type AutomodMessage struct { + // The contents of the message caught by automod. + Text string `json:"text"` + + // Metadata surrounding the potential inappropriate fragments of the message. + Fragments []struct { + // Message text in a fragment. + Text string `json:"text"` + + // Optional. 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"` + } `json:"emote"` + + // Optional. 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}. + 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"` + } `json:"fragments"` +} + +type AutomodMessageHoldEvent 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"` + + // The message sender’s user ID. + UserID string `json:"user_id"` + + // The message sender’s login name. + UserLogin string `json:"user_login"` + + // The message sender’s display name. + UserName string `json:"user_name"` + + // The ID of the message that was flagged by automod. + MessageID string `json:"message_id"` + + // The body of the message. + Message []AutomodMessage `json:"message"` + + // The category of the message. + Category string `json:"category"` + + // The level of severity. Measured between 1 to 4. + Level int `json:"level"` + + // The timestamp of when automod saved the message. + HeldAt time.Time `json:"held_at"` +} + +type AutomodSettingsUpdateEvent 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"` + + // The ID of the moderator who changed the channel settings. + ModeratorUserID string `json:"moderator_user_id"` + + // The moderator’s login. + ModeratorUserLogin string `json:"moderator_user_login"` + + // The moderator’s user name. + ModeratorUserName string `json:"moderator_user_name"` + + // The automod level for hostility involving name calling or insults. + Bullying int `json:"bullying"` + + // The default AutoMod level for the broadcaster. + // This field is null if the broadcaster has set one or more of the individual settings. + OverallLevel *int `json:"overall_level"` + + // The Automod level for discrimination against disability. + Disability int `json:"disability"` + + // The Automod level for racial discrimination. + RaceEthnicityOrReligion int `json:"race_ethnicity_or_religion"` + + // The Automod level for discrimination against women. + Misogyny int `json:"misogyny"` + + // The Automod level for discrimination based on sexuality, sex, or gender. + SexualitySexOrGender int `json:"sexuality_sex_or_gender"` + + // The Automod level for hostility involving aggression. + Aggression int `json:"aggression"` + + // The Automod level for sexual content. + SexBasedTerms int `json:"sex_based_terms"` + + // The Automod level for profanity. + Swearing int `json:"swearing"` +} + +type AutomodTermsUpdateEvent 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"` + + // The ID of the moderator who changed the channel settings. + ModeratorUserID string `json:"moderator_user_id"` + + // The moderator’s login. + ModeratorUserLogin string `json:"moderator_user_login"` + + // The moderator’s user name. + ModeratorUserName string `json:"moderator_user_name"` + + // The status change applied to the terms. Possible options are: + // add_permitted, remove_permitted, add_blocked, or remove_blocked + Action string `json:"action"` + + // Indicates whether this term was added due to an Automod message approve/deny action. + FromAutomod bool `json:"from_automod"` + + // The list of terms that had a status change. + Terms []string `json:"terms"` +} diff --git a/eventsub/events/channel.go b/eventsub/events/channel.go index b81661d..82e4631 100644 --- a/eventsub/events/channel.go +++ b/eventsub/events/channel.go @@ -145,6 +145,76 @@ type ChannelUnbanEvent struct { ModeratorUserName string `json:"moderator_user_name"` } +type ChannelUnbanRequestCreateEvent struct { + + // The ID of the unban request. + ID string `json:"id"` + + // The broadcaster’s user ID for the channel the unban request was created for. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The broadcaster’s login name. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The broadcaster’s display name. + BroadcasterUserName string `json:"broadcaster_user_name"` + + // User ID of user that is requesting to be unbanned. + UserID string `json:"user_id"` + + // The user’s login name. + UserLogin string `json:"user_login"` + + // The user’s display name. + UserName string `json:"user_name"` + + // Message sent in the unban request. + Text string `json:"text"` + + // The UTC timestamp (in RFC3339 format) of when the unban request was created. + CreatedAt time.Time `json:"created_at"` +} + +type ChannelUnbanRequestResolveEvent struct { + + // The ID of the unban request. + ID string `json:"id"` + + // The broadcaster’s user ID for the channel the unban request was updated for. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The broadcaster’s login name. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The broadcaster’s display name. + BroadcasterUserName string `json:"broadcaster_user_name"` + + // User ID of moderator who approved/denied the request. + ModeratorID string `json:"moderator_id"` + + // The moderator’s login name + ModeratorLogin string `json:"moderator_login"` + + // The moderator’s display name + ModeratorName string `json:"moderator_name"` + + // User ID of user that requested to be unbanned. + UserID string `json:"user_id"` + + // The user’s login name. + UserLogin string `json:"user_login"` + + // The user’s display name. + UserName string `json:"user_name"` + + // Resolution text supplied by the mod/broadcaster upon approval/denial of the request. + ResolutionText string `json:"resolution_text"` + + // Dictates whether the unban request was approved or denied. Can be the following: + // approved, canceled, or denied + Status string `json:"status"` +} + type ChannelFollowEvent struct { // The user ID for the user now following the specified channel. UserID string `json:"user_id"` @@ -191,6 +261,231 @@ type ChannelRaidEvent struct { Viewers int `json:"viewers"` } +type ChannelModerateEvent struct { + + // The ID of the broadcaster. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The login of the broadcaster. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The display name of the broadcaster. + BroadcasterUserName string `json:"broadcaster_user_name"` + + // The ID of the moderator who performed the action. + ModeratorUserID string `json:"moderator_user_id"` + + // The login of the moderator. + ModeratorUserLogin string `json:"moderator_user_login"` + + // The display name of the moderator. + ModeratorUserName string `json:"moderator_user_name"` + + // The type of action performed. + // Possible values are: + // + // ban, timeout, unban, untimeout, clear, emoteonly, emoteonlyoff, followers, followersoff, + // uniquechat, uniquechatoff, slow, slowoff, subscribers, subscribersoff, unraid, delete, unvip, + // vip, raid, add_blocked_term, add_permitted_term, remove_blocked_term, remove_permitted_term, + // mod, unmod, approve_unban_request, deny_unban_request + Action string `json:"action"` + + // Optional. Metadata associated with the followers command. + Followers *struct { + // The length of time, in minutes, the the followers must have followed the boradcaster to participate in the chat room. + FollowDurationMinutes int `json:"follow_duration_minutes"` + } `json:"followers,omitempty"` + + // Optional. Metadata associated with the slow command. + Slow *struct { + // The amount of time, in seconds, that users need to wait between sending messages. + WaitTimeSeconds int `json:"wait_time_seconds"` + } `json:"slow,omitempty"` + + // Optional. Metadata associated with the vip command. + Vip *struct { + // The ID of the user gaining VIP status. + UserID string `json:"user_id"` + + // The login of the user gaining VIP status. + UserLogin string `json:"user_login"` + + // The display name of the user gaining VIP status. + UserName string `json:"user_name"` + } `json:"vip,omitempty"` + + // Optional. Metadata associated with the unvip command. + Unvip *struct { + // The ID of the user losing VIP status. + UserID string `json:"user_id"` + + // The login of the user losing VIP status. + UserLogin string `json:"user_login"` + + // The display name of the user losing VIP status. + UserName string `json:"user_name"` + } `json:"unvip,omitempty"` + + // Optional. Metadata associated with the mod command. + Mod *struct { + // The ID of the user gaining mod status. + UserID string `json:"user_id"` + + // The login of the user gaining mod status. + UserLogin string `json:"user_login"` + + // The display name of the user gaining mod status. + UserName string `json:"user_name"` + } `json:"mod,omitempty"` + + // Optional. Metadata associated with the unmod command. + Unmod *struct { + // The ID of the user losing mod status. + UserID string `json:"user_id"` + + // The login of the user losing mod status. + UserLogin string `json:"user_login"` + + // The display name of the user losing mod status. + UserName string `json:"user_name"` + } `json:"unmod,omitempty"` + + // Optional. Metadata associated with the ban command. + Ban *struct { + // The ID of the user being banned. + UserID string `json:"user_id"` + + // The login of the user being banned. + UserLogin string `json:"user_login"` + + // The display name of the user being banned. + UserName string `json:"user_name"` + + // Optional. The reason given for the ban. + Reason *string `json:"reason"` + } `json:"ban,omitempty"` + + // Optional. Metadata associated with the unban command. + Unban *struct { + // The ID of the user being unbanned. + UserID string `json:"user_id"` + + // The login of the user being unbanned. + UserLogin string `json:"user_login"` + + // The display name of the user being unbanned. + UserName string `json:"user_name"` + } `json:"unban,omitempty"` + + // Optional. Metadata associated with the timeout command. + Timeout *struct { + // The ID of the user being timed out. + UserID string `json:"user_id"` + + // The login of the user being timed out. + UserLogin string `json:"user_login"` + + // The display name of the user being timed out. + UserName string `json:"user_name"` + + // Optional. The reason given for the timeout. + Reason *string `json:"reason"` + + // The time at which the timeout ends. + ExpiresAt time.Time `json:"expires_at"` + } `json:"timeout,omitempty"` + + // Optional. Metadata associated with the untimeout command. + Untimeout *struct { + // The ID of the user being untimed out. + UserID string `json:"user_id"` + + // The login of the user being untimed out. + UserLogin string `json:"user_login"` + + // The display name of the user being untimed out. + UserName string `json:"user_name"` + } `json:"untimeout,omitempty"` + + // Optional. Metadata associated with the raid command. + Raid *struct { + // The ID of the user being raided. + UserID string `json:"user_id"` + + // The login of the user being raided. + UserLogin string `json:"user_login"` + + // The display name of the user being raided. + UserName string `json:"user_name"` + + // The viewer count. + ViewerCount int `json:"viewer_count"` + } `json:"raid,omitempty"` + + // Optional. Metadata associated with the unraid command. + Unraid *struct { + // The ID of the user no longer being raided. + UserID string `json:"user_id"` + + // The login of the user no longer being raided. + UserLogin string `json:"user_login"` + + // The display name of the user no longer being raided. + UserName string `json:"user_name"` + } `json:"unraid,omitempty"` + + // Optional. Metadata associated with the delete command. + Delete *struct { + // The ID of the user whose message is being deleted. + UserID string `json:"user_id"` + + // The login of the user. + UserLogin string `json:"user_login"` + + // The user name of the user. + UserName string `json:"user_name"` + + // The ID of the message being deleted. + MessageID string `json:"message_id"` + + // The message body of the message being deleted. + MessageBody string `json:"message_body"` + } `json:"delete,omitempty"` + + // Optional. Metadata associated with the automod terms changes. + AutomodTerms *struct { + // Either “add” or “remove”. + Action string `json:"action"` + + // Either “blocked” or “permitted”. + List string `json:"list"` + + // Terms being added or removed. + Terms []string `json:"terms"` + + // Whether the terms were added due to an Automod message approve/deny action. + FromAutomod bool `json:"from_automod"` + } `json:"automod_terms,omitempty"` + + // Optional. Metadata associated with an unban request. + UnbanRequest *struct { + // Whether or not the unban request was approved or denied. + IsApproved bool `json:"is_approved"` + + // The ID of the banned user. + UserID string `json:"user_id"` + + // The login of the user. + UserLogin string `json:"user_login"` + + // The user name of the user. + UserName string `json:"user_name"` + + // The message included by the moderator explaining their approval or denial. + ModeratorMessage string `json:"moderator_message"` + } `json:"unban_request,omitempty"` +} + type ChannelModeratorAddEvent struct { // The requested broadcaster ID. BroadcasterUserID string `json:"broadcaster_user_id"` @@ -347,6 +642,150 @@ type ChannelSubscriptionMessageEvent struct { DurationMonths int `json:"duration_months"` } +type ChannelSuspiciousUserMessageEvent struct { + // The ID of the channel where the treatment for a suspicious user was updated. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The display name of the channel where the treatment for a suspicious user was updated. + BroadcasterUserName string `json:"broadcaster_user_name"` + + // The Login of the channel where the treatment for a suspicious user was updated. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The ID of the moderator that updated the treatment for a suspicious user. + ModeratorUserID string `json:"moderator_user_id"` + + // The display name of the moderator that updated the treatment for a suspicious user. + ModeratorUserName string `json:"moderator_user_name"` + + // The login of the moderator that updated the treatment for a suspicious user. + ModeratorUserLogin string `json:"moderator_user_login"` + + // The ID of the suspicious user whose treatment was updated. + UserID string `json:"user_id"` + + // The display name of the suspicious user whose treatment was updated. + UserName string `json:"user_name"` + + // The login of the suspicious user whose treatment was updated. + UserLogin string `json:"user_login"` + + // The status set for the suspicious user. Can be the following: “none”, “active_monitoring”, or “restricted”. + LowTrustStatus string `json:"low_trust_status"` +} + +type ChannelSuspiciousUserUpdateEvent struct { + // The ID of the channel where the treatment for a suspicious user was updated. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The display name of the channel where the treatment for a suspicious user was updated. + BroadcasterUserName string `json:"broadcaster_user_name"` + + // The Login of the channel where the treatment for a suspicious user was updated. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The user ID of the user that sent the message. + UserID string `json:"user_id"` + + // The user name of the user that sent the message. + UserName string `json:"user_name"` + + // The user login of the user that sent the message. + UserLogin string `json:"user_login"` + + // The status set for the suspicious user. Can be the following: “none”, “active_monitoring”, or “restricted”. + LowTrustStatus string `json:"low_trust_status"` + + // A list of channel IDs where the suspicious user is also banned. + SharedBanChannelIDs []string `json:"shared_ban_channel_ids"` + + // User types (if any) that apply to the suspicious user, can be “manual”, “ban_evader_detector”, or “shared_channel_ban”. + Types []string `json:"types"` + + // A ban evasion likelihood value (if any) that as been applied to the user automatically by Twitch, can be “unknown”, “possible”, or “likely”. + BanEvasionEvaluation string `json:"ban_evasion_evaluation"` + + // The UUID that identifies the message. + MessageID string `json:"id"` + + // The structured chat message. + Message struct { + + // The chat message in plain text. + Text string `json:"text"` + + // Ordered list of chat message fragments. + Fragments []struct { + // The type of message fragment. Possible values: -text -cheermote -emote + Type string `json:"type"` + + // Message text in fragment. + Text string `json:"text"` + + // Optional. 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}. + Prefix string `json:"prefix"` + + // The amount of bits cheered. + Bits string `json:"bits"` + + // The tier level of the cheermote. + Tier string `json:"tier"` + } `json:"cheermote"` + + // Optional. 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"` + } `json:"emote"` + } `json:"fragments"` + } `json:"message"` +} + +type ChannelVipAddEvent struct { + // The ID of the user who was added as a VIP. + UserID string `json:"user_id"` + + // The login of the user who was added as a VIP. + UserLogin string `json:"user_login"` + + // The display name of the user who was added as a VIP. + UserName string `json:"user_name"` + + // The ID of the broadcaster. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The login of the broadcaster. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The display name of the broadcaster. + BroadcasterUserName string `json:"broadcaster_user_name"` +} + +type ChannelVipRemoveEvent struct { + // The ID of the user who was removed as a VIP. + UserID string `json:"user_id"` + + // The login of the user who was removed as a VIP. + UserLogin string `json:"user_login"` + + // The display name of the user who was removed as a VIP. + UserName string `json:"user_name"` + + // The ID of the broadcaster. + BroadcasterUserID string `json:"broadcaster_user_id"` + + // The login of the broadcaster. + BroadcasterUserLogin string `json:"broadcaster_user_login"` + + // The display name of the broadcaster. + BroadcasterUserName string `json:"broadcaster_user_name"` +} + // Defines the Shield Mode data that you receive when the channel.shield_mode.begin and channel.shield_mode.end events occur. type ShieldModeEvent struct { // An ID that identifies the broadcaster whose Shield Mode status was updated. diff --git a/eventsub/events/chat.go b/eventsub/events/chat.go index ebbd302..b669d25 100644 --- a/eventsub/events/chat.go +++ b/eventsub/events/chat.go @@ -550,3 +550,55 @@ type ChannelChatSettingsUpdateEvent struct { // True if the broadcaster requires unique messages only; otherwise false. UniqueChatMode bool `json:"unique_chat_mode"` } + +type ChannelChatUserMessageHoldEvent 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"` + + // The User ID of the message sender. + UserID string `json:"user_id"` + + // The message sender’s login name. + UserLogin string `json:"user_login"` + + // The message sender’s display name. + UserName string `json:"user_name"` + + // The ID of the message that was flagged by automod. + MessageID string `json:"message_id"` + + // The body of the message. + Message []AutomodMessage `json:"message"` +} + +type ChannelChatUserMessageUpdateEvent 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"` + + // The User ID of the message sender. + UserID string `json:"user_id"` + + // The message sender’s login name. + UserLogin string `json:"user_login"` + + // The message sender’s display name. + UserName string `json:"user_name"` + + // The ID of the message that was flagged by automod. + MessageID string `json:"message_id"` + + // The body of the message. + Message []AutomodMessage `json:"message"` +} diff --git a/eventsub/events/goals.go b/eventsub/events/goals.go index 4933e17..043fdb4 100644 --- a/eventsub/events/goals.go +++ b/eventsub/events/goals.go @@ -28,6 +28,10 @@ type GoalsEvent struct { // // new_subscription_count — The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions // (it does not account for users that unsubscribed since the goal started). + // + // new_bit — The goal is to increase the amount of Bits used on the channel. + // + // new_cheerer — The goal is to increase the number of unique Cheerers to Cheer on the channel. Type string `json:"type"` // A description of the goal, if specified. The description may contain a maximum of 40 characters. diff --git a/eventsub/events/users.go b/eventsub/events/users.go index 33cbf98..fd4c023 100644 --- a/eventsub/events/users.go +++ b/eventsub/events/users.go @@ -51,3 +51,32 @@ type UserUpdateEvent struct { // The user’s description. Description string `json:"description"` } + +type WhisperReceivedEvent struct { + // The ID of the user sending the message. + FromUserId string `json:"from_user_id"` + + // The name of the user sending the message. + FromUserName string `json:"from_user_name"` + + // The login of the user sending the message. + FromUserLogin string `json:"from_user_login"` + + // The ID of the user receiving the message. + ToUserId string `json:"to_user_id"` + + // The name of the user receiving the message. + ToUserName string `json:"to_user_name"` + + // The login of the user receiving the message. + ToUserLogin string `json:"to_user_login"` + + // The whisper ID. + WhisperId string `json:"whisper_id"` + + // Object containing whisper information. + Whisper struct { + // The body of the whisper message. + Text string `json:"text"` + } `json:"whisper"` +}