Update to the Settings interface.

- Methods are now suffixed async
- Extension methods moved to the actual class and class renamed from SettingValue to Setting
- "Helpers" renamed to "SettingsProvider"
- Removed the ghetto CSV list method. Only setting using it was Pusher Channels which was orphaned by the new Kick channel feature. The call to ToList in the Chips.gg integration was incorrect and just proves lists should be consistently based around JSON objects instead of randomly string splitting
This commit is contained in:
barelyprofessional
2025-05-06 14:07:52 -05:00
parent 4fecdbce06
commit e2c70cc5c5
17 changed files with 167 additions and 229 deletions

View File

@@ -36,7 +36,7 @@ public class Rainbet : IDisposable
using var timer = new PeriodicTimer(_gameHistoryInterval);
while (await timer.WaitForNextTickAsync(_gameHistoryCts.Token))
{
var enabled = await Helpers.GetValue(BuiltIn.Keys.RainbetEnabled);
var enabled = await SettingsProvider.GetValueAsync(BuiltIn.Keys.RainbetEnabled);
if (!enabled.ToBoolean())
{
_logger.Debug("Rainbet is disabled");
@@ -60,7 +60,7 @@ public class Rainbet : IDisposable
private async Task RefreshCookies()
{
var settings =
await Helpers.GetMultipleValues([BuiltIn.Keys.FlareSolverrApiUrl, BuiltIn.Keys.FlareSolverrProxy]);
await SettingsProvider.GetMultipleValuesAsync([BuiltIn.Keys.FlareSolverrApiUrl, BuiltIn.Keys.FlareSolverrProxy]);
var flareSolverrUrl = settings[BuiltIn.Keys.FlareSolverrApiUrl];
var flareSolverrProxy = settings[BuiltIn.Keys.FlareSolverrProxy];
var handler = new ClearanceHandler(flareSolverrUrl.Value)
@@ -95,7 +95,7 @@ public class Rainbet : IDisposable
_logger.Info("Retrieving cookies for Rainbet as they have not been retrieved yet");
await RefreshCookies();
}
var flareSolverrProxy = await Helpers.GetValue(BuiltIn.Keys.FlareSolverrProxy);
var flareSolverrProxy = await SettingsProvider.GetValueAsync(BuiltIn.Keys.FlareSolverrProxy);
var gameHistoryUrl = "https://services.rainbet.com/v1/game-history";
var jsonBody = new Dictionary<string, int> { {"take", take} };
var postData = JsonContent.Create(jsonBody);