mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
58 lines
991 B
GDScript3
58 lines
991 B
GDScript3
|
extends DeckNode
|
||
|
|
||
|
|
||
|
func _init():
|
||
|
name = "Twitch Send Chat"
|
||
|
node_type = "twitch_send_chat"
|
||
|
description = "Sends Twitch chat Messages"
|
||
|
category = "twitch"
|
||
|
|
||
|
add_input_port(
|
||
|
DeckType.Types.STRING,
|
||
|
"Message",
|
||
|
"field"
|
||
|
)
|
||
|
add_input_port(
|
||
|
DeckType.Types.STRING,
|
||
|
"Channel",
|
||
|
"field"
|
||
|
)
|
||
|
|
||
|
add_input_port(
|
||
|
DeckType.Types.BOOL,
|
||
|
"Send",
|
||
|
"button"
|
||
|
)
|
||
|
|
||
|
|
||
|
|
||
|
func _receive(to_input_port, data: Variant, extra_data: Array = []):
|
||
|
|
||
|
if to_input_port != 2:
|
||
|
|
||
|
return
|
||
|
|
||
|
|
||
|
var msg = get_value_for_input_port(0)
|
||
|
var channel = get_value_for_input_port(1)
|
||
|
|
||
|
if channel == null:
|
||
|
|
||
|
channel = ""
|
||
|
|
||
|
if msg == null:
|
||
|
|
||
|
return
|
||
|
|
||
|
|
||
|
Connections.twitch.send_chat(msg, channel)
|
||
|
|
||
|
|
||
|
func get_value_for_input_port(port: int) -> Variant:
|
||
|
if request_value(port) != null:
|
||
|
return request_value(port)
|
||
|
elif get_input_ports()[port].value_callback.get_object() && get_input_ports()[port].value_callback.call() != null:
|
||
|
return get_input_ports()[port].value_callback.call()
|
||
|
else:
|
||
|
return null
|