twitchwh

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

README

TwitchWH

TwitchWH is a Twitch Webhook EventSub library for Go.

Full documentation: https://pkg.go.dev/github.com/LinneB/twitchwh

Table of contents:

Installation

go get github.com/LinneB/twitchwh

Basic Usage

This is a basic example of how to use TwitchWH. It creates a new client, adds an event listener, and subscribes to an event.

For more examples and methods, see USAGE.md.

package main

import (
	"log"
	"net/http"

	"github.com/LinneB/twitchwh"
)

func main() {
	// Create a new Client
	client, err := twitchwh.New(twitchwh.ClientConfig{
		ClientID:      "client id",
		ClientSecret:  "super secret client secret",
		WebhookSecret: "random string between 10 and 100 characters",
		// This example assumes you have a domain that points to this app on port 8080
		WebhookURL:    "https://yourdomain.com/eventsub",
		// If you have your own token logic, set this to true and update the token using Client.SetToken()
		ExternalToken: false,
		// Enable log output
		Debug: true,
	})
	if err != nil {
		log.Panic(err)
	}

	// Set up an event handler
	client.OnStreamOnline = func(event twitchwh.StreamOnline) {
		log.Printf("%s went live!", event.BroadcasterUserLogin)
	}

	// Setup the HTTP event handler
	// This needs to be done before you subscribe to any events, since AddSubscription will wait until Twitch sends the challenge request
	http.HandleFunc("/eventsub", client.Handler)
	go http.ListenAndServe(":8080", nil)

	// Add a subscription for LinneB going live
	// Note that this will throw an error if the subscription already exists
	err = client.AddSubscription("stream.online", "1", twitchwh.Condition{
		BroadcasterUserID: "215185844",
	})
	if err != nil {
		log.Panic(err)
	}

	// Wait forever
	select {}
}

Contributing

Contributions are welcome. If you find any issues or have any suggestions, please open an issue or a pull request.

Questions and feature requests are also welcome, just open an issue.

Supported Events

TwitchWH supports all non-beta events as of 2024-06-07. For a complete list of events, see EventSub subscription types.

Please note that most of these events are not tested, and are only modeled based on the documentation. Double check the documentation and make sure the struct fields match.

Full list of supported events:

  • automod.message.hold
  • automod.message.update
  • automod.settings.update
  • automod.terms.update
  • channel.update
  • channel.follow
  • channel.ad_break.begin
  • channel.chat.clear
  • channel.chat.clear_user_messages
  • channel.chat.message
  • channel.chat.message_delete
  • channel.chat.notification
  • channel.chat_settings.update
  • channel.chat.user_message_hold
  • channel.chat.user_message_update
  • channel.subscribe
  • channel.subscription.end
  • channel.subscription.gift
  • channel.subscription.message
  • channel.cheer
  • channel.raid
  • channel.ban
  • channel.unban
  • channel.unban_request.create
  • channel.unban_request.resolve
  • channel.moderate
  • channel.moderator.add
  • channel.moderator.remove
  • channel.channel_points_automatic_reward_redemption.add
  • channel.channel_points_custom_reward.add
  • channel.channel_points_custom_reward.update
  • channel.channel_points_custom_reward.remove
  • channel.channel_points_custom_reward_redemption.add
  • channel.channel_points_custom_reward_redemption.update
  • channel.poll.begin
  • channel.poll.progress
  • channel.poll.end
  • channel.prediction.begin
  • channel.prediction.progress
  • channel.prediction.lock
  • channel.prediction.end
  • channel.suspicious_user.message
  • channel.suspicious_user.update
  • channel.vip.add
  • channel.vip.remove
  • channel.charity_campaign.donate
  • channel.charity_campaign.start
  • channel.charity_campaign.progress
  • channel.charity_campaign.stop
  • conduit.shard.disabled
  • drop.entitlement.grant
  • extension.bits_transaction.create
  • channel.goal.begin
  • channel.goal.progress
  • channel.goal.end
  • channel.hype_train.begin
  • channel.hype_train.progress
  • channel.hype_train.end
  • channel.shield_mode.begin
  • channel.shield_mode.end
  • channel.shoutout.create
  • channel.shoutout.receive
  • stream.online
  • stream.offline
  • user.authorization.grant
  • user.authorization.revoke
  • user.update
  • user.whisper.message

Documentation

Overview

Package twitchwh is a library for interacting with Twitch EventSub over the Webhook transport. It allows you to assign event handlers to specific events.

To get started, create a new client using the New function. Then, assign an event handler using the On<EventType> fields. Finally, setup the HTTP handler for your application using the Handler function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutomodMessageHold

type AutomodMessageHold struct {
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	UserID               string    `json:"user_id"`
	UserName             string    `json:"user_name"`
	UserLogin            string    `json:"user_login"`
	MessageID            string    `json:"message_id"`
	Message              string    `json:"message"`
	Level                int       `json:"level"`
	Category             string    `json:"category"`
	HeldAt               time.Time `json:"held_at"`
	Fragments            struct {
		Emotes []struct {
			Text  string `json:"text"`
			ID    string `json:"id"`
			SetID string `json:"set-id"`
		} `json:"emotes"`
		Cheermotes []struct {
			Text   string `json:"text"`
			Amount int    `json:"amount"`
			Prefix string `json:"prefix"`
			Tier   int    `json:"tier"`
		} `json:"cheermotes"`
	} `json:"fragments"`
}

automod.message.hold https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodmessagehold

type AutomodMessageUpdate

type AutomodMessageUpdate struct {
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	UserID               string    `json:"user_id"`
	UserName             string    `json:"user_name"`
	UserLogin            string    `json:"user_login"`
	ModeratorUserID      string    `json:"moderator_user_id"`
	ModeratorUserLogin   string    `json:"moderator_user_login"`
	ModeratorUserName    string    `json:"moderator_user_name"`
	MessageID            string    `json:"message_id"`
	Message              string    `json:"message"`
	Level                int       `json:"level"`
	Category             string    `json:"category"`
	Status               string    `json:"status"`
	HeldAt               time.Time `json:"held_at"`
	Fragments            struct {
		Emotes []struct {
			Text  string `json:"text"`
			ID    string `json:"id"`
			SetID string `json:"set-id"`
		} `json:"emotes"`
		Cheermotes []struct {
			Text   string `json:"text"`
			Amount int    `json:"amount"`
			Prefix string `json:"prefix"`
			Tier   int    `json:"tier"`
		} `json:"cheermotes"`
	} `json:"fragments"`
}

automod.message.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodmessageupdate

type AutomodSettingsUpdate

type AutomodSettingsUpdate struct {
	Data []struct {
		BroadcasterUserID       string `json:"broadcaster_user_id"`
		BroadcasterUserName     string `json:"broadcaster_user_name"`
		BroadcasterUserLogin    string `json:"broadcaster_user_login"`
		ModeratorUserID         string `json:"moderator_user_id"`
		ModeratorUserName       string `json:"moderator_user_name"`
		ModeratorUserLogin      string `json:"moderator_user_login"`
		OverallLevel            int    `json:"overall_level"`
		Disability              int    `json:"disability"`
		Aggression              int    `json:"aggression"`
		SexualitySexOrGender    int    `json:"sexuality_sex_or_gender"`
		Misogyny                int    `json:"misogyny"`
		Bullying                int    `json:"bullying"`
		Swearing                int    `json:"swearing"`
		RaceEthnicityOrReligion int    `json:"race_ethnicity_or_religion"`
		SexBasedTerms           int    `json:"sex_based_terms"`
	} `json:"data"`
}

