Updated EventSub Event to cache Event Data

Forgot to add this when it comes to current Trigger workflow.
This commit is contained in:
Eroax 2024-02-09 02:05:24 -07:00
parent 5ab9021800
commit 54dbcb7724

View file

@ -3,6 +3,7 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
extends DeckNode extends DeckNode
var cached_event_data : Dictionary
func _init(): func _init():
name = "Twitch EventSub Event" name = "Twitch EventSub Event"
@ -29,6 +30,7 @@ func _event_received(event_name: StringName, event_data: Dictionary = {}):
var port_0 = await resolve_input_port_value_async(0) var port_0 = await resolve_input_port_value_async(0)
print("Event Name ", event_data)
if port_0 == null or port_0 != event_data.payload.subscription.type: if port_0 == null or port_0 != event_data.payload.subscription.type:
return return
@ -36,6 +38,17 @@ func _event_received(event_name: StringName, event_data: Dictionary = {}):
# Sends to indicate that the specified event has happened. # Sends to indicate that the specified event has happened.
send(0, null) send(0, null)
# Sends the data along as well as the fact that the event happened # Sends the data along as well as the fact that the event happened. While also caching the event data for later access
cached_event_data = event_data
send(1, event_data) send(1, event_data)
func _value_request(port):
if port != 1:
return
return cached_event_data