Initial Commit

Initial commit of Code Base.
This commit is contained in:
Mario Steele 2025-06-12 14:31:14 -05:00
parent 293b1213e1
commit c11a4ebbc2
653 changed files with 36893 additions and 1 deletions

View file

@ -0,0 +1,72 @@
@tool
@icon("../assets/event-icon.svg")
extends Twitcher
## Listens to an event and publishes it as signal.
## Usage for easy access of events on test and normal eventsub makes it more obvious what a scene
## is listening before diving in the code.
## [b]Expects that the signal was already configured in the eventsub or manually subscribed[/b]
class_name TwitchEventListener
static var _log : TwitchLogger = TwitchLogger.new("TwitchEventListener")
@export var eventsub: TwitchEventsub:
set = _update_eventsub
@export var subscription: TwitchEventsubDefinition.Type:
set(val):
subscription = val
subscription_definition = TwitchEventsubDefinition.ALL[subscription]
update_configuration_warnings()
var subscription_definition: TwitchEventsubDefinition
## Called when the event got received
signal received(data: Dictionary)
func _ready() -> void:
_update_eventsub(eventsub)
func _enter_tree() -> void:
start_listening()
func _exit_tree() -> void:
stop_listening()
func start_listening() -> void:
_log.d("start listening %s" % subscription_definition.get_readable_name())
if eventsub != null && not eventsub.event.is_connected(_on_received):
eventsub.event.connect(_on_received)
func stop_listening() -> void:
_log.d("stop listening %s" % subscription_definition.get_readable_name())
if eventsub != null && eventsub.event.is_connected(_on_received):
eventsub.event.disconnect(_on_received)
func _update_eventsub(val: TwitchEventsub):
stop_listening()
eventsub = val
update_configuration_warnings()
if val == null: return
start_listening()
func _on_received(type: String, data: Dictionary):
if type == subscription_definition.value:
received.emit(data)
func _get_configuration_warnings() -> PackedStringArray:
var result: PackedStringArray = []
if eventsub == null:
result.append("'EventSub' is missing")
if subscription == null:
result.append("'Subscription' is missing")
return result

View file

@ -0,0 +1 @@
uid://bol5ltrjr6ux8

View file

