2023-12-08 10:53:06 +01:00
|
|
|
extends DeckNode
|
|
|
|
|
2023-12-08 13:30:02 +01:00
|
|
|
var username := ""
|
|
|
|
var message := ""
|
|
|
|
var channel := ""
|
|
|
|
var tags := {}
|
|
|
|
|
2023-12-08 10:53:06 +01:00
|
|
|
|
|
|
|
func _init():
|
|
|
|
name = "Twitch Chat Received"
|
|
|
|
node_type = "twitch_chat_received"
|
|
|
|
description = "Receives Twitch Chat Events from a Twitch Connection"
|
|
|
|
category = "twitch"
|
2023-12-08 13:30:02 +01:00
|
|
|
|
2023-12-08 10:53:06 +01:00
|
|
|
add_output_port(DeckType.Types.STRING, "Username")
|
|
|
|
add_output_port(DeckType.Types.STRING, "Message")
|
|
|
|
add_output_port(DeckType.Types.STRING, "Channel")
|
|
|
|
add_output_port(DeckType.Types.DICTIONARY, "Tags")
|
2023-12-08 13:30:02 +01:00
|
|
|
|
|
|
|
add_output_port(
|
|
|
|
DeckType.Types.BOOL,
|
|
|
|
"On receive"
|
|
|
|
)
|
|
|
|
|
2023-12-08 10:53:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _event_received(event_name : StringName, event_data : Dictionary = {}):
|
2023-12-08 13:30:02 +01:00
|
|
|
|
2023-12-08 10:53:06 +01:00
|
|
|
if event_name != &"twitch_chat":
|
2023-12-08 13:30:02 +01:00
|
|
|
|
2023-12-08 10:53:06 +01:00
|
|
|
return
|
2023-12-08 13:30:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
username = event_data.username
|
|
|
|
message = event_data.message
|
|
|
|
channel = event_data.channel
|
|
|
|
tags = event_data
|
|
|
|
|
|
|
|
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
|