Files
seeding-planets/common/twitch_connection/twitch_connection.gd
T
zacharie da91433135 Dev 1.0.1
* Fix du mode twitch
* Fix de coquille de dialogues
* Fix du blocage dans la base aqua
2026-08-21 10:35:03 +02:00

28 lines
1001 B
GDScript

extends Node
signal pseudo_gathered_updated(pseudos)
var pseudo_gathered : Array[String] = []
func _ready():
VerySimpleTwitch.chat_message_received.connect(_on_message_received)
GameInfo.settings_data.twitch_changed.connect(connect_to_twitch)
process_mode = Node.PROCESS_MODE_ALWAYS
VerySimpleTwitch.process_mode = Node.PROCESS_MODE_ALWAYS
func connect_to_twitch(settings : SettingsData):
pseudo_gathered = []
pseudo_gathered_updated.emit(pseudo_gathered)
VerySimpleTwitch.end_chat_client()
if settings.activate_twitch_integration:
connect_to_twitch_account(settings.twitch_channel)
func connect_to_twitch_account(channel_name: String):
VerySimpleTwitch.login_chat_anon(channel_name)
func _on_message_received(chatter: VSTChatter):
if not chatter.login in pseudo_gathered:
if chatter.message.to_lower().trim_suffix(" ") == "!stw":
pseudo_gathered.append(chatter.login)
pseudo_gathered_updated.emit(pseudo_gathered)