mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
53 lines
958 B
GDScript
53 lines
958 B
GDScript
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."
|
|
category = "twitch"
|
|
|
|
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")
|
|
|
|
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
|
|
|
|
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
|