miggor-StreamGraph/classes/deck/nodes/twitch_send_chat.gd
Eroax c071e4d644 TWITCH INTEGRATION (#13)
Implemented a basic Twitch Connection, + Twitch Receive Chat and Twitch Send Chat

Co-authored-by: Eroax <eroaxe.business@gmail.com>
Reviewed-on: https://codeberg.org/Eroax/StreamGraph/pulls/13
2023-12-08 09:53:06 +00:00

57 lines
991 B
GDScript

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