miggor-StreamGraph/addons/no_twitch/demo/demo_scene.gd

28 lines
411 B
GDScript3
Raw Permalink Normal View History

extends Control
func _ready():
$Twitch_Connection.token_received.connect(save_token)
load_token()
func save_token(token):
var res = TokenSaver.new()
res.token = token
ResourceSaver.save(res, "user://token.tres")
func load_token():
if !FileAccess.file_exists("user://token.tres"):
return
var res = ResourceLoader.load("user://token.tres")
$Twitch_Connection.token = res.token