From c1a91b9a6a078ff6df75f34b30b4f960f72783e7 Mon Sep 17 00:00:00 2001 From: Eroax Date: Fri, 26 Jan 2024 03:26:22 -0700 Subject: [PATCH] Updated NoTwitch to fix Scopes --- addons/no_twitch/twitch_connection.gd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/no_twitch/twitch_connection.gd b/addons/no_twitch/twitch_connection.gd index 9a1a675..c70c08e 100644 --- a/addons/no_twitch/twitch_connection.gd +++ b/addons/no_twitch/twitch_connection.gd @@ -16,6 +16,7 @@ signal chat_received_rich(chat_dict) @export var redirect_port := "8000" var auth_url := "https://id.twitch.tv/oauth2/authorize?response_type=token&" +var auth_scopes : Array[String] = ["chat:read", "chat:edit", "channel:read:redemptions"] var auth_server : TCPServer @@ -59,9 +60,10 @@ func cache_user_data(): ## Handles the basic Twitch Authentication process to request and then later receive a Token (using [method check_auth_peer]). ## Returns the authentication URL. -func authenticate_with_twitch(client_id = client_id, scopes : Array[String] = ["chat:read", "chat:edit"]) -> String: +func authenticate_with_twitch(client_id = client_id, scopes : Array[String] = auth_scopes) -> String: auth_server = TCPServer.new() - var url := create_auth_url(scopes) + auth_scopes = scopes + var url := create_auth_url() auth_server.listen(int(redirect_port)) return url @@ -139,11 +141,11 @@ func _process(delta): ## [param scopes], Twitch Client ID ([param id]) and [param redirect_uri]. ## [param id] defaults to [member client_id] and both [param redirect] and ## [param redirect_port] -func create_auth_url(scopes : Array[String], port := redirect_port, id : String = client_id, redirect : String = redirect_uri) -> String: +func create_auth_url(port := redirect_port, id : String = client_id, redirect : String = redirect_uri) -> String: var str_scopes : String - for all in scopes: + for all in auth_scopes: str_scopes += " " + all str_scopes = str_scopes.strip_edges()