From 18efdc004dda655a75b7f85b1929ab89ca70bee8 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 25 Feb 2022 06:19:05 +0100 Subject: [PATCH] Added default trovo ClientId for stream notifications --- .../Providers/TrovoProvider.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs b/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs index 1cee9cdf0..80306858a 100644 --- a/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs +++ b/src/NadekoBot/Modules/Searches/_Common/StreamNotifications/Providers/TrovoProvider.cs @@ -17,7 +17,16 @@ public class TrovoProvider : Provider public TrovoProvider(IHttpClientFactory httpClientFactory, IBotCredsProvider creds) - => (_httpClientFactory, _creds) = (httpClientFactory, creds); + { + (_httpClientFactory, _creds) = (httpClientFactory, creds); + + + if (string.IsNullOrWhiteSpace(creds.GetCreds().TrovoClientId)) + { + Log.Warning(@"Trovo streams are using a default clientId. +If you are experiencing ratelimits, you should create your own application at: https://developer.trovo.live/"); + } + } public override Task IsValidUrl(string url) => Task.FromResult(_urlRegex.IsMatch(url)); @@ -39,11 +48,9 @@ public class TrovoProvider : Provider if (string.IsNullOrWhiteSpace(trovoClientId)) { - Log.Warning("Trovo streams will be ignored until TrovoClientId is added to creds.yml"); - return default; + trovoClientId = "8b3cc4719b7051803099661a3265e50b"; } - http.DefaultRequestHeaders.Clear(); http.DefaultRequestHeaders.Add("Accept", "application/json"); http.DefaultRequestHeaders.Add("Client-ID", trovoClientId);