@ -0,0 +1,379 @@
@icon("res://addons/twitcher/assets/eventsub-icon.svg")
@tool
extends Twitcher
## Handles the evensub part of twitch. Returns the event data when receives it.
class_name TwitchEventsub
static var _log: TwitchLogger = TwitchLogger.new("TwitchEventsub")
static var instance: TwitchEventsub
## An object that identifies the message.
class Metadata extends RefCounted:
## An ID that uniquely identifies the message. Twitch sends messages at least once, but if Twitch is unsure of whether you received a notification, itll resend the message. This means you may receive a notification twice. If Twitch resends the message, the message ID is the same.
var message_id: String
## The type of message, which is set to session_keepalive.
var message_type: String
## The UTC date and time that the message was sent.
var message_timestamp: String
func _init(d: Dictionary):
message_id = d['message_id']
message_type = d['message_type']
message_timestamp = d['message_timestamp']
## An object that contains information about the connection.
class Session extends RefCounted:
## An ID that uniquely identifies this WebSocket connection. Use this ID to set the session_id field in all subscription requests.
var id: String
## The connections status, which is set to connected.
var status: String
## The maximum number of seconds that you should expect silence before receiving a keepalive message. For a welcome message, this is the number of seconds that you have to subscribe to an event after receiving the welcome message. If you dont subscribe to an event within this window, the socket is disconnected.
var keepalive_timeout_seconds: int
## The URL to reconnect to if you get a Reconnect message. Is set to null.
var reconnect_url: String
## The UTC date and time that the connection was created.
var connected_at: String
func _init(d: Dictionary):
id = d["id"]
status = d["status"]
var timeout = d["keepalive_timeout_seconds"]
keepalive_timeout_seconds = timeout if timeout != null else 30
if d["reconnect_url"] != null:
reconnect_url = d["reconnect_url"]
connected_at = d["connected_at"]
## A specific event received from eventsub
class Event extends RefCounted:
var type: TwitchEventsubDefinition:
get(): return TwitchEventsubDefinition.BY_NAME[message.payload.subscription.type]
var data: Dictionary:
get(): return message.payload.event
var message: TwitchNotificationMessage
func _init(notification_message: TwitchNotificationMessage) -> void:
message = notification_message
## Will be send as soon as the websocket connection is up and running you can use it to subscribe to events
signal session_id_received(id: String)
## Will be called when an event is sent from Twitch.
signal event(type: StringName, data: Dictionary)
## Will be called when an event is sent from Twitch. Same like event signal but better named and easier to use in inline awaits.
signal event_received(event: Event)
## Will be called when an event got revoked from your subscription by Twitch.
signal events_revoked(type: StringName, status: String)
## Called when any eventsub message is received for low level access
signal message_received(message: Variant)
@export var api: TwitchAPI
@export var _subscriptions: Array[TwitchEventsubConfig] = []
@export var scopes: OAuthScopes
@export var eventsub_live_server_url: String = "wss://eventsub.wss.twitch.tv/ws"
@export var eventsub_test_server_url: String = "ws://127.0.0.1:8080/ws"
@export var use_test_server: bool
@export var ignore_message_eventsub_in_seconds: int = 600
var _client: WebsocketClient = WebsocketClient.new()
var _test_client : WebsocketClient = WebsocketClient.new()
## Swap over client in case Twitch sends us the message for a new server.
## See: https://dev.twitch.tv/docs/eventsub/handling-websocket-events/#reconnect-message
var _swap_over_client : WebsocketClient
var session: Session
## Holds the messages that was processed already.
## Key: MessageID Value: Timestamp
var eventsub_messages: Dictionary = {}
var last_keepalive: int
var is_open: bool:
get(): return _client.is_open
var _should_connect: bool
## When the Websocket server is shutting down and the client is doing a
## gracefull handover
var _swap_over_process: bool
## queues the actions that should be executed when the connection is established
var _action_stack: Array[SubscriptionAction]
var _executing_action_stack: bool
## Increased on every reconnect without subscriptions
var _empty_connections: int
## Determines the action that the subscription should do
class SubscriptionAction extends RefCounted:
var subscribe: bool
var subscription: TwitchEventsubConfig
func _to_string() -> String:
return "%s %s" % [("Subscribe to" if subscribe else "Unsubscribe from"), subscription.definition.get_readable_name()]
func _init() -> void:
_client.connection_url = eventsub_live_server_url
_client.message_received.connect(_data_received)
_client.connection_established.connect(_on_connection_established)
_client.connection_closed.connect(_on_connection_closed)
_test_client.connection_url = eventsub_test_server_url
_test_client.message_received.connect(_data_received)
func _ready() -> void:
_client.name = "Websocket Client"
add_child(_client)
if use_test_server:
_test_client.name = "Websocket Client Test"
add_child(_test_client)
if api == null: api = TwitchAPI.instance
func _enter_tree() -> void:
if instance == null: instance = self
func _exit_tree() -> void:
if instance == self: instance = null
## Propergated call from twitch service
func do_setup() -> void:
await open_connection()
_log.i("Eventsub setup")
func wait_setup() -> void:
await wait_for_session_established()
## Waits until the eventsub is fully established
func wait_for_session_established() -> void:
if session == null: await session_id_received
func _on_connection_established() -> void:
if not _swap_over_process:
_action_stack.clear()
if _subscriptions.is_empty(): _empty_connections += 1
if _empty_connections >= 3:
_empty_connections = 0
_log.e("Stopped eventsub cause of no subscription.")
close_connection()
return
# Resubscribe
_log.i("Connection established -> resubscribe to: [%s]" % [_subscriptions])
for sub in _subscriptions: _add_action(sub, true)
_execute_action_stack()
func _on_connection_closed() -> void:
session = null
func open_connection() -> void:
if _client.is_closed:
_client.open_connection()
if _test_client.is_closed && use_test_server:
_test_client.open_connection()
func close_connection() -> void:
if not _client.is_closed:
_client.close()
if not _test_client.is_closed:
_test_client.close()
## Add a new subscription
func subscribe(eventsub_config: TwitchEventsubConfig) -> void:
_log.i("Subscribe to %s" % eventsub_config.definition.get_readable_name())
_subscriptions.append(eventsub_config)
_add_action(eventsub_config, true)
_empty_connections = 0
func has_subscription(eventsub_definition: TwitchEventsubDefinition, condition: Dictionary) -> bool:
for subscription: TwitchEventsubConfig in _subscriptions:
if subscription.definition == eventsub_definition && subscription.condition == condition:
return true
return false
## Remove a subscription
func unsubscribe(eventsub_config: TwitchEventsubConfig) -> void:
_subscriptions.erase(eventsub_config)
_add_action(eventsub_config, false)
## Process the queue of actions until its empty
func _execute_action_stack() -> void:
if _executing_action_stack: return
await wait_for_session_established()
_log.d("Execute actions [%s]" % [_action_stack])
_executing_action_stack = true
while not _action_stack.is_empty():
var action = _action_stack.pop_back()
var sub: TwitchEventsubConfig = action.subscription
if action.subscribe:
_subscribe(sub)
else:
_unsubscribe(sub)
_executing_action_stack = false
## Adds a subscribe or unsubscribe action to the queue
func _add_action(sub: TwitchEventsubConfig, subscribe: bool) -> void:
var sub_action = SubscriptionAction.new()
sub_action.subscription = sub
sub_action.subscribe = subscribe
_action_stack.append(sub_action)
_log.d("Add subscribe action: %s" % sub.definition.get_readable_name())
_execute_action_stack()
## Refer to https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/
## for details on which API versions are available and which conditions are required.
func _subscribe(subscription: TwitchEventsubConfig) -> String:
var event_name = subscription.definition.value
var version = subscription.definition.version
var conditions = subscription.condition
var data : TwitchCreateEventSubSubscription.Body = TwitchCreateEventSubSubscription.Body.new()
var transport : TwitchCreateEventSubSubscription.BodyTransport = TwitchCreateEventSubSubscription.BodyTransport.new()
data.type = event_name
data.version = version
data.condition = conditions
data.transport = transport
transport.method = "websocket"
transport.session_id = session.id
_log.d("Do subscribe: %s" % event_name)
var eventsub_response = await api.create_eventsub_subscription(data)
if eventsub_response.response.response_code == 401:
_log.e("Subscription failed for '%s': Missing authentication for eventsub. The token got not authenticated yet. Please login!" % data.type)
_client.close(3000, "Missing Authentication")
return ""
elif eventsub_response.response.response_code == 403:
_log.e("Subscription failed for '%s': The token is missing proper scopes. [url='%s']Please check documentation[/url]!" % [data.type, subscription.definition.documentation_link])
_log.d(eventsub_response.response.response_data.get_string_from_utf8())
_client.close(3003, "Missing Authorization")
return ""
if eventsub_response.response.response_code < 200 || eventsub_response.response.response_code >= 300:
_log.e("Subscription failed for '%s'. Unknown error %s: %s" % [data.type, eventsub_response.response.response_code, eventsub_response.response.response_data.get_string_from_utf8()])
return ""
elif (eventsub_response.response.response_data.is_empty()):
return ""
_log.i("Now listening to '%s' events." % data.type)
var result = JSON.parse_string(eventsub_response.response.response_data.get_string_from_utf8())
return result.data[0].id
## Unsubscribes from an eventsub in case of an error returns false
func _unsubscribe(subscription: TwitchEventsubConfig) -> bool:
var response = await api.delete_eventsub_subscription(subscription.id)
return response.error || response.response_code != 200
func _data_received(data : PackedByteArray) -> void:
var message_str : String = data.get_string_from_utf8()
var message_json : Dictionary = JSON.parse_string(message_str)
if not message_json.has("metadata"):
_log.e("Twitch send something undocumented: %s" % message_str)
return
var metadata : Metadata = Metadata.new(message_json["metadata"])
var id = metadata.message_id
var timestamp_str = metadata.message_timestamp
var timestamp = Time.get_unix_time_from_datetime_string(timestamp_str)
if(_message_got_processed(id) || _message_is_to_old(timestamp)):
return
eventsub_messages[id] = timestamp
last_keepalive = Time.get_ticks_msec()
match metadata.message_type:
"session_welcome":
var welcome_message = TwitchWelcomeMessage.new(message_json)
session = welcome_message.payload.session
session_id_received.emit(session.id)
_log.i("Session established %s" % session.id)
message_received.emit(welcome_message)
"session_keepalive":
# Notification from server that the connection is still alive
var keep_alive_message = TwitchKeepaliveMessage.new(message_json)
message_received.emit(keep_alive_message)
pass
"session_reconnect":
var reconnect_message = TwitchReconnectMessage.new(message_json)
message_received.emit(reconnect_message)
_handle_reconnect(reconnect_message)
"revocation":
var revocation_message = TwitchRevocationMessage.new(message_json)
message_received.emit(revocation_message)
events_revoked.emit(revocation_message.payload.subscription.type,
revocation_message.payload.subscription.status)
"notification":
var notification_message = TwitchNotificationMessage.new(message_json)
message_received.emit(notification_message)
event.emit(notification_message.payload.subscription.type,
notification_message.payload.event)
event_received.emit(Event.new(notification_message))
_cleanup()
func _handle_reconnect(reconnect_message: TwitchReconnectMessage):
_log.i("Session is forced to reconnect")
_swap_over_process = true
var reconnect_url = reconnect_message.payload.session.reconnect_url
_swap_over_client = WebsocketClient.new()
_swap_over_client.message_received.connect(_data_received)
_swap_over_client.connection_established.connect(_on_connection_established)
_swap_over_client.connection_url = reconnect_url
add_child(_swap_over_client)
_swap_over_client.open_connection()
await session_id_received
_client.close(1000, "Closed cause of reconnect.")
remove_child(_client)
_client = _swap_over_client
_swap_over_client = null
_swap_over_process = false
_log.i("Session reconnected on %s" % reconnect_url)
## Cleanup old messages that won't be processed anymore cause of time to prevent a
## memory problem on long runinng applications.
func _cleanup() -> void:
for message_id in eventsub_messages.keys():
var timestamp = eventsub_messages[message_id]
if _message_is_to_old(timestamp):
eventsub_messages.erase(message_id)
func _message_got_processed(message_id: String) -> bool:
return eventsub_messages.has(message_id)
func _message_is_to_old(timestamp: int) -> bool:
return timestamp < Time.get_unix_time_from_system() - ignore_message_eventsub_in_seconds
func get_client() -> WebsocketClient:
return _client
func get_test_client() -> WebsocketClient:
return _test_client
## Returns a copy of the current subscribed events. Don't modify the result they won't get applied anyway.
func get_subscriptions() -> Array[TwitchEventsubConfig]:
return _subscriptions.duplicate()

View file

@ -0,0 +1 @@
uid://blmhj3j00yk45

View file

@ -0,0 +1,47 @@
@tool
extends Resource
## Defines howto subscribe to a eventsub subscription.
class_name TwitchEventsubConfig
static var _log: TwitchLogger = TwitchLogger.new("TwitchEventsubConfig")
## What do you want to subscribe
@export var type: TwitchEventsubDefinition.Type:
set = _update_type
## How do you want to subscribe defined by `definition conditions`.
@export var condition: Dictionary = {}
var definition: TwitchEventsubDefinition:
get(): return TwitchEventsubDefinition.ALL[type]
## Send from the server to identify the subscription for unsubscribing
var id: String
## Called when type changed
signal type_changed(new_type: TwitchEventsubDefinition.Type)
static func create(definition: TwitchEventsubDefinition, conditions: Dictionary) -> TwitchEventsubConfig:
var config = TwitchEventsubConfig.new()
config.type = definition.type
config.condition = conditions
for condition_name: StringName in definition.conditions:
if not conditions.has(condition_name):
_log.w("You miss probably following condition %s" % condition_name)
return config
func _update_type(val: TwitchEventsubDefinition.Type) -> void:
if type != val:
type = val
var definition: TwitchEventsubDefinition = TwitchEventsubDefinition.ALL[type]
var new_condition: Dictionary = {}
for condition_key: StringName in definition.conditions:
new_condition[condition_key] = condition.get(condition_key, "")
condition = new_condition
type_changed.emit(val)
func _to_string() -> String:
return "%s" % definition.get_readable_name()

View file

@ -0,0 +1 @@
uid://cjug64e3433g0

View file

@ -0,0 +1,357 @@
@tool
extends Object
class_name TwitchEventsubDefinition
## All supported subscriptions should be used in comination with get_all method as index.
enum Type {
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_MODERATE_V2,
CHANNEL_MODERATOR_ADD,
CHANNEL_MODERATOR_REMOVE,
CHANNEL_GUEST_STAR_SESSION_BEGIN,
CHANNEL_GUEST_STAR_SESSION_END,
CHANNEL_GUEST_STAR_GUEST_UPDATE,
CHANNEL_GUEST_STAR_SETTINGS_UPDATE,
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_UPDATE,
CHANNEL_SUSPICIOUS_USER_MESSAGE,
CHANNEL_VIP_ADD,
CHANNEL_VIP_REMOVE,
CHANNEL_WARNING_ACKNOWLEDGE,
CHANNEL_WARNING_SEND,
CHANNEL_HYPE_TRAIN_BEGIN,
CHANNEL_HYPE_TRAIN_PROGRESS,
CHANNEL_HYPE_TRAIN_END,
CHANNEL_CHARITY_CAMPAIGN_DONATE,
CHANNEL_CHARITY_CAMPAIGN_START,
CHANNEL_CHARITY_CAMPAIGN_PROGRESS,
CHANNEL_CHARITY_CAMPAIGN_STOP,
CHANNEL_SHARED_CHAT_BEGIN,
CHANNEL_SHARED_CHAT_UPDATE,
CHANNEL_SHARED_CHAT_END,
CHANNEL_SHIELD_MODE_BEGIN,
CHANNEL_SHIELD_MODE_END,
CHANNEL_SHOUTOUT_CREATE,
CHANNEL_SHOUTOUT_RECEIVE,
CONDUIT_SHARD_DISABLED,
DROP_ENTITLEMENT_GRANT,
EXTENSION_BITS_TRANSACTION_CREATE,
CHANNEL_GOAL_BEGIN,
CHANNEL_GOAL_PROGRESS,
CHANNEL_GOAL_END,
STREAM_ONLINE,
STREAM_OFFLINE,
USER_AUTHORIZATION_GRANT,
USER_AUTHORIZATION_REVOKE,
USER_UPDATE,
USER_WHISPER_MESSAGE,
}
## The type of itself
var type: Type
## Name within Twitch
var value: StringName
## Version defined in Twitch
var version: StringName
## Keys of the conditions it need for setup
var conditions: Array[StringName]
## Possible scopes it needs (on some of them its more then needed)
var scopes: Array[StringName]
## Link to the twitch documentation
var documentation_link: String
func _init(typ: Type, val: StringName, ver: StringName, cond: Array[StringName], scps: Array[StringName], doc_link: String):
type = typ
value = val
version = ver
conditions = cond
scopes = scps
documentation_link = doc_link
## Get a human readable name of it
func get_readable_name() -> String:
return "%s (v%s)" % [value, version]
static var AUTOMOD_MESSAGE_HOLD := TwitchEventsubDefinition.new(Type.AUTOMOD_MESSAGE_HOLD, &"automod.message.hold", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:automod"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodmessagehold")
static var AUTOMOD_MESSAGE_UPDATE := TwitchEventsubDefinition.new(Type.AUTOMOD_MESSAGE_UPDATE, &"automod.message.update", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:automod"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodmessageupdate")
static var AUTOMOD_SETTINGS_UPDATE := TwitchEventsubDefinition.new(Type.AUTOMOD_SETTINGS_UPDATE, &"automod.settings.update", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:automod_settings"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodsettingsupdate")
static var AUTOMOD_TERMS_UPDATE := TwitchEventsubDefinition.new(Type.AUTOMOD_TERMS_UPDATE, &"automod.terms.update", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:automod"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#automodtermsupdate")
static var CHANNEL_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_UPDATE, &"channel.update", &"2", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelupdate")
static var CHANNEL_FOLLOW := TwitchEventsubDefinition.new(Type.CHANNEL_FOLLOW, &"channel.follow", &"2", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:followers"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelfollow")
static var CHANNEL_AD_BREAK_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_AD_BREAK_BEGIN, &"channel.ad_break.begin", &"1", [&"broadcaster_user_id"], [&"channel:read:ads"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelad_breakbegin")
static var CHANNEL_CHAT_CLEAR := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_CLEAR, &"channel.chat.clear", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatclear")
static var CHANNEL_CHAT_CLEAR_USER_MESSAGES := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_CLEAR_USER_MESSAGES, &"channel.chat.clear_user_messages", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatclear_user_messages")
static var CHANNEL_CHAT_MESSAGE := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_MESSAGE, &"channel.chat.message", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatmessage")
static var CHANNEL_CHAT_MESSAGE_DELETE := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_MESSAGE_DELETE, &"channel.chat.message_delete", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatmessage_delete")
static var CHANNEL_CHAT_NOTIFICATION := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_NOTIFICATION, &"channel.chat.notification", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatnotification")
static var CHANNEL_CHAT_SETTINGS_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_SETTINGS_UPDATE, &"channel.chat_settings.update", &"1", [&"broadcaster_user_id",&"user_id"], [&"channel:bot",&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchat_settingsupdate")
static var CHANNEL_CHAT_USER_MESSAGE_HOLD := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_USER_MESSAGE_HOLD, &"channel.chat.user_message_hold", &"1", [&"broadcaster_user_id",&"user_id"], [&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatuser_message_hold")
static var CHANNEL_CHAT_USER_MESSAGE_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_CHAT_USER_MESSAGE_UPDATE, &"channel.chat.user_message_update", &"1", [&"broadcaster_user_id",&"user_id"], [&"user:bot",&"user:read:chat"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchatuser_message_update")
static var CHANNEL_SUBSCRIBE := TwitchEventsubDefinition.new(Type.CHANNEL_SUBSCRIBE, &"channel.subscribe", &"1", [&"broadcaster_user_id"], [&"channel:read:subscriptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscribe")
static var CHANNEL_SUBSCRIPTION_END := TwitchEventsubDefinition.new(Type.CHANNEL_SUBSCRIPTION_END, &"channel.subscription.end", &"1", [&"broadcaster_user_id"], [&"channel:read:subscriptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptionend")
static var CHANNEL_SUBSCRIPTION_GIFT := TwitchEventsubDefinition.new(Type.CHANNEL_SUBSCRIPTION_GIFT, &"channel.subscription.gift", &"1", [&"broadcaster_user_id"], [&"channel:read:subscriptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptiongift")
static var CHANNEL_SUBSCRIPTION_MESSAGE := TwitchEventsubDefinition.new(Type.CHANNEL_SUBSCRIPTION_MESSAGE, &"channel.subscription.message", &"1", [&"broadcaster_user_id"], [&"channel:read:subscriptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptionmessage")
static var CHANNEL_CHEER := TwitchEventsubDefinition.new(Type.CHANNEL_CHEER, &"channel.cheer", &"1", [&"broadcaster_user_id"], [&"bits:read"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcheer")
static var CHANNEL_RAID := TwitchEventsubDefinition.new(Type.CHANNEL_RAID, &"channel.raid", &"1", [&"to_broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelraid")
static var CHANNEL_BAN := TwitchEventsubDefinition.new(Type.CHANNEL_BAN, &"channel.ban", &"1", [&"broadcaster_user_id"], [&"channel:moderate"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelban")
static var CHANNEL_UNBAN := TwitchEventsubDefinition.new(Type.CHANNEL_UNBAN, &"channel.unban", &"1", [&"broadcaster_user_id"], [&"channel:moderate"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban")
static var CHANNEL_UNBAN_REQUEST_CREATE := TwitchEventsubDefinition.new(Type.CHANNEL_UNBAN_REQUEST_CREATE, &"channel.unban_request.create", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:unban_requests",&"moderator:manage:unban_requests"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban_requestcreate")
static var CHANNEL_UNBAN_REQUEST_RESOLVE := TwitchEventsubDefinition.new(Type.CHANNEL_UNBAN_REQUEST_RESOLVE, &"channel.unban_request.resolve", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:unban_requests",&"moderator:manage:unban_requests"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelunban_requestresolve")
static var CHANNEL_MODERATE := TwitchEventsubDefinition.new(Type.CHANNEL_MODERATE, &"channel.moderate", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:banned_users",&"moderator:manage:blocked_terms",&"moderator:read:banned_users",&"moderator:manage:chat_messages",&"moderator:manage:unban_requests",&"moderator:manage:chat_settings",&"moderator:read:unban_requests",&"moderator:read:chat_settings",&"moderator:read:vips",&"moderator:read:chat_messages",&"moderator:read:blocked_terms",&"moderator:read:moderators"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderate")
static var CHANNEL_MODERATE_V2 := TwitchEventsubDefinition.new(Type.CHANNEL_MODERATE_V2, &"channel.moderate", &"2", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:banned_users",&"moderator:manage:blocked_terms",&"moderator:read:banned_users",&"moderator:manage:chat_messages",&"moderator:manage:unban_requests",&"moderator:manage:warnings",&"moderator:manage:chat_settings",&"moderator:read:unban_requests",&"moderator:read:chat_settings",&"moderator:read:vips",&"moderator:read:warnings",&"moderator:read:chat_messages",&"moderator:read:blocked_terms",&"moderator:read:moderators"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderate-v2")
static var CHANNEL_MODERATOR_ADD := TwitchEventsubDefinition.new(Type.CHANNEL_MODERATOR_ADD, &"channel.moderator.add", &"1", [&"broadcaster_user_id"], [&"moderation:read"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderatoradd")
static var CHANNEL_MODERATOR_REMOVE := TwitchEventsubDefinition.new(Type.CHANNEL_MODERATOR_REMOVE, &"channel.moderator.remove", &"1", [&"broadcaster_user_id"], [&"moderation:read"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelmoderatorremove")
static var CHANNEL_GUEST_STAR_SESSION_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_GUEST_STAR_SESSION_BEGIN, &"channel.guest_star_session.begin", &"beta", [&"broadcaster_user_id",&"moderator_user_id"], [&"channel:read:guest_star",&"moderator:manage:guest_star",&"moderator:read:guest_star",&"channel:manage:guest_star"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelguest_star_sessionbegin")
static var CHANNEL_GUEST_STAR_SESSION_END := TwitchEventsubDefinition.new(Type.CHANNEL_GUEST_STAR_SESSION_END, &"channel.guest_star_session.end", &"beta", [&"broadcaster_user_id",&"moderator_user_id"], [&"channel:read:guest_star",&"moderator:manage:guest_star",&"moderator:read:guest_star",&"channel:manage:guest_star"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelguest_star_sessionend")
static var CHANNEL_GUEST_STAR_GUEST_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_GUEST_STAR_GUEST_UPDATE, &"channel.guest_star_guest.update", &"beta", [&"broadcaster_user_id",&"moderator_user_id"], [&"channel:read:guest_star",&"moderator:manage:guest_star",&"moderator:read:guest_star",&"channel:manage:guest_star"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelguest_star_guestupdate")
static var CHANNEL_GUEST_STAR_SETTINGS_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_GUEST_STAR_SETTINGS_UPDATE, &"channel.guest_star_settings.update", &"beta", [&"broadcaster_user_id",&"moderator_user_id"], [&"channel:read:guest_star",&"moderator:manage:guest_star",&"moderator:read:guest_star",&"channel:manage:guest_star"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelguest_star_settingsupdate")
static var CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD, &"channel.channel_points_automatic_reward_redemption.add", &"1", [&"broadcaster_user_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_automatic_reward_redemptionadd")
static var CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD, &"channel.channel_points_custom_reward.add", &"1", [&"broadcaster_user_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_custom_rewardadd")
static var CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE, &"channel.channel_points_custom_reward.update", &"1", [&"broadcaster_user_id",&"reward_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_custom_rewardupdate")
static var CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE, &"channel.channel_points_custom_reward.remove", &"1", [&"broadcaster_user_id",&"reward_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_custom_rewardremove")
static var CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD, &"channel.channel_points_custom_reward_redemption.add", &"1", [&"broadcaster_user_id",&"reward_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_custom_reward_redemptionadd")
static var CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE, &"channel.channel_points_custom_reward_redemption.update", &"1", [&"broadcaster_user_id",&"reward_id"], [&"channel:read:redemptions",&"channel:manage:redemptions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelchannel_points_custom_reward_redemptionupdate")
static var CHANNEL_POLL_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_POLL_BEGIN, &"channel.poll.begin", &"1", [&"broadcaster_user_id"], [&"channel:manage:polls",&"channel:read:polls"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpollbegin")
static var CHANNEL_POLL_PROGRESS := TwitchEventsubDefinition.new(Type.CHANNEL_POLL_PROGRESS, &"channel.poll.progress", &"1", [&"broadcaster_user_id"], [&"channel:manage:polls",&"channel:read:polls"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpollprogress")
static var CHANNEL_POLL_END := TwitchEventsubDefinition.new(Type.CHANNEL_POLL_END, &"channel.poll.end", &"1", [&"broadcaster_user_id"], [&"channel:manage:polls",&"channel:read:polls"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpollend")
static var CHANNEL_PREDICTION_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_PREDICTION_BEGIN, &"channel.prediction.begin", &"1", [&"broadcaster_user_id"], [&"channel:manage:predictions",&"channel:read:predictions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionbegin")
static var CHANNEL_PREDICTION_PROGRESS := TwitchEventsubDefinition.new(Type.CHANNEL_PREDICTION_PROGRESS, &"channel.prediction.progress", &"1", [&"broadcaster_user_id"], [&"channel:manage:predictions",&"channel:read:predictions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionprogress")
static var CHANNEL_PREDICTION_LOCK := TwitchEventsubDefinition.new(Type.CHANNEL_PREDICTION_LOCK, &"channel.prediction.lock", &"1", [&"broadcaster_user_id"], [&"channel:manage:predictions",&"channel:read:predictions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionlock")
static var CHANNEL_PREDICTION_END := TwitchEventsubDefinition.new(Type.CHANNEL_PREDICTION_END, &"channel.prediction.end", &"1", [&"broadcaster_user_id"], [&"channel:manage:predictions",&"channel:read:predictions"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelpredictionend")
static var CHANNEL_SUSPICIOUS_USER_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_SUSPICIOUS_USER_UPDATE, &"channel.suspicious_user.update", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:suspicious_users"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsuspicious_userupdate")
static var CHANNEL_SUSPICIOUS_USER_MESSAGE := TwitchEventsubDefinition.new(Type.CHANNEL_SUSPICIOUS_USER_MESSAGE, &"channel.suspicious_user.message", &"1", [&"moderator_user_id",&"broadcaster_user_id"], [&"moderator:read:suspicious_users"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsuspicious_usermessage")
static var CHANNEL_VIP_ADD := TwitchEventsubDefinition.new(Type.CHANNEL_VIP_ADD, &"channel.vip.add", &"1", [&"broadcaster_user_id"], [&"channel:manage:vips",&"channel:read:vips"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelvipadd")
static var CHANNEL_VIP_REMOVE := TwitchEventsubDefinition.new(Type.CHANNEL_VIP_REMOVE, &"channel.vip.remove", &"1", [&"broadcaster_user_id"], [&"channel:manage:vips",&"channel:read:vips"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelvipremove")
static var CHANNEL_WARNING_ACKNOWLEDGE := TwitchEventsubDefinition.new(Type.CHANNEL_WARNING_ACKNOWLEDGE, &"channel.warning.acknowledge", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:warnings",&"moderator:read:warnings"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelwarningacknowledge")
static var CHANNEL_WARNING_SEND := TwitchEventsubDefinition.new(Type.CHANNEL_WARNING_SEND, &"channel.warning.send", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:manage:warnings",&"moderator:read:warnings"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelwarningsend")
static var CHANNEL_HYPE_TRAIN_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_HYPE_TRAIN_BEGIN, &"channel.hype_train.begin", &"1", [&"broadcaster_user_id"], [&"channel:read:hype_train"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainbegin")
static var CHANNEL_HYPE_TRAIN_PROGRESS := TwitchEventsubDefinition.new(Type.CHANNEL_HYPE_TRAIN_PROGRESS, &"channel.hype_train.progress", &"1", [&"broadcaster_user_id"], [&"channel:read:hype_train"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainprogress")
static var CHANNEL_HYPE_TRAIN_END := TwitchEventsubDefinition.new(Type.CHANNEL_HYPE_TRAIN_END, &"channel.hype_train.end", &"1", [&"broadcaster_user_id"], [&"channel:read:hype_train"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelhype_trainend")
static var CHANNEL_CHARITY_CAMPAIGN_DONATE := TwitchEventsubDefinition.new(Type.CHANNEL_CHARITY_CAMPAIGN_DONATE, &"channel.charity_campaign.donate", &"1", [&"broadcaster_user_id"], [&"channel:read:charity"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaigndonate")
static var CHANNEL_CHARITY_CAMPAIGN_START := TwitchEventsubDefinition.new(Type.CHANNEL_CHARITY_CAMPAIGN_START, &"channel.charity_campaign.start", &"1", [&"broadcaster_user_id"], [&"channel:read:charity"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignstart")
static var CHANNEL_CHARITY_CAMPAIGN_PROGRESS := TwitchEventsubDefinition.new(Type.CHANNEL_CHARITY_CAMPAIGN_PROGRESS, &"channel.charity_campaign.progress", &"1", [&"broadcaster_user_id"], [&"channel:read:charity"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignprogress")
static var CHANNEL_CHARITY_CAMPAIGN_STOP := TwitchEventsubDefinition.new(Type.CHANNEL_CHARITY_CAMPAIGN_STOP, &"channel.charity_campaign.stop", &"1", [&"broadcaster_user_id"], [&"channel:read:charity"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelcharity_campaignstop")
static var CHANNEL_SHARED_CHAT_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_SHARED_CHAT_BEGIN, &"channel.shared_chat.begin", &"beta", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshared_chatbegin")
static var CHANNEL_SHARED_CHAT_UPDATE := TwitchEventsubDefinition.new(Type.CHANNEL_SHARED_CHAT_UPDATE, &"channel.shared_chat.update", &"beta", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshared_chatupdate")
static var CHANNEL_SHARED_CHAT_END := TwitchEventsubDefinition.new(Type.CHANNEL_SHARED_CHAT_END, &"channel.shared_chat.end", &"beta", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshared_chatend")
static var CHANNEL_SHIELD_MODE_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_SHIELD_MODE_BEGIN, &"channel.shield_mode.begin", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:shield_mode",&"moderator:manage:shield_mode"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshield_modebegin")
static var CHANNEL_SHIELD_MODE_END := TwitchEventsubDefinition.new(Type.CHANNEL_SHIELD_MODE_END, &"channel.shield_mode.end", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:shield_mode",&"moderator:manage:shield_mode"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshield_modeend")
static var CHANNEL_SHOUTOUT_CREATE := TwitchEventsubDefinition.new(Type.CHANNEL_SHOUTOUT_CREATE, &"channel.shoutout.create", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:shoutouts",&"moderator:manage:shoutouts"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshoutoutcreate")
static var CHANNEL_SHOUTOUT_RECEIVE := TwitchEventsubDefinition.new(Type.CHANNEL_SHOUTOUT_RECEIVE, &"channel.shoutout.receive", &"1", [&"broadcaster_user_id",&"moderator_user_id"], [&"moderator:read:shoutouts",&"moderator:manage:shoutouts"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelshoutoutreceive")
static var CONDUIT_SHARD_DISABLED := TwitchEventsubDefinition.new(Type.CONDUIT_SHARD_DISABLED, &"conduit.shard.disabled", &"1", [&"client_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#conduitsharddisabled")
static var DROP_ENTITLEMENT_GRANT := TwitchEventsubDefinition.new(Type.DROP_ENTITLEMENT_GRANT, &"drop.entitlement.grant", &"1", [&"organization_id",&"category_id",&"campaign_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#dropentitlementgrant")
static var EXTENSION_BITS_TRANSACTION_CREATE := TwitchEventsubDefinition.new(Type.EXTENSION_BITS_TRANSACTION_CREATE, &"extension.bits_transaction.create", &"1", [&"extension_client_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#extensionbits_transactioncreate")
static var CHANNEL_GOAL_BEGIN := TwitchEventsubDefinition.new(Type.CHANNEL_GOAL_BEGIN, &"channel.goal.begin", &"1", [&"broadcaster_user_id"], [&"channel:read:goals"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalbegin")
static var CHANNEL_GOAL_PROGRESS := TwitchEventsubDefinition.new(Type.CHANNEL_GOAL_PROGRESS, &"channel.goal.progress", &"1", [&"broadcaster_user_id"], [&"channel:read:goals"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalprogress")
static var CHANNEL_GOAL_END := TwitchEventsubDefinition.new(Type.CHANNEL_GOAL_END, &"channel.goal.end", &"1", [&"broadcaster_user_id"], [&"channel:read:goals"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelgoalend")
static var STREAM_ONLINE := TwitchEventsubDefinition.new(Type.STREAM_ONLINE, &"stream.online", &"1", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#streamonline")
static var STREAM_OFFLINE := TwitchEventsubDefinition.new(Type.STREAM_OFFLINE, &"stream.offline", &"1", [&"broadcaster_user_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#streamoffline")
static var USER_AUTHORIZATION_GRANT := TwitchEventsubDefinition.new(Type.USER_AUTHORIZATION_GRANT, &"user.authorization.grant", &"1", [&"client_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userauthorizationgrant")
static var USER_AUTHORIZATION_REVOKE := TwitchEventsubDefinition.new(Type.USER_AUTHORIZATION_REVOKE, &"user.authorization.revoke", &"1", [&"client_id"], [], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userauthorizationrevoke")
static var USER_UPDATE := TwitchEventsubDefinition.new(Type.USER_UPDATE, &"user.update", &"1", [&"user_id"], [&"user:read:email"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userupdate")
static var USER_WHISPER_MESSAGE := TwitchEventsubDefinition.new(Type.USER_WHISPER_MESSAGE, &"user.whisper.message", &"1", [&"user_id"], [&"user:manage:whispers",&"user:read:whispers"], "https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#userwhispermessage")
## Returns all supported subscriptions
static var ALL: Dictionary[TwitchEventsubDefinition.Type, TwitchEventsubDefinition] = {
Type.AUTOMOD_MESSAGE_HOLD: AUTOMOD_MESSAGE_HOLD,
Type.AUTOMOD_MESSAGE_UPDATE: AUTOMOD_MESSAGE_UPDATE,
Type.AUTOMOD_SETTINGS_UPDATE: AUTOMOD_SETTINGS_UPDATE,
Type.AUTOMOD_TERMS_UPDATE: AUTOMOD_TERMS_UPDATE,
Type.CHANNEL_UPDATE: CHANNEL_UPDATE,
Type.CHANNEL_FOLLOW: CHANNEL_FOLLOW,
Type.CHANNEL_AD_BREAK_BEGIN: CHANNEL_AD_BREAK_BEGIN,
Type.CHANNEL_CHAT_CLEAR: CHANNEL_CHAT_CLEAR,
Type.CHANNEL_CHAT_CLEAR_USER_MESSAGES: CHANNEL_CHAT_CLEAR_USER_MESSAGES,
Type.CHANNEL_CHAT_MESSAGE: CHANNEL_CHAT_MESSAGE,
Type.CHANNEL_CHAT_MESSAGE_DELETE: CHANNEL_CHAT_MESSAGE_DELETE,
Type.CHANNEL_CHAT_NOTIFICATION: CHANNEL_CHAT_NOTIFICATION,
Type.CHANNEL_CHAT_SETTINGS_UPDATE: CHANNEL_CHAT_SETTINGS_UPDATE,
Type.CHANNEL_CHAT_USER_MESSAGE_HOLD: CHANNEL_CHAT_USER_MESSAGE_HOLD,
Type.CHANNEL_CHAT_USER_MESSAGE_UPDATE: CHANNEL_CHAT_USER_MESSAGE_UPDATE,
Type.CHANNEL_SUBSCRIBE: CHANNEL_SUBSCRIBE,
Type.CHANNEL_SUBSCRIPTION_END: CHANNEL_SUBSCRIPTION_END,
Type.CHANNEL_SUBSCRIPTION_GIFT: CHANNEL_SUBSCRIPTION_GIFT,
Type.CHANNEL_SUBSCRIPTION_MESSAGE: CHANNEL_SUBSCRIPTION_MESSAGE,
Type.CHANNEL_CHEER: CHANNEL_CHEER,
Type.CHANNEL_RAID: CHANNEL_RAID,
Type.CHANNEL_BAN: CHANNEL_BAN,
Type.CHANNEL_UNBAN: CHANNEL_UNBAN,
Type.CHANNEL_UNBAN_REQUEST_CREATE: CHANNEL_UNBAN_REQUEST_CREATE,
Type.CHANNEL_UNBAN_REQUEST_RESOLVE: CHANNEL_UNBAN_REQUEST_RESOLVE,
Type.CHANNEL_MODERATE: CHANNEL_MODERATE,
Type.CHANNEL_MODERATE_V2: CHANNEL_MODERATE_V2,
Type.CHANNEL_MODERATOR_ADD: CHANNEL_MODERATOR_ADD,
Type.CHANNEL_MODERATOR_REMOVE: CHANNEL_MODERATOR_REMOVE,
Type.CHANNEL_GUEST_STAR_SESSION_BEGIN: CHANNEL_GUEST_STAR_SESSION_BEGIN,
Type.CHANNEL_GUEST_STAR_SESSION_END: CHANNEL_GUEST_STAR_SESSION_END,
Type.CHANNEL_GUEST_STAR_GUEST_UPDATE: CHANNEL_GUEST_STAR_GUEST_UPDATE,
Type.CHANNEL_GUEST_STAR_SETTINGS_UPDATE: CHANNEL_GUEST_STAR_SETTINGS_UPDATE,
Type.CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD: CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD,
Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD,
Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE,
Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE,
Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD,
Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE,
Type.CHANNEL_POLL_BEGIN: CHANNEL_POLL_BEGIN,
Type.CHANNEL_POLL_PROGRESS: CHANNEL_POLL_PROGRESS,
Type.CHANNEL_POLL_END: CHANNEL_POLL_END,
Type.CHANNEL_PREDICTION_BEGIN: CHANNEL_PREDICTION_BEGIN,
Type.CHANNEL_PREDICTION_PROGRESS: CHANNEL_PREDICTION_PROGRESS,
Type.CHANNEL_PREDICTION_LOCK: CHANNEL_PREDICTION_LOCK,
Type.CHANNEL_PREDICTION_END: CHANNEL_PREDICTION_END,
Type.CHANNEL_SUSPICIOUS_USER_UPDATE: CHANNEL_SUSPICIOUS_USER_UPDATE,
Type.CHANNEL_SUSPICIOUS_USER_MESSAGE: CHANNEL_SUSPICIOUS_USER_MESSAGE,
Type.CHANNEL_VIP_ADD: CHANNEL_VIP_ADD,
Type.CHANNEL_VIP_REMOVE: CHANNEL_VIP_REMOVE,
Type.CHANNEL_WARNING_ACKNOWLEDGE: CHANNEL_WARNING_ACKNOWLEDGE,
Type.CHANNEL_WARNING_SEND: CHANNEL_WARNING_SEND,
Type.CHANNEL_HYPE_TRAIN_BEGIN: CHANNEL_HYPE_TRAIN_BEGIN,
Type.CHANNEL_HYPE_TRAIN_PROGRESS: CHANNEL_HYPE_TRAIN_PROGRESS,
Type.CHANNEL_HYPE_TRAIN_END: CHANNEL_HYPE_TRAIN_END,
Type.CHANNEL_CHARITY_CAMPAIGN_DONATE: CHANNEL_CHARITY_CAMPAIGN_DONATE,
Type.CHANNEL_CHARITY_CAMPAIGN_START: CHANNEL_CHARITY_CAMPAIGN_START,
Type.CHANNEL_CHARITY_CAMPAIGN_PROGRESS: CHANNEL_CHARITY_CAMPAIGN_PROGRESS,
Type.CHANNEL_CHARITY_CAMPAIGN_STOP: CHANNEL_CHARITY_CAMPAIGN_STOP,
Type.CHANNEL_SHARED_CHAT_BEGIN: CHANNEL_SHARED_CHAT_BEGIN,
Type.CHANNEL_SHARED_CHAT_UPDATE: CHANNEL_SHARED_CHAT_UPDATE,
Type.CHANNEL_SHARED_CHAT_END: CHANNEL_SHARED_CHAT_END,
Type.CHANNEL_SHIELD_MODE_BEGIN: CHANNEL_SHIELD_MODE_BEGIN,
Type.CHANNEL_SHIELD_MODE_END: CHANNEL_SHIELD_MODE_END,
Type.CHANNEL_SHOUTOUT_CREATE: CHANNEL_SHOUTOUT_CREATE,
Type.CHANNEL_SHOUTOUT_RECEIVE: CHANNEL_SHOUTOUT_RECEIVE,
Type.CONDUIT_SHARD_DISABLED: CONDUIT_SHARD_DISABLED,
Type.DROP_ENTITLEMENT_GRANT: DROP_ENTITLEMENT_GRANT,
Type.EXTENSION_BITS_TRANSACTION_CREATE: EXTENSION_BITS_TRANSACTION_CREATE,
Type.CHANNEL_GOAL_BEGIN: CHANNEL_GOAL_BEGIN,
Type.CHANNEL_GOAL_PROGRESS: CHANNEL_GOAL_PROGRESS,
Type.CHANNEL_GOAL_END: CHANNEL_GOAL_END,
Type.STREAM_ONLINE: STREAM_ONLINE,
Type.STREAM_OFFLINE: STREAM_OFFLINE,
Type.USER_AUTHORIZATION_GRANT: USER_AUTHORIZATION_GRANT,
Type.USER_AUTHORIZATION_REVOKE: USER_AUTHORIZATION_REVOKE,
Type.USER_UPDATE: USER_UPDATE,
Type.USER_WHISPER_MESSAGE: USER_WHISPER_MESSAGE,
}
## Returns all supported subscriptions by name
static var BY_NAME: Dictionary[StringName, TwitchEventsubDefinition] = {
AUTOMOD_MESSAGE_HOLD.value: AUTOMOD_MESSAGE_HOLD,
AUTOMOD_MESSAGE_UPDATE.value: AUTOMOD_MESSAGE_UPDATE,
AUTOMOD_SETTINGS_UPDATE.value: AUTOMOD_SETTINGS_UPDATE,
AUTOMOD_TERMS_UPDATE.value: AUTOMOD_TERMS_UPDATE,
CHANNEL_UPDATE.value: CHANNEL_UPDATE,
CHANNEL_FOLLOW.value: CHANNEL_FOLLOW,
CHANNEL_AD_BREAK_BEGIN.value: CHANNEL_AD_BREAK_BEGIN,
CHANNEL_CHAT_CLEAR.value: CHANNEL_CHAT_CLEAR,
CHANNEL_CHAT_CLEAR_USER_MESSAGES.value: CHANNEL_CHAT_CLEAR_USER_MESSAGES,
CHANNEL_CHAT_MESSAGE.value: CHANNEL_CHAT_MESSAGE,
CHANNEL_CHAT_MESSAGE_DELETE.value: CHANNEL_CHAT_MESSAGE_DELETE,
CHANNEL_CHAT_NOTIFICATION.value: CHANNEL_CHAT_NOTIFICATION,
CHANNEL_CHAT_SETTINGS_UPDATE.value: CHANNEL_CHAT_SETTINGS_UPDATE,
CHANNEL_CHAT_USER_MESSAGE_HOLD.value: CHANNEL_CHAT_USER_MESSAGE_HOLD,
CHANNEL_CHAT_USER_MESSAGE_UPDATE.value: CHANNEL_CHAT_USER_MESSAGE_UPDATE,
CHANNEL_SUBSCRIBE.value: CHANNEL_SUBSCRIBE,
CHANNEL_SUBSCRIPTION_END.value: CHANNEL_SUBSCRIPTION_END,
CHANNEL_SUBSCRIPTION_GIFT.value: CHANNEL_SUBSCRIPTION_GIFT,
CHANNEL_SUBSCRIPTION_MESSAGE.value: CHANNEL_SUBSCRIPTION_MESSAGE,
CHANNEL_CHEER.value: CHANNEL_CHEER,
CHANNEL_RAID.value: CHANNEL_RAID,
CHANNEL_BAN.value: CHANNEL_BAN,
CHANNEL_UNBAN.value: CHANNEL_UNBAN,
CHANNEL_UNBAN_REQUEST_CREATE.value: CHANNEL_UNBAN_REQUEST_CREATE,
CHANNEL_UNBAN_REQUEST_RESOLVE.value: CHANNEL_UNBAN_REQUEST_RESOLVE,
CHANNEL_MODERATE.value: CHANNEL_MODERATE,
CHANNEL_MODERATE_V2.value: CHANNEL_MODERATE_V2,
CHANNEL_MODERATOR_ADD.value: CHANNEL_MODERATOR_ADD,
CHANNEL_MODERATOR_REMOVE.value: CHANNEL_MODERATOR_REMOVE,
CHANNEL_GUEST_STAR_SESSION_BEGIN.value: CHANNEL_GUEST_STAR_SESSION_BEGIN,
CHANNEL_GUEST_STAR_SESSION_END.value: CHANNEL_GUEST_STAR_SESSION_END,
CHANNEL_GUEST_STAR_GUEST_UPDATE.value: CHANNEL_GUEST_STAR_GUEST_UPDATE,
CHANNEL_GUEST_STAR_SETTINGS_UPDATE.value: CHANNEL_GUEST_STAR_SETTINGS_UPDATE,
CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD.value: CHANNEL_CHANNEL_POINTS_AUTOMATIC_REWARD_REDEMPTION_ADD,
CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD.value: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_ADD,
CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE.value: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_UPDATE,
CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE.value: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REMOVE,
CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD.value: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD,
CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE.value: CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE,
CHANNEL_POLL_BEGIN.value: CHANNEL_POLL_BEGIN,
CHANNEL_POLL_PROGRESS.value: CHANNEL_POLL_PROGRESS,
CHANNEL_POLL_END.value: CHANNEL_POLL_END,
CHANNEL_PREDICTION_BEGIN.value: CHANNEL_PREDICTION_BEGIN,
CHANNEL_PREDICTION_PROGRESS.value: CHANNEL_PREDICTION_PROGRESS,
CHANNEL_PREDICTION_LOCK.value: CHANNEL_PREDICTION_LOCK,
CHANNEL_PREDICTION_END.value: CHANNEL_PREDICTION_END,
CHANNEL_SUSPICIOUS_USER_UPDATE.value: CHANNEL_SUSPICIOUS_USER_UPDATE,
CHANNEL_SUSPICIOUS_USER_MESSAGE.value: CHANNEL_SUSPICIOUS_USER_MESSAGE,
CHANNEL_VIP_ADD.value: CHANNEL_VIP_ADD,
CHANNEL_VIP_REMOVE.value: CHANNEL_VIP_REMOVE,
CHANNEL_WARNING_ACKNOWLEDGE.value: CHANNEL_WARNING_ACKNOWLEDGE,
CHANNEL_WARNING_SEND.value: CHANNEL_WARNING_SEND,
CHANNEL_HYPE_TRAIN_BEGIN.value: CHANNEL_HYPE_TRAIN_BEGIN,
CHANNEL_HYPE_TRAIN_PROGRESS.value: CHANNEL_HYPE_TRAIN_PROGRESS,
CHANNEL_HYPE_TRAIN_END.value: CHANNEL_HYPE_TRAIN_END,
CHANNEL_CHARITY_CAMPAIGN_DONATE.value: CHANNEL_CHARITY_CAMPAIGN_DONATE,
CHANNEL_CHARITY_CAMPAIGN_START.value: CHANNEL_CHARITY_CAMPAIGN_START,
CHANNEL_CHARITY_CAMPAIGN_PROGRESS.value: CHANNEL_CHARITY_CAMPAIGN_PROGRESS,
CHANNEL_CHARITY_CAMPAIGN_STOP.value: CHANNEL_CHARITY_CAMPAIGN_STOP,
CHANNEL_SHARED_CHAT_BEGIN.value: CHANNEL_SHARED_CHAT_BEGIN,
CHANNEL_SHARED_CHAT_UPDATE.value: CHANNEL_SHARED_CHAT_UPDATE,
CHANNEL_SHARED_CHAT_END.value: CHANNEL_SHARED_CHAT_END,
CHANNEL_SHIELD_MODE_BEGIN.value: CHANNEL_SHIELD_MODE_BEGIN,
CHANNEL_SHIELD_MODE_END.value: CHANNEL_SHIELD_MODE_END,
CHANNEL_SHOUTOUT_CREATE.value: CHANNEL_SHOUTOUT_CREATE,
CHANNEL_SHOUTOUT_RECEIVE.value: CHANNEL_SHOUTOUT_RECEIVE,
CONDUIT_SHARD_DISABLED.value: CONDUIT_SHARD_DISABLED,
DROP_ENTITLEMENT_GRANT.value: DROP_ENTITLEMENT_GRANT,
EXTENSION_BITS_TRANSACTION_CREATE.value: EXTENSION_BITS_TRANSACTION_CREATE,
CHANNEL_GOAL_BEGIN.value: CHANNEL_GOAL_BEGIN,
CHANNEL_GOAL_PROGRESS.value: CHANNEL_GOAL_PROGRESS,
CHANNEL_GOAL_END.value: CHANNEL_GOAL_END,
STREAM_ONLINE.value: STREAM_ONLINE,
STREAM_OFFLINE.value: STREAM_OFFLINE,
USER_AUTHORIZATION_GRANT.value: USER_AUTHORIZATION_GRANT,
USER_AUTHORIZATION_REVOKE.value: USER_AUTHORIZATION_REVOKE,
USER_UPDATE.value: USER_UPDATE,
USER_WHISPER_MESSAGE.value: USER_WHISPER_MESSAGE,
}

View file

@ -0,0 +1 @@
uid://cxmnkr64wc2hx

View file

@ -0,0 +1,13 @@
extends RefCounted
## Defines the message that the EventSub WebSocket server sends your client to indicate that the WebSocket connection is healthy.
## See: https://dev.twitch.tv/docs/eventsub/websocket-reference/#keepalive-message
class_name TwitchKeepaliveMessage
var metadata: TwitchEventsub.Metadata;
## Is always empty
var payload: Dictionary = {};
func _init(d: Dictionary) -> void:
metadata = TwitchEventsub.Metadata.new(d.get("metadata", {}));
payload = d["payload"];

View file

@ -0,0 +1 @@
uid://dygbx208p487l

View file

@ -0,0 +1,79 @@
extends RefCounted
class_name TwitchNotificationMessage
## An object that identifies the message.
class Metadata extends TwitchEventsub.Metadata:
## The type of event sent in the message.
var subscription_type: String;
## The version number of the subscription types definition. This is the same value specified in the subscription request.
var subscription_version: String;
func _init(d: Dictionary) -> void:
super._init(d);
subscription_type = d["subscription_type"];
subscription_version = d["subscription_version"];
## An object that contains the message.
class Payload extends RefCounted:
## An object that contains information about your subscription.
var subscription: Subscription;
## The events data. For information about the events data, see the subscription types description in Subscription Types. https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types
var event: Dictionary;
func _init(d: Dictionary) -> void:
var sub = d.get("subscription");
if sub != null:
subscription = Subscription.new(sub)
event = d["event"]
## An object that contains information about your subscription.
class Subscription extends RefCounted:
## An ID that uniquely identifies this subscription.
var id: String;
## The subscriptions status, which is set to enabled.
var status: String;
## The type of event sent in the message. See the event field.
var type: String;
## The version number of the subscription types definition.
var version: String;
## The events cost. See Subscription limits. (https://dev.twitch.tv/docs/eventsub/manage-subscriptions#subscription-limits)
var cost: int;
## The conditions under which the event fires. For example, if you requested notifications when a broadcaster gets a new follower, this object contains the broadcasters ID. For information about the conditions data, see the subscription types description in Subscription types. (https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types)
var condition: Dictionary;
## An object that contains information about the transport used for notifications.
var transport: Transport;
## The UTC date and time that the subscription was created.
var created_at: String;
func _init(d: Dictionary) -> void:
id = d["id"];
status = d["status"];
type = d["type"];
version = d["version"];
cost = d["cost"];
condition = d["condition"];
transport = Transport.new(d.get("transport", {}));
created_at = d["created_at"];
## An object that contains information about the transport used for notifications.
class Transport extends RefCounted:
## The transport method, which is set to websocket.
var method: String;
## An ID that uniquely identifies the WebSocket connection.
var session_id: String;
func _init(d: Dictionary) -> void:
method = d["method"];
session_id = d["session_id"];
## An object that identifies the message.
var metadata: Metadata;
## An object that contains the message.
var payload: Payload;
func _init(d: Dictionary) -> void:
metadata = Metadata.new(d["metadata"])
payload = Payload.new(d["payload"])

View file

@ -0,0 +1 @@
uid://2xnomqtfyxcd

View file

@ -0,0 +1,20 @@
extends RefCounted
class_name TwitchReconnectMessage
## An object that contains the message.
class Payload extends RefCounted:
var session: TwitchEventsub.Session;
func _init(d: Dictionary) -> void:
session = TwitchEventsub.Session.new(d.get("session", {}));
## An object that identifies the message.
var metadata: TwitchEventsub.Metadata;
## An object that contains the message.
var payload: Payload;
func _init(d: Dictionary) -> void:
metadata = TwitchEventsub.Metadata.new(d.get("metadata", {}));
payload = Payload.new(d.get("payload", {}));

View file

@ -0,0 +1 @@
uid://ciqfgatm1v2wy

View file

@ -0,0 +1,76 @@
extends RefCounted
class_name TwitchRevocationMessage
## An object that identifies the message.
class Metadata extends TwitchEventsub.Metadata:
## The type of event sent in the message.
var subscription_type: String;
## The version number of the subscription types definition. This is the same value specified in the subscription request.
var subscription_version: String;
func _init(d: Dictionary) -> void:
super._init(d);
subscription_type = d["subscription_type"];
subscription_version = d["subscription_version"];
## An object that contains the message.
class Payload extends RefCounted:
## An object that contains information about your subscription.
var subscription: Subscription;
func _init(d: Dictionary) -> void:
subscription = Subscription.new(d.get("subscription", {}))
## An object that contains information about your subscription.
class Subscription extends RefCounted:
## An ID that uniquely identifies this subscription.
var id: String;
## he subscription's status. The following are the possible values:[br]
## authorization_revoked — The user in the condition object revoked the authorization that let you get events on their behalf.[br]
## user_removed — The user in the condition object is no longer a Twitch user.[br]
## version_removed — The subscribed to subscription type and version is no longer supported.
var status: String;
## The type of event sent in the message.
var type: String;
## The version number of the subscription type's definition.
var version: String;
## The event's cost. See Subscription limits (https://dev.twitch.tv/docs/eventsub/manage-subscriptions/#subscription-limits)
var cost: String;
## The conditions under which the event fires. For example, if you requested notifications when a broadcaster gets a new follower, this object contains the broadcasters ID. For information about the condition's data, see the subscription type's description in Subscription Types. (https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types)
var condition: Dictionary;
## An object that contains information about the transport used for notifications.
var transport: Transport;
## The UTC date and time that the subscription was created.
var created_at: String;
func _init(d: Dictionary) -> void:
id = d["id"];
status = d["status"];
type = d["type"];
version = d["version"];
cost = d["cost"];
condition = d["condition"];
transport = Transport.new(d.get("transport", {}));
created_at = d["created_at"];
## An object that contains information about the transport used for notifications.
class Transport extends RefCounted:
## The transport method, which is set to websocket.
var method: String;
## An ID that uniquely identifies the WebSocket connection.
var session_id: String;
func _init(d: Dictionary) -> void:
method = d["method"];
session_id = d["session_id"];
## An object that identifies the message.
var metadata: Metadata;
## An object that contains the message.
var payload: Payload;
func _init(d: Dictionary) -> void:
metadata = Metadata.new(d.get("metadata", {}))
payload = Payload.new(d.get("payload", {}))

View file

@ -0,0 +1 @@
uid://c1evlw325jeeg

View file

@ -0,0 +1,18 @@
extends RefCounted
## Defines the first message that the EventSub WebSocket server sends after your client connects to the server.
## See: https://dev.twitch.tv/docs/eventsub/websocket-reference/#welcome-message
class_name TwitchWelcomeMessage
class TwitchWelcomeMessagePayload extends RefCounted:
var session: TwitchEventsub.Session;
func _init(d: Dictionary) -> void:
session = TwitchEventsub.Session.new(d.get("session", {}));
var metadata: TwitchEventsub.Metadata;
var payload: TwitchWelcomeMessagePayload;
func _init(d: Dictionary) -> void:
metadata = TwitchEventsub.Metadata.new(d.get("metadata", {}));
payload = TwitchWelcomeMessagePayload.new(d.get("payload", {}));

View file

@ -0,0 +1 @@
uid://qh68xfq2isug