2023-12-15 22:44:25 +01:00
|
|
|
# (c) 2023-present Eroax
|
|
|
|
# (c) 2023-present Yagich
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
extends DeckNode
|
|
|
|
|
|
|
|
var username := ""
|
|
|
|
var message := ""
|
|
|
|
var channel := ""
|
|
|
|
var tags := {}
|
|
|
|
|
|
|
|
|
|
|
|
func _init():
|
|
|
|
name = "Twitch Chat Received"
|
|
|
|
node_type = "twitch_chat_received"
|
|
|
|
description = "Receives Twitch chat events from a Twitch connection."
|
|
|
|
|
2024-02-21 05:08:36 +01:00
|
|
|
add_output_port(DeckType.Types.STRING, "Username", "", Port.UsageType.TRIGGER)
|
|
|
|
add_output_port(DeckType.Types.STRING, "Message", "", Port.UsageType.TRIGGER)
|
|
|
|
add_output_port(DeckType.Types.STRING, "Channel", "", Port.UsageType.TRIGGER)
|
|
|
|
add_output_port(DeckType.Types.DICTIONARY, "Tags", "", Port.UsageType.TRIGGER)
|
2023-12-15 22:44:25 +01:00
|
|
|
|
|
|
|
add_output_port(
|
|
|
|
DeckType.Types.BOOL,
|
|
|
|
"On receive"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _event_received(event_name : StringName, event_data : Dictionary = {}):
|
|
|
|
|
|
|
|
if event_name != &"twitch_chat":
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
username = event_data.username
|
|
|
|
message = event_data.message
|
|
|
|
channel = event_data.channel
|
|
|
|
tags = event_data
|
2024-02-21 05:08:36 +01:00
|
|
|
send(0, username)
|
|
|
|
send(1, message)
|
|
|
|
send(2, channel)
|
|
|
|
send(3, tags)
|
2023-12-15 22:44:25 +01:00
|
|
|
send(4, true)
|
|
|
|
|
|
|
|
|
|
|
|
func _value_request(on_port: int) -> Variant:
|
|
|
|
match on_port:
|
|
|
|
0:
|
|
|
|
return username
|
|
|
|
1:
|
|
|
|
return message
|
|
|
|
2:
|
|
|
|
return channel
|
|
|
|
3:
|
|
|
|
return tags
|
|
|
|
_:
|
|
|
|
return null
|