mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
28 lines
411 B
GDScript3
28 lines
411 B
GDScript3
|
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
|
||
|
|
||
|
|