Updated TwitcherExtended

Added bool fields for streamer and chatbot token loaded, so that it can
be checked in the overlay.
This commit is contained in:
Mario Steele 2026-03-02 02:10:41 -06:00
parent 948fb00405
commit 689dcdc092

View file

@ -57,6 +57,8 @@ static var instance: TwitcherExtended
#region Public Variables
var streamer_user: TwitchUser
var bot_user: TwitchUser
var streamer_token_loaded: bool = false
var chatbot_token_loaded: bool = false
#endregion
#region Private Variables
@ -184,15 +186,19 @@ func _twitcher_setup() -> void:
#region Streamer Public Functions
func load_streamer_token() -> AuthStatus:
_log.d("Loading streamer tokens...")
streamer_token_loaded = false
var res = streamer_token._load_tokens()
if not res:
_log.d("Token doesn't exist")
return AuthStatus.UNAUTHORIZED
if streamer_token.is_token_valid():
_log.d("Token authorized")
streamer_user = await service.get_current_user()
streamer_token_loaded = true
return AuthStatus.AUTHORIZED
if streamer_token.has_refresh_token():
_log.d("Token needs refreshed")
streamer_token_loaded = true
return AuthStatus.NEEDS_REFRESH
_log.d("Token invalid")
return AuthStatus.UNAUTHORIZED
@ -244,15 +250,19 @@ func setup_streamer() -> bool:
#region Chatbot Functions
func load_chatbot_token() -> AuthStatus:
_log.d("Loading chatbot tokens...")
chatbot_token_loaded = false
var res = chatbot_token._load_tokens()
if not res:
_log.d("Token doesn't exist")
return AuthStatus.UNAUTHORIZED
if chatbot_token.is_token_valid():
_log.d("Token authroized")
bot_user = await chatbot_auth.get_user()
chatbot_token_loaded = true
return AuthStatus.AUTHORIZED
if chatbot_token.has_refresh_token():
_log.d("Token needs refreshed")
chatbot_token_loaded = true
return AuthStatus.NEEDS_REFRESH
_log.d("Token invalid")
return AuthStatus.UNAUTHORIZED