2024-01-26 11:26:22 +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
|
|
|
|
|
|
|
|
|
|
|
|
func _init():
|
|
|
|
name = "Twitch Leave Chat"
|
|
|
|
node_type = name.to_snake_case()
|
2024-02-11 20:08:11 +01:00
|
|
|
description = "Leaves a Twitch channel."
|
2024-01-26 11:26:22 +01:00
|
|
|
|
|
|
|
props_to_serialize = []
|
|
|
|
|
|
|
|
# Adds Input port for channel name
|
|
|
|
add_input_port(DeckType.Types.STRING, "Channel", "field")
|
|
|
|
|
|
|
|
# Adds Trigger for leaving the specified channel
|
2024-02-26 12:36:19 +01:00
|
|
|
add_input_port(DeckType.Types.ANY, "Leave Channel", "button", Port.UsageType.TRIGGER)
|
2024-01-26 11:26:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-26 12:36:19 +01:00
|
|
|
func _receive(to_input_port, data: Variant):
|
2024-01-26 11:26:22 +01:00
|
|
|
|
2024-02-26 12:36:19 +01:00
|
|
|
var channel
|
|
|
|
|
|
|
|
if to_input_port == 0:
|
2024-01-26 11:26:22 +01:00
|
|
|
|
2024-02-26 12:36:19 +01:00
|
|
|
channel = data
|
|
|
|
|
|
|
|
if to_input_port == 1 or not channel is String:
|
2024-01-26 11:26:22 +01:00
|
|
|
|
2024-02-26 12:36:19 +01:00
|
|
|
channel = await resolve_input_port_value_async(0)
|
2024-01-26 11:26:22 +01:00
|
|
|
|
2024-02-26 12:36:19 +01:00
|
|
|
Connections.twitch.leave_channel(channel)
|
2024-01-26 11:26:22 +01:00
|
|
|
|