automod.settings.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodsettingsupdate

type AutomodTermsUpdate

type AutomodTermsUpdate struct {
	BroadcasterUserID    string   `json:"broadcaster_user_id"`
	BroadcasterUserName  string   `json:"broadcaster_user_name"`
	BroadcasterUserLogin string   `json:"broadcaster_user_login"`
	ModeratorUserID      string   `json:"moderator_user_id"`
	ModeratorUserLogin   string   `json:"moderator_user_login"`
	ModeratorUserName    string   `json:"moderator_user_name"`
	Action               string   `json:"action"`
	FromAutomod          bool     `json:"from_automod"`
	Terms                []string `json:"terms"`
}

automod.terms.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodtermsupdate

type ChannelAdBreakBegin

type ChannelAdBreakBegin struct {
	DurationSeconds      string    `json:"duration_seconds"`
	StartedAt            time.Time `json:"started_at"`
	IsAutomatic          string    `json:"is_automatic"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	RequesterUserID      string    `json:"requester_user_id"`
	RequesterUserLogin   string    `json:"requester_user_login"`
	RequesterUserName    string    `json:"requester_user_name"`
}

channel.ad_break.begin https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelad_breakbegin

type ChannelBan

type ChannelBan struct {
	UserID               string    `json:"user_id"`
	UserLogin            string    `json:"user_login"`
	UserName             string    `json:"user_name"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	ModeratorUserID      string    `json:"moderator_user_id"`
	ModeratorUserLogin   string    `json:"moderator_user_login"`
	ModeratorUserName    string    `json:"moderator_user_name"`
	Reason               string    `json:"reason"`
	BannedAt             time.Time `json:"banned_at"`
	EndsAt               time.Time `json:"ends_at"`
	IsPermanent          bool      `json:"is_permanent"`
}

channel.ban https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelban

type ChannelCharityCampaignDonate

type ChannelCharityCampaignDonate struct {
	ID                   string `json:"id"`
	CampaignID           string `json:"campaign_id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	CharityName          string `json:"charity_name"`
	CharityDescription   string `json:"charity_description"`
	CharityWebsite       string `json:"charity_website"`
	Amount               struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"amount"`
}

channel.charity_campaign.donate https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaigndonate

type ChannelCharityCampaignProgress

type ChannelCharityCampaignProgress struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	CharityName          string `json:"charity_name"`
	CharityDescription   string `json:"charity_description"`
	CharityWebsite       string `json:"charity_website"`
	CurrentAmount        struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"current_amount"`
	TargetAmount struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"target_amount"`
}

channel.charity_campaign.progress https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignprogress

type ChannelCharityCampaignStart

type ChannelCharityCampaignStart struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	CharityName          string `json:"charity_name"`
	CharityDescription   string `json:"charity_description"`
	CharityWebsite       string `json:"charity_website"`
	CurrentAmount        struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"current_amount"`
	TargetAmount struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"target_amount"`
	StartedAt time.Time `json:"started_at"`
}

channel.charity_campaign.start https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignstart

type ChannelCharityCampaignStop

