diff --git a/lib/twitcher_extended/twitcher_extended.gd b/lib/twitcher_extended/twitcher_extended.gd index a22329dc..30427abf 100644 --- a/lib/twitcher_extended/twitcher_extended.gd +++ b/lib/twitcher_extended/twitcher_extended.gd @@ -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