Added default trovo ClientId for stream notifications

This commit is contained in:
Kwoth
2022-02-25 06:19:05 +01:00
parent 0fa2b7d171
commit 18efdc004d

View File

@@ -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<bool> 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);