type ChannelCharityCampaignStop struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	CharityName          string `json:"charity_name"`
	CharityDescription   string `json:"charity_description"`
	CharityWebsite       string `json:"charity_website"`
	CurrentAmount        struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"current_amount"`
	TargetAmount struct {
		Value        int    `json:"value"`
		DecimalPlace int    `json:"decimal_place"`
		Currency     string `json:"currency"`
	} `json:"target_amount"`
	StoppedAt time.Time `json:"stopped_at"`
}

channel.charity_campaign.stop https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignstop

type ChannelChatClear

type ChannelChatClear struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
}

channel.chat.clear https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatclear

type ChannelChatClearUserMessages

type ChannelChatClearUserMessages struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	TargetUserID         string `json:"target_user_id"`
	TargetUserName       string `json:"target_user_name"`
	TargetUserLogin      string `json:"target_user_login"`
}

channel.chat.clear_user_messages https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatclear_user_messages

type ChannelChatMessage

type ChannelChatMessage struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	ChatterUserID        string `json:"chatter_user_id"`
	ChatterUserName      string `json:"chatter_user_name"`
	ChatterUserLogin     string `json:"chatter_user_login"`
	MessageID            string `json:"message_id"`
	Message              struct {
		Text      string `json:"text"`
		Fragments []struct {
			Type      string `json:"type"`
			Text      string `json:"text"`
			Cheermote struct {
				Prefix string `json:"prefix"`
				Bits   int    `json:"bits"`
				Tier   int    `json:"tier"`
			} `json:"cheermote"`
			Emote struct {
				ID         string   `json:"id"`
				EmoteSetID string   `json:"emote_set_id"`
				OwnerID    string   `json:"owner_id"`
				Format     []string `json:"format"`
			} `json:"emote"`
			Mention struct {
				UserID    string `json:"user_id"`
				UserName  string `json:"user_name"`
				UserLogin string `json:"user_login"`
			} `json:"mention"`
		} `json:"fragments"`
	} `json:"message"`
	MessageType string `json:"message_type"`
	Badges      []struct {
		SetID string `json:"set_id"`
		ID    string `json:"id"`
		Info  string `json:"info"`
	} `json:"badges"`
	Cheer struct {
		Bits int `json:"bits"`
	} `json:"cheer"`
	Color string `json:"color"`
	Reply struct {
		ParentMessageID   string `json:"parent_message_id"`
		ParentMessageBody string `json:"parent_message_body"`
		ParentUserID      string `json:"parent_user_id"`
		ParentUserName    string `json:"parent_user_name"`
		ParentUserLogin   string `json:"parent_user_login"`
		ThreadMessageID   string `json:"thread_message_id"`
		ThreadUserID      string `json:"thread_user_id"`
		ThreadUserName    string `json:"thread_user_name"`
		ThreadUserLogin   string `json:"thread_user_login"`
	} `json:"reply"`
	ChannelPointsCustomRewardID string `json:"channel_points_custom_reward_id"`
	ChannelPointsAnimationID    string `json:"channel_points_animation_id"`
}

channel.chat.message https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatmessage

type ChannelChatMessageDelete

type ChannelChatMessageDelete struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	TargetUserID         string `json:"target_user_id"`
	TargetUserName       string `json:"target_user_name"`
	TargetUserLogin      string `json:"target_user_login"`
	MessageID            string `json:"message_id"`
}

channel.chat.message_delete https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatmessage_delete

type ChannelChatNotification

type ChannelChatNotification struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	ChatterUserID        string `json:"chatter_user_id"`
	ChatterUserName      string `json:"chatter_user_name"`
	ChatterUserLogin     string `json:"chatter_user_login"`
	ChatterIsAnonymous   bool   `json:"chatter_is_anonymous"`
	Color                string `json:"color"`
	Badges               []struct {
		SetID string `json:"set_id"`
		ID    string `json:"id"`
		Info  string `json:"info"`
	} `json:"badges"`
	SystemMessage string `json:"system_message"`
	MessageID     string `json:"message_id"`
	Message       struct {
		Text      string `json:"text"`
		Fragments []struct {
			Type      string `json:"type"`
			Text      string `json:"text"`
			Cheermote struct {
				Prefix string `json:"prefix"`
				Bits   int    `json:"bits"`
				Tier   int    `json:"tier"`
			} `json:"cheermote"`
			Emote struct {
				ID         string   `json:"id"`
				EmoteSetID string   `json:"emote_set_id"`
				OwnerID    string   `json:"owner_id"`
				Format     []string `json:"format"`
			} `json:"emote"`
			Mention struct {
				UserID    string `json:"user_id"`
				Username  string `json:"user_name"`
				UserLogin string `json:"user_login"`
			}
		} `json:"fragments"`
	} `json:"message"`
	NoticeType string `json:"notice_type"`
	Sub        struct {
		SubTier        string `json:"sub_tier"`
		IsPrime        bool   `json:"is_prime"`
		DurationMonths int    `json:"duration_months"`
	}
	Resub struct {
		CumulativeMonths  int    `json:"cumulative_months"`
		DurationMonths    int    `json:"duration_months"`
		StreakMonths      int    `json:"streak_months"`
		SubTier           string `json:"sub_tier"`
		IsPrime           bool   `json:"is_prime"`
		IsGift            bool   `json:"is_gift"`
		GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
		GifterUserID      string `json:"gifter_user_id"`
		GifterUserName    string `json:"gifter_user_name"`
		GifterUserLogin   string `json:"gifter_user_login"`
	} `json:"resub"`
	SubGift struct {
		DurationMonths     int    `json:"duration_months"`
		CumulativeTotal    int    `json:"cumulative_total"`
		RecipientUserID    string `json:"recipient_user_id"`
		RecipientUserName  string `json:"recipient_user_name"`
		RecipientUserLogin string `json:"recipient_user_login"`
		SubTier            string `json:"sub_tier"`
		CommunityGiftID    string `json:"community_gift_id"`
	} `json:"sub_gift"`
	CommunitySubGift struct {
		ID              string `json:"id"`
		Total           int    `json:"total"`
		SubTier         string `json:"sub_tier"`
		CumulativeTotal int    `json:"cumulative_total"`
	} `json:"community_sub_gift"`
	GiftPaidUpgrade struct {
		GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
		GifterUserID      string `json:"gifter_user_id"`
		GifterUserName    string `json:"gifter_user_name"`
		GifterUserLogin   string `json:"gifter_user_login"`
	} `json:"gift_paid_upgrade"`
	PrimePaidUpgrade struct {
		SubTier string `json:"sub_tier"`
	} `json:"prime_paid_upgrade"`
	Raid struct {
		UserID          string `json:"user_id"`
		UserName        string `json:"user_name"`
		UserLogin       string `json:"user_login"`
		ViewerCount     int    `json:"viewer_count"`
		ProfileImageURL string `json:"profile_image_url"`
	} `json:"raid"`
	Unraid       struct{} `json:"unraid"`
	PayItForward struct {
		GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
		GifterUserID      string `json:"gifter_user_id"`
		GifterUserName    string `json:"gifter_user_name"`
		GifterUserLogin   string `json:"gifter_user_login"`
	} `json:"pay_it_forward"`
	Announcement struct {
		Color string `json:"color"`
	} `json:"announcement"`
	CharityDonation struct {
		CharityName string `json:"charity_name"`
		Amount      struct {
			Value        int    `json:"value"`
			DecimalPlace int    `json:"decimal_place"`
			Currency     string `json:"currency"`
		} `json:"amount"`
	} `json:"charity_donation"`
	BitsBadgeTier struct {
		Tier int `json:"tier"`
	} `json:"bits_badge_tier"`
}

channel.chat.notification https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatnotification

type ChannelChatSettingsUpdate

type ChannelChatSettingsUpdate struct {
	BroadcasterUserID           string `json:"broadcaster_user_id"`
	BroadcasterUserLogin        string `json:"broadcaster_user_login"`
	BroadcasterUserName         string `json:"broadcaster_user_name"`
	EmoteMode                   bool   `json:"emote_mod"`
	FollowerMode                bool   `json:"follower_mode"`
	FollowerModeDurationMinutes int    `json:"follower_mode_duration_minutes"`
	SlowMode                    bool   `json:"slow_mode"`
	SlowModeWaitTimeSeconds     int    `json:"slow_mode_wait_time_seconds"`
	SubscriberMode              bool   `json:"subscriber_mode"`
	UniqueChatMode              bool   `json:"unique_chat_mode"`
}

channel.chat_settings.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchat_settingsupdate

type ChannelChatUserMessageHold

type ChannelChatUserMessageHold struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	MessageID            string `json:"message_id"`
	Message              struct {
		Text      string `json:"text"`
		Fragments []struct {
			Type  string `json:"type"`
			Text  string `json:"text"`
			Emote struct {
				ID         string `json:"id"`
				EmoteSetID string `json:"emote_set_id"`
			} `json:"emote"`
			Cheermote struct {
				Prefix string `json:"prefix"`
				Bits   int    `json:"bits"`
				Tier   int    `json:"tier"`
			} `json:"cheermote"`
		}
	} `json:"message"`
}

channel.chat.user_message_hold https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatuser_message_hold

type ChannelChatUserMessageUpdate

type ChannelChatUserMessageUpdate struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	Status               string `json:"status"`
	MessageID            string `json:"message_id"`
	Message              struct {
		Text      string `json:"text"`
		Fragments []struct {
			Type  string `json:"type"`
			Text  string `json:"text"`
			Emote struct {
				ID         string `json:"id"`
				EmoteSetID string `json:"emote_set_id"`
			} `json:"emote"`
			Cheermote struct {
				Prefix string `json:"prefix"`
				Bits   int    `json:"bits"`
				Tier   int    `json:"tier"`
			} `json:"cheermote"`
		}
	} `json:"message"`
}

channel.chat.user_message_update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatuser_message_update

type ChannelCheer

type ChannelCheer struct {
	IsAnonymous          bool   `json:"is_anonymous"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Message              string `json:"message"`
	Bits                 int    `json:"bits"`
}

channel.cheer https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcheer

type ChannelFollow

