From 7b42990b39b3c063d155e922baf6e534d678b773 Mon Sep 17 00:00:00 2001 From: issork Date: Sun, 8 Oct 2023 12:26:53 +0200 Subject: [PATCH] added new signal to wait for channel data, required for the example to work as expected --- addons/gift/gift_node.gd | 3 +++ example/Gift.gd | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/gift/gift_node.gd b/addons/gift/gift_node.gd index 3a5c892..9e11f16 100644 --- a/addons/gift/gift_node.gd +++ b/addons/gift/gift_node.gd @@ -21,6 +21,8 @@ signal login_attempt(success) signal chat_message(sender_data, message) # User sent a whisper message. signal whisper_message(sender_data, message) +# Initial channel data received +signal channel_data_received(channel_name) # Unhandled data passed through signal unhandled_message(message, tags) # A command has been called with invalid arg count @@ -627,6 +629,7 @@ func handle_message(message : String, tags : Dictionary) -> void: var room = msg[2].right(-1) if (!last_state.has(room)): last_state[room] = tags + channel_data_received.emit(room) else: for key in tags: last_state[room][key] = tags[key] diff --git a/example/Gift.gd b/example/Gift.gd index 5818ec5..5d43acb 100644 --- a/example/Gift.gd +++ b/example/Gift.gd @@ -24,7 +24,8 @@ func _ready() -> void: if (success): request_caps() join_channel(initial_channel) - await(connect_to_eventsub()) + await(channel_data_received) + await(connect_to_eventsub()) # Only required if you want to receive EventSub events. # Refer to https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/ for details on # what events exist, which API versions are available and which conditions are required. # Make sure your token has all required scopes for the event.