type ChannelFollow struct {
	UserID               string    `json:"user_id"`
	UserLogin            string    `json:"user_login"`
	UserName             string    `json:"user_name"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	FollowedAt           time.Time `json:"followed_at"`
}

channel.follow https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelfollow

type ChannelGoalBegin

type ChannelGoalBegin struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	Type                 string    `json:"type"`
	Decscription         string    `json:"description"`
	CurrentAmount        int       `json:"current_amount"`
	TargetAmount         int       `json:"target_amount"`
	StartedAt            time.Time `json:"started_at"`
}

channel.goal.begin https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalbegin

type ChannelGoalEnd

type ChannelGoalEnd struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	Type                 string    `json:"type"`
	IsAchieved           bool      `json:"is_achieved"`
	Decscription         string    `json:"description"`
	CurrentAmount        int       `json:"current_amount"`
	TargetAmount         int       `json:"target_amount"`
	StartedAt            time.Time `json:"started_at"`
	EndedAt              time.Time `json:"ended_at"`
}

channel.goal.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalend

type ChannelGoalProgress

type ChannelGoalProgress struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	Type                 string    `json:"type"`
	Decscription         string    `json:"description"`
	CurrentAmount        int       `json:"current_amount"`
	TargetAmount         int       `json:"target_amount"`
	StartedAt            time.Time `json:"started_at"`
}

channel.goal.progress https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalprogress

type ChannelHypeTrainBegin

type ChannelHypeTrainBegin struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Total                int    `json:"total"`
	Progress             int    `json:"progress"`
	Goal                 int    `json:"goal"`
	TopContributions     []struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Type      string `json:"type"`
		Total     int    `json:"total"`
	} `json:"top_contributions"`
	LastContribution struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Type      string `json:"type"`
		Total     int    `json:"total"`
	} `json:"last_contribution"`
	Level     int       `json:"level"`
	StartedAt time.Time `json:"started_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

channel.hype_train.begin https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainbegin

type ChannelHypeTrainEnd

type ChannelHypeTrainEnd struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Level                int    `json:"level"`
	Total                int    `json:"total"`
	TopContributions     []struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Type      string `json:"type"`
		Total     int    `json:"total"`
	} `json:"top_contributions"`
	StartedAt       time.Time `json:"started_at"`
	EndedAt         time.Time `json:"ended_at"`
	CooldownEndstAt time.Time `json:"cooldown_ends_at"`
}

channel.hype_train.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainend

type ChannelHypeTrainProgress

type ChannelHypeTrainProgress struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Level                int    `json:"level"`
	Total                int    `json:"total"`
	Progress             int    `json:"progress"`
	Goal                 int    `json:"goal"`
	TopContributions     []struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Type      string `json:"type"`
		Total     int    `json:"total"`
	} `json:"top_contributions"`
	LastContribution struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Type      string `json:"type"`
		Total     int    `json:"total"`
	} `json:"last_contribution"`
	StartedAt time.Time `json:"started_at"`
	ExpiresAt time.Time `json:"expires_at"`
}

channel.hype_train.progress https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainprogress

type ChannelModerate

type ChannelModerate struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	ModeratorUserName    string `json:"moderator_user_name"`
	Action               string `json:"action"`
	Followers            struct {
		FollowDurationMinutes int `json:"follow_duration_minutes"`
	} `json:"followers"`
	Slow struct {
		WaitTimeSeconds int `json:"wait_time_seconds"`
	} `json:"slow"`
	Vip struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"vip"`
	UnVip struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"unvip"`
	Mod struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"mod"`
	UnMod struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"unmod"`
	Ban struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
		Reason    string `json:"reason"`
	} `json:"ban"`
	UnBan struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"unban"`
	Timeout struct {
		UserID    string    `json:"user_id"`
		UserLogin string    `json:"user_login"`
		UserName  string    `json:"user_name"`
		Reason    string    `json:"reason"`
		ExpiresAt time.Time `json:"expires_at"`
	} `json:"timeout"`
	UnTimeout struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"untimeout"`
	Raid struct {
		UserID      string `json:"user_id"`
		UserLogin   string `json:"user_login"`
		UserName    string `json:"user_name"`
		ViewerCount int    `json:"viewer_count"`
	} `json:"raid"`
	UnRaid struct {
		UserID    string `json:"user_id"`
		UserLogin string `json:"user_login"`
		UserName  string `json:"user_name"`
	} `json:"unraid"`
	Delete struct {
		UserID      string `json:"user_id"`
		UserLogin   string `json:"user_login"`
		UserName    string `json:"user_name"`
		MessageID   string `json:"message_id"`
		MessageBody string `json:"message_body"`
	} `json:"delete"`
	AutomodTerms struct {
		Action      string   `json:"action"`
		List        string   `json:"list"`
		Terms       []string `json:"terms"`
		FromAutomod bool     `json:"from_automod"`
	} `json:"automod_terms"`
	UnbanRequest struct {
		IsApproved       bool   `json:"is_approved"`
		UserID           string `json:"user_id"`
		UserLogin        string `json:"user_login"`
		UserName         string `json:"user_name"`
		ModeratorMessage string `json:"moderator_message"`
	}
}

channel.moderate https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderate

type ChannelModeratorAdd

type ChannelModeratorAdd struct {
	UserID               string `json:"user_id"`
	UserName             string `json:"user_name"`
	UserLogin            string `json:"user_login"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
}

channel.moderator.add https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderatoradd

type ChannelModeratorRemove

type ChannelModeratorRemove struct {
	UserID               string `json:"user_id"`
	UserName             string `json:"user_name"`
	UserLogin            string `json:"user_login"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
}

channel.moderator.remove https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderatorremove

type ChannelPointsAutomaticRewardRedemption

type ChannelPointsAutomaticRewardRedemption struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	UserID               string `json:"user_id"`
	UserName             string `json:"user_name"`
	UserLogin            string `json:"user_login"`
	ID                   string `json:"id"`
	Reward               struct {
		Type          string `json:"type"`
		Cost          int    `json:"cost"`
		UnlockedEmote struct {
			ID   string `json:"id"`
			Name string `json:"name"`
		} `json:"unlocked_emote"`
	} `json:"reward"`
	Message struct {
		Text   string `json:"text"`
		Emotes []struct {
			ID    string `json:"id"`
			Begin int    `json:"begin"`
			End   int    `json:"end"`
		}
	} `json:"message"`
	UserInput  string    `json:"user_input"`
	RedeemedAt time.Time `json:"redeemed_at"`
}

channel.channel_points_automatic_reward_redemption.add https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_automatic_reward_redemptionadd

type ChannelPointsCustomReward

type ChannelPointsCustomReward struct {
	ID                                string `json:"id"`
	BroadcasterUserID                 string `json:"broadcaster_user_id"`
	BroadcasterUserLogin              string `json:"broadcaster_user_login"`
	BroadcasterUserName               string `json:"broadcaster_user_name"`
	IsEnabled                         bool   `json:"is_enabled"`
	IsPaused                          bool   `json:"is_paused"`
	IsInStock                         bool   `json:"is_in_stock"`
	Title                             string `json:"title"`
	Cost                              int    `json:"cost"`
	Prompt                            string `json:"prompt"`
	IsUserInputRequired               bool   `json:"is_user_input_required"`
	ShouldRedemptionsSkipRequestQueue bool   `json:"should_redemptions_skip_request_queue"`
	MaxPerStream                      struct {
		IsEnabled bool `json:"is_enabled"`
		Value     int  `json:"value"`
	} `json:"max_per_stream"`
	MaxPerUserPerStream struct {
		IsEnabled bool `json:"is_enabled"`
		Value     int  `json:"value"`
	} `json:"max_per_user_per_stream"`
	BackgroundColor string `json:"background_color"`
	Image           struct {
		Url1x string `json:"url_1x"`
		Url2x string `json:"url_2x"`
		Url4x string `json:"url_4x"`
	} `json:"image"`
	DefaultImage struct {
		Url1x string `json:"url_1x"`
		Url2x string `json:"url_2x"`
		Url4x string `json:"url_4x"`
	} `json:"default_image"`
	GlobalCooldown struct {
		IsEnabled bool `json:"is_enabled"`
		Seconds   int  `json:"seconds"`
	} `json:"global_cooldown"`
	CooldownExpiresAt                time.Time `json:"cooldown_expires_at"`
	RedemptionsRedeemedCurrentStream int       `json:"redemptions_redeemed_current_stream"`
}

Generic Channel Points event type used by ChannelPointsCustomRewardAdd ChannelPointsCustomRewardUpdate ChannelPointsCustomRewardRemove

type ChannelPointsCustomRewardRedemption

type ChannelPointsCustomRewardRedemption struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	UserInput            string `json:"user_input"`
	Status               string `json:"status"`
	Reward               struct {
		ID     string `json:"id"`
		Title  string `json:"title"`
		Cost   int    `json:"cost"`
		Prompt string `json:"prompt"`
	} `json:"reward"`
	RedeemedAt time.Time `json:"redeemed_at"`
}

Generic Channel Points Redemption event used by ChannelPointsCustomRewardRedemptionAdd ChannelPointsCustomRewardRedemptionUpdate

type ChannelPoll

type ChannelPoll struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Choices              []struct {
		ID    string `json:"id"`
		Title string `json:"title"`
		// According to Twitch this is unused and will always be 0
		BitsVotes          int `json:"bits_votes"`
		ChannelPointsVotes int `json:"channel_points_votes"`
		Votes              int `json:"votes"`
	} `json:"choices"`
	// According to Twitch this is unused and should be ignored
	BitsVoting struct {
		IsEnabled     bool `json:"is_enabled"`
		AmountPerVote int  `json:"amount_per_vote"`
	} `json:"bits_voting"`
	ChannelPointsVoting struct {
		IsEnabled     bool `json:"is_enabled"`
		AmountPerVote int  `json:"amount_per_vote"`
	} `json:"channel_points_voting"`
	StartedAt time.Time `json:"started_at"`
	EndsAt    time.Time `json:"ends_at"`
}

Generic Channel Poll event type used by ChannelPollBegin and ChannelPollProgress

type ChannelPollEnd

type ChannelPollEnd struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Choices              []struct {
		ID    string `json:"id"`
		Title string `json:"title"`
		// According to Twitch this is unused and will always be 0
		BitsVotes          int `json:"bits_votes"`
		ChannelPointsVotes int `json:"channel_points_votes"`
		Votes              int `json:"votes"`
	} `json:"choices"`
	// According to Twitch this is unused and should be ignored
	BitsVoting struct {
		IsEnabled     bool `json:"is_enabled"`
		AmountPerVote int  `json:"amount_per_vote"`
	} `json:"bits_voting"`
	ChannelPointsVoting struct {
		IsEnabled     bool `json:"is_enabled"`
		AmountPerVote int  `json:"amount_per_vote"`
	} `json:"channel_points_voting"`
	Status    string    `json:"status"`
	StartedAt time.Time `json:"started_at"`
	EndsAt    time.Time `json:"ends_at"`
}

channel.poll.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpollend

type ChannelPredictionBegin

type ChannelPredictionBegin struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Outcomes             []struct {
		ID    string `json:"id"`
		Title string `json:"title"`
		Color string `json:"color"`
	}
	StartedAt time.Time `json:"started_at"`
	LocksAt   time.Time `json:"locks_at"`
}

channel.prediction.begin https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionbegin

type ChannelPredictionEnd

type ChannelPredictionEnd struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	WinningOutcomeID     string `json:"winning_outcome_id"`
	Outcomes             []struct {
		ID            string `json:"id"`
		Title         string `json:"title"`
		Color         string `json:"color"`
		Users         int    `json:"users"`
		ChannelPoints int    `json:"channel_points"`
		TopPredictors []struct {
			UserID            string `json:"user_id"`
			UserLogin         string `json:"user_login"`
			UserName          string `json:"user_name"`
			ChannelPointsWon  int    `json:"channel_points_won"`
			ChannelPointsUsed int    `json:"channel_points_used"`
		}
	}
	Status    string    `json:"status"`
	StartedAt time.Time `json:"started_at"`
	LocksAt   time.Time `json:"locks_at"`
}

channel.prediction.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionend

type ChannelPredictionLock

type ChannelPredictionLock struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Outcomes             []struct {
		ID            string `json:"id"`
		Title         string `json:"title"`
		Color         string `json:"color"`
		Users         int    `json:"users"`
		ChannelPoints int    `json:"channel_points"`
		TopPredictors []struct {
			UserID            string `json:"user_id"`
			UserLogin         string `json:"user_login"`
			UserName          string `json:"user_name"`
			ChannelPointsUsed int    `json:"channel_points_used"`
		}
	}
	StartedAt time.Time `json:"started_at"`
	LocksAt   time.Time `json:"locks_at"`
}

channel.prediction.lock https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionlock

type ChannelPredictionProgress

type ChannelPredictionProgress struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Title                string `json:"title"`
	Outcomes             []struct {
		ID            string `json:"id"`
		Title         string `json:"title"`
		Color         string `json:"color"`
		Users         int    `json:"users"`
		ChannelPoints int    `json:"channel_points"`
		TopPredictors []struct {
			UserID            string `json:"user_id"`
			UserLogin         string `json:"user_login"`
			UserName          string `json:"user_name"`
			ChannelPointsUsed int    `json:"channel_points_used"`
		}
	}
	StartedAt time.Time `json:"started_at"`
	LocksAt   time.Time `json:"locks_at"`
}

channel.prediction.progress https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionprogress

type ChannelRaid

type ChannelRaid struct {
	FromBroadcasterUserID    string `json:"from_broadcaster_user_id"`
	FromBroadcasterUserLogin string `json:"from_broadcaster_user_login"`
	FromBroadcasterUserName  string `json:"from_broadcaster_user_name"`
	ToBroadcasterUserID      string `json:"to_broadcaster_user_id"`
	ToBroadcasterUserLogin   string `json:"to_broadcaster_user_login"`
	ToBroadcasterUserName    string `json:"to_broadcaster_user_name"`
	Viewers                  int    `json:"viewers"`
}

channel.raid https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelraid

type ChannelShieldModeBegin

type ChannelShieldModeBegin struct {
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	ModeratorUserID      string    `json:"moderator_user_id"`
	ModeratorUserName    string    `json:"moderator_user_name"`
	ModeratorUserLogin   string    `json:"moderator_user_login"`
	StartedAt            time.Time `json:"started_at"`
}

channel.shield_mode.begin https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshield_modebegin

type ChannelShieldModeEnd

type ChannelShieldModeEnd struct {
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	ModeratorUserID      string    `json:"moderator_user_id"`
	ModeratorUserName    string    `json:"moderator_user_name"`
	ModeratorUserLogin   string    `json:"moderator_user_login"`
	EndedAt              time.Time `json:"ended_at"`
}

channel.shield_mode.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshield_modeend

type ChannelShoutoutCreate

type ChannelShoutoutCreate struct {
	BroadcasterUserID      string    `json:"broadcaster_user_id"`
	BroadcasterUserName    string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin   string    `json:"broadcaster_user_login"`
	ModeratorUserID        string    `json:"moderator_user_id"`
	ModeratorUserName      string    `json:"moderator_user_name"`
	ModeratorUserLogin     string    `json:"moderator_user_login"`
	ToBroadcasterUserID    string    `json:"to_broadcaster_user_id"`
	ToBroadcasterUserName  string    `json:"to_broadcaster_user_name"`
	ToBroadcasterUserLogin string    `json:"to_broadcaster_user_login"`
	StartedAt              time.Time `json:"started_at"`
	ViewerCount            int       `json:"viewer_count"`
	CooldownEndstAt        time.Time `json:"cooldown_ends_at"`
	TargetCooldownEndstAt  time.Time `json:"target_cooldown_ends_at"`
}

channel.shoutout.create https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshoutoutcreate

type ChannelShoutoutReceive

type ChannelShoutoutReceive struct {
	BroadcasterUserID        string    `json:"broadcaster_user_id"`
	BroadcasterUserName      string    `json:"broadcaster_user_name"`
	BroadcasterUserLogin     string    `json:"broadcaster_user_login"`
	FromBroadcasterUserID    string    `json:"from_broadcaster_user_id"`
	FromBroadcasterUserName  string    `json:"from_broadcaster_user_name"`
	FromBroadcasterUserLogin string    `json:"from_broadcaster_user_login"`
	ViewerCount              int       `json:"viewer_count"`
	StartedAt                time.Time `json:"started_at"`
}

channel.shoutout.receive https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshoutoutreceive

type ChannelSubscribe

type ChannelSubscribe struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Tier                 string `json:"tier"`
	IsGift               bool   `json:"is_gift"`
}

channel.subscribe https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscribe

type ChannelSubscriptionEnd

type ChannelSubscriptionEnd struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Tier                 string `json:"tier"`
	IsGift               bool   `json:"is_gift"`
}

channel.subscription.end https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptionend

type ChannelSubscriptionGift

type ChannelSubscriptionGift struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Total                int    `json:"total"`
	Tier                 string `json:"tier"`
	CumulativeTotal      int    `json:"cumulative_total"`
	IsAnonymous          bool   `json:"is_anonymous"`
}

channel.subscription.gift https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptiongift

type ChannelSubscriptionMessage

type ChannelSubscriptionMessage struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	Tier                 string `json:"tier"`
	Message              struct {
		Text   string `json:"text"`
		Emotes []struct {
			Begin int    `json:"begin"`
			End   int    `json:"end"`
			ID    string `json:"id"`
		}
	} `json:"message"`
	CumulativeMonths int `json:"cumulative_months"`
	StreakMonths     int `json:"streak_months"`
	DurationMonths   int `json:"duration_months"`
}

channel.subscription.message https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptionmessage

type ChannelSuspiciousUserMessage

type ChannelSuspiciousUserMessage struct {
	BroadcasterUserID     string   `json:"broadcaster_user_id"`
	BroadcasterUserName   string   `json:"broadcaster_user_name"`
	BroadcasterUserLogin  string   `json:"broadcaster_user_login"`
	UserID                string   `json:"user_id"`
	UserName              string   `json:"user_name"`
	UserLogin             string   `json:"user_login"`
	LowTrustStatus        string   `json:"low_trust_status"`
	SharedBanChannelIDs   []string `json:"shared_ban_channel_ids"`
	Types                 []string `json:"types"`
	BanEvasionEvauluation string   `json:"ban_evasion_evaluation"`
	Message               struct {
		MessageID string `json:"message_id"`
		Text      string `json:"text"`
		Fragments []struct {
			Type      string `json:"type"`
			Text      string `json:"text"`
			Cheermote struct {
				Prefix string `json:"prefix"`
				Bits   int    `json:"bits"`
				Tier   int    `json:"tier"`
			} `json:"cheermote"`
			Emote struct {
				ID         string `json:"id"`
				EmoteSetID string `json:"emote_set_id"`
			} `json:"emote"`
		} `json:"fragments"`
	} `json:"message"`
}

channel.suspicious_user.message https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsuspicious_usermessage

type ChannelSuspiciousUserUpdate

type ChannelSuspiciousUserUpdate struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserName    string `json:"moderator_user_name"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	UserID               string `json:"user_id"`
	UserName             string `json:"user_name"`
	UserLogin            string `json:"user_login"`
	LowTrustStatus       string `json:"low_trust_status"`
}

channel.suspicious_user.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsuspicious_userupdate

type ChannelUnban

type ChannelUnban struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	ModeratorUserName    string `json:"moderator_user_name"`
}

channel.unban https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban

type ChannelUnbanRequestCreate

type ChannelUnbanRequestCreate struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	UserID               string    `json:"user_id"`
	UserLogin            string    `json:"user_login"`
	UserName             string    `json:"user_name"`
	Text                 string    `json:"text"`
	CreatedAt            time.Time `json:"created_at"`
}

channel.unban_request.create https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban_requestcreate

type ChannelUnbanRequestResolve

type ChannelUnbanRequestResolve struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	ModeratorUserName    string `json:"moderator_user_name"`
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	ResolutionText       string `json:"resolution_text"`
	Status               string `json:"status"`
}

channel.unban_request.resolve https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban_requestresolve

type ChannelUpdate

type ChannelUpdate struct {
	BroadcasterUserID           string   `json:"broadcaster_user_id"`
	BroadcasterUserLogin        string   `json:"broadcaster_user_login"`
	BroadcasterUserName         string   `json:"broadcaster_user_name"`
	Title                       string   `json:"title"`
	Language                    string   `json:"language"`
	CategoryID                  string   `json:"category_id"`
	CategoryName                string   `json:"category_name"`
	ContentClassificationLabels []string `json:"content_classification_labels"`
}

channel.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelupdate

type ChannelVIPAdd

type ChannelVIPAdd struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

channel.vip.add https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelvipadd

type ChannelVIPRemove

type ChannelVIPRemove struct {
	UserID               string `json:"user_id"`
	UserLogin            string `json:"user_login"`
	UserName             string `json:"user_name"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

channel.vip.remove https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelvipremove

type Client

type Client struct {

	// Fired whenever a subscription is revoked.
	// Check Subscription.Status for the reason.
	OnRevocation func(Subscription)

	OnAutomodMessageHold                        func(AutomodMessageHold)
	OnAutomodMessageUpdate                      func(AutomodMessageUpdate)
	OnAutomodSettingsUpdate                     func(AutomodSettingsUpdate)
	OnAutomodTermsUpdate                        func(AutomodTermsUpdate)
	OnChannelUpdate                             func(ChannelUpdate)
	OnChannelFollow                             func(ChannelFollow)
	OnChannelAdBreakBegin                       func(ChannelAdBreakBegin)
	OnChannelChatClear                          func(ChannelChatClear)
	OnChannelChatClearUserMessages              func(ChannelChatClearUserMessages)
	OnChannelChatMessage                        func(ChannelChatMessage)
	OnChannelChatMessageDelete                  func(ChannelChatMessageDelete)
	OnChannelChatNotification                   func(ChannelChatNotification)
	OnChannelChatSettingsUpdate                 func(ChannelChatSettingsUpdate)
	OnChannelChatUserMessageHold                func(ChannelChatUserMessageHold)
	OnChannelChatUserMessageUpdate              func(ChannelChatUserMessageUpdate)
	OnChannelSubscribe                          func(ChannelSubscribe)
	OnChannelSubscriptionEnd                    func(ChannelSubscriptionEnd)
	OnChannelSubscriptionGift                   func(ChannelSubscriptionGift)
	OnChannelSubscriptionMessage                func(ChannelSubscriptionMessage)
	OnChannelCheer                              func(ChannelCheer)
	OnChannelRaid                               func(ChannelRaid)
	OnChannelBan                                func(ChannelBan)
	OnChannelUnban                              func(ChannelUnban)
	OnChannelUnbanRequestCreate                 func(ChannelUnbanRequestCreate)
	OnChannelUnbanRequestResolve                func(ChannelUnbanRequestResolve)
	OnChannelModerate                           func(ChannelModerate)
	OnChannelModeratorAdd                       func(ChannelModeratorAdd)
	OnChannelModeratorRemove                    func(ChannelModeratorRemove)
	OnChannelPointsAutomaticRewardRedemption    func(ChannelPointsAutomaticRewardRedemption)
	OnChannelPointsCustomRewardAdd              func(ChannelPointsCustomRewardAdd)
	OnChannelPointsCustomRewardUpdate           func(ChannelPointsCustomRewardUpdate)
	OnChannelPointsCustomRewardRemove           func(ChannelPointsCustomRewardRemove)
	OnChannelPointsCustomRewardRedemption       func(ChannelPointsCustomRewardRedemption)
	OnChannelPointsCustomRewardRedemptionAdd    func(ChannelPointsCustomRewardRedemptionAdd)
	OnChannelPointsCustomRewardRedemptionUpdate func(ChannelPointsCustomRewardRedemptionUpdate)
	OnChannelPollBegin                          func(ChannelPollBegin)
	OnChannelPollProgress                       func(ChannelPollProgress)
	OnChannelPollEnd                            func(ChannelPollEnd)
	OnChannelPredictionBegin                    func(ChannelPredictionBegin)
	OnChannelPredictionProgress                 func(ChannelPredictionProgress)
	OnChannelPredictionLock                     func(ChannelPredictionLock)
	OnChannelPredictionEnd                      func(ChannelPredictionEnd)
	OnChannelSuspiciousUserMessage              func(ChannelSuspiciousUserMessage)
	OnChannelSuspiciousUserUpdate               func(ChannelSuspiciousUserUpdate)
	OnChannelVIPAdd                             func(ChannelVIPAdd)
	OnChannelVIPRemove                          func(ChannelVIPRemove)
	OnChannelCharityCampaignDonate              func(ChannelCharityCampaignDonate)
	OnChannelCharityCampaignStart               func(ChannelCharityCampaignStart)
	OnChannelCharityCampaignProgress            func(ChannelCharityCampaignProgress)
	OnChannelCharityCampaignStop                func(ChannelCharityCampaignStop)
	OnConduitShardDisabled                      func(ConduitShardDisabled)
	OnDropEntitlementGrant                      func(DropEntitlementGrant)
	OnExtensionBitsTransactionCreate            func(ExtensionBitsTransactionCreate)
	OnChannelGoalBegin                          func(ChannelGoalBegin)
	OnChannelGoalProgress                       func(ChannelGoalProgress)
	OnChannelGoalEnd                            func(ChannelGoalEnd)
	OnChannelHypeTrainBegin                     func(ChannelHypeTrainBegin)
	OnChannelHypeTrainProgress                  func(ChannelHypeTrainProgress)
	OnChannelHypeTrainEnd                       func(ChannelHypeTrainEnd)
	OnChannelShieldModeBegin                    func(ChannelShieldModeBegin)
	OnChannelShieldModeEnd                      func(ChannelShieldModeEnd)
	OnChannelShoutoutCreate                     func(ChannelShoutoutCreate)
	OnChannelShoutoutReceive                    func(ChannelShoutoutReceive)
	OnStreamOnline                              func(StreamOnline)
	OnStreamOffline                             func(StreamOffline)
	OnUserAuthorizationGrant                    func(UserAuthorizationGrant)
	OnUserAuthorizationRevoke                   func(UserAuthorizationRevoke)
	OnUserUpdate                                func(UserUpdate)
	OnUserWhisperMessage                        func(UserWhisperMessage)
	// contains filtered or unexported fields
}

func New

func New(config ClientConfig) (*Client, error)

Creates a new client

func (*Client) AddSubscription

func (c *Client) AddSubscription(Type string, version string, condition Condition) error

AddSubscription attemps to create a new subscription based on the type, version, and condition. You can find all subscription types, versions, and conditions at: EventSub subscription types. It will block until Twitch sends the verification request, or timeout after 10 seconds.

!! AddSubscription should only be called AFTER twitchwh.Client.Handler is set up accordingly. !!

// Setup the HTTP event handler
http.HandleFunc("/eventsub", client.Handler)
go http.ListenAndServe(":8080", nil)

_ := client.AddSubscription("stream.online", "1", twitchwh.Condition{
	BroadcasterUserID: "215185844",
})

func (*Client) GetSubscriptions

func (c *Client) GetSubscriptions() (subscriptions []Subscription, err error)

GetSubscriptions retrieves all subscriptions, including revoked ones. Automatically handles pagination.

Returns subscriptions and an error (if any).

func (*Client) GetSubscriptionsByStatus

func (c *Client) GetSubscriptionsByStatus(status string) (subscriptions []Subscription, err error)

Get all subscriptions with the provided status. For a list of all status types see: https://dev.twitch.tv/docs/api/reference/#get-eventsub-subscriptions . Automatically handles pagination.

Returns subscriptions and an error (if any).

func (*Client) GetSubscriptionsByType

func (c *Client) GetSubscriptionsByType(Type string) (subscriptions []Subscription, err error)

Get all subscriptions that match the provided type (eg. "stream.online"). Automatically handles pagination.

Returns subscriptions and an error (if any).

func (*Client) Handler

func (c *Client) Handler(w http.ResponseWriter, r *http.Request)

Handler is the HTTP handler for requests from Twitch. It is up to you to assign this handler to the correct path according to your setup

client, _ := twitchwh.New(twitchwh.ClientConfig{
	// ...
	WebhookURL:    "https://mydomain.com/eventsub",
})
http.HandleFunc("/eventsub", client.Handler)
http.ListenAndServe(":443", nil)

This example assumes https://mydomain.com is pointing to the Go app.

func (*Client) RemoveSubscription

func (c *Client) RemoveSubscription(id string) error

RemoveSubscription attempts to remove a subscription based on the ID.

func (*Client) RemoveSubscriptionByType added in v0.0.2

func (c *Client) RemoveSubscriptionByType(Type string, condition Condition) error

RemoveSubscriptionByType attempts to remove a subscription based on the type and condition.

If no subscriptions are found, it will return nil.

Note: This will remove ALL subscriptions that match the provided type and condition.

func (*Client) SetToken added in v0.0.4

func (c *Client) SetToken(token string)

Assign a new app access token This should only be used if you have your own token validation and regeneration logic. This is builtin to twitchwh, but can be disabled using twitchwh.ClientConfig.ShouldValidate.

type ClientConfig

type ClientConfig struct {
	// Client ID of your Twitch application
	ClientID string
	// Client Secret generated for your Twitch application. !! THIS IS NOT YOUR WEBHOOK SECRET !!
	ClientSecret string
	// If you have generated a token elsewhere in your project you can supply it here
	Token string
	// Webhook secret used to verify events. This should be a random string between 10-100 characters
	WebhookSecret string
	// Full EventSub URL path, eg: https://mydomain.com/eventsub
	WebhookURL string
	// If you have your own token logic, you should set this to true and update tokens using Client.SetToken to prevent duplicates.
	// If this is false twitchwh will use its own internal token generation and validation system.
	ExternalToken bool
	// Log output
	Debug bool
}

ClientConfig is used to configure a new Client

type Condition

type Condition struct {
	// broadcaster_user_id
	BroadcasterUserID string `json:"broadcaster_user_id,omitempty"`

	// moderator_user_id
	ModeratorUserID string `json:"moderator_user_id,omitempty"`

	// user_id
	UserID string `json:"user_id,omitempty"`

	// from_broadcaster_id
	FromBroadcasterUserID string `json:"from_broadcaster_user_id,omitempty"`

	// to_broadcaster_id
	ToBroadcasterUserID string `json:"to_broadcaster_user_id,omitempty"`

	// reward_id
	//
	// This should be int/string depending on subscription type
	RewardID any `json:"reward_id,omitempty"`

	// client_id
	ClientID string `json:"client_id,omitempty"`

	// extension_client_id
	ExtensionClientID string `json:"extension_client_id,omitempty"`

	// conduit_id
	ConduitID string `json:"conduit_id,omitempty"`

	// organization_id
	OrganizationID string `json:"organization_id,omitempty"`

	// category_id
	CategoryID string `json:"category_id,omitempty"`

	// campaign_id
	CampaignID string `json:"campaign_id,omitempty"`
}

Condition for subscription. Empty values will be omitted. Fill out the options applicable to your subscription type

type ConduitShardDisabled

type ConduitShardDisabled struct {
	ConduitID string `json:"conduit_id"`
	ShardID   string `json:"shard_id"`
	Status    string `json:"status"`
	Transport struct {
		Method         string    `json:"method"`
		Callback       string    `json:"callback"`
		SessionID      string    `json:"session_id"`
		ConnectedAt    time.Time `json:"connected_at"`
		DisconnectedAt time.Time `json:"disconnected_at"`
	}
}

conduit.shard.disabled https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#conduitsharddisabled

type DropEntitlementGrant

type DropEntitlementGrant []struct {
	ID   string `json:"id"`
	Data struct {
		OrganizationID string    `json:"organization_id"`
		CategoryID     string    `json:"category_id"`
		CategoryName   string    `json:"category_name"`
		UserID         string    `json:"user_id"`
		UserName       string    `json:"user_name"`
		UserLogin      string    `json:"user_login"`
		EntitlementID  string    `json:"entitlement_id"`
		BenefitID      string    `json:"benefit_id"`
		CreatedAt      time.Time `json:"created_at"`
	} `json:"data"`
}

drop.entitlement.grant https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#dropentitlementgrant

type DuplicateSubscriptionError added in v0.0.3

type DuplicateSubscriptionError struct {
	Condition Condition
	Type      string
}

Attempted to add a subscription with a type and condition that already exists.

The Condition and Type fields are included in the error.

func (*DuplicateSubscriptionError) Error added in v0.0.3

type ExtensionBitsTransactionCreate

type ExtensionBitsTransactionCreate struct {
	ID                   string `json:"id"`
	ExtensionClientID    string `json:"extension_client_id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	UserName             string `json:"user_name"`
	UserLogin            string `json:"user_login"`
	UserID               string `json:"user_id"`
	Product              struct {
		Name          string `json:"name"`
		SKU           string `json:"sku"`
		Bits          int    `json:"bits"`
		InDevelopment bool   `json:"in_development"`
	} `json:"product"`
}

extension.bits_transaction.create https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#extensionbits_transactioncreate

type InternalError added in v0.0.3

type InternalError struct {

	// Original error that caused this error, if any.
	OriginalError error
	// contains filtered or unexported fields
}

Returned for misc errors, like network or serialization errors for example.

func (*InternalError) Error added in v0.0.3

func (e *InternalError) Error() string

type StreamOffline

type StreamOffline struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

stream.offline https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#streamoffline

type StreamOnline

type StreamOnline struct {
	ID                   string    `json:"id"`
	BroadcasterUserID    string    `json:"broadcaster_user_id"`
	BroadcasterUserLogin string    `json:"broadcaster_user_login"`
	BroadcasterUserName  string    `json:"broadcaster_user_name"`
	Type                 string    `json:"live"`
	StartedAt            time.Time `json:"started_at"`
}

stream.online https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#streamonline

type Subscription

type Subscription struct {
	ID      string `json:"id"`
	Status  string `json:"status"`
	Type    string `json:"type"`
	Version string `json:"version"`
	Cost    int    `json:"cost"`
	// PLEASE NOTE that this will DEFAULT all unused conditions. Check the Type and get the correct condition for that type.
	Condition Condition `json:"condition"`
	Transport struct {
		Method   string `json:"method"`
		Callback string `json:"callback"`
	} `json:"transport"`
	CreatedAt time.Time `json:"created_at"`
}

type SubscriptionNotFoundError added in v0.0.3

type SubscriptionNotFoundError struct{}

Could not find a subscription with the specified parameters.

func (*SubscriptionNotFoundError) Error added in v0.0.3

func (e *SubscriptionNotFoundError) Error() string

type UnauthorizedError added in v0.0.3

type UnauthorizedError struct {
	Body []byte
}

Helix returned an authorization error. This usually means the token, Client-ID, or client secret are invalid.

func (*UnauthorizedError) Error added in v0.0.3

func (e *UnauthorizedError) Error() string

type UnhandledStatusError added in v0.0.3

type UnhandledStatusError struct {
	Status int
	Body   []byte
}

Helix returned an unexpected HTTP status code that is not handled by TwitchWH.

func (*UnhandledStatusError) Error added in v0.0.3

func (e *UnhandledStatusError) Error() string

type UserAuthorizationGrant

type UserAuthorizationGrant struct {
	ClientID  string `json:"client_id"`
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
}

user.authorization.grant https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userauthorizationgrant

type UserAuthorizationRevoke

type UserAuthorizationRevoke struct {
	ClientID  string `json:"client_id"`
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
}

user.authorization.revoke https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userauthorizationrevoke

type UserUpdate

type UserUpdate struct {
	UserID        string `json:"user_id"`
	UserLogin     string `json:"user_login"`
	UserName      string `json:"user_name"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Description   string `json:"description"`
}

user.update https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userupdate

type UserWhisperMessage

type UserWhisperMessage struct {
	FromUserID    string `json:"from_user_id"`
	FromUserLogin string `json:"from_user_login"`
	FromUserName  string `json:"from_user_name"`
	ToUserID      string `json:"to_user_id"`
	ToUserLogin   string `json:"to_user_login"`
	ToUserName    string `json:"to_user_name"`
	WhiperID      string `json:"whisper_id"`
	Whisper       struct {
		Text string `json:"text"`
	}
}

user.whisper.message https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userwhispermessage

type VerificationTimeoutError added in v0.0.3

type VerificationTimeoutError struct {
	Subscription Subscription
}

Returned whenever AddSubscription times out waiting for verification confirmation.

func (*VerificationTimeoutError) Error added in v0.0.3

func (e *VerificationTimeoutError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL