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

@@ -19,7 +19,7 @@ public class HowlggStatsCommand : ICommand
{
var window = Convert.ToInt32(arguments["window"].Value);
var start = DateTimeOffset.UtcNow.AddHours(-window);
var division = (await Helpers.GetValue(BuiltIn.Keys.HowlggDivisionAmount)).ToType<float>();
var division = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.HowlggDivisionAmount)).ToType<float>();
await using var db = new ApplicationDbContext();
// EF SQLite doesn't support filtering on dates :(
var bets = (await db.HowlggBets.ToListAsync(ctx)).Where(b => b.Date.UtcDateTime > start).ToList();
@@ -44,7 +44,7 @@ public class HowlggRecentBetCommand : ICommand
public TimeSpan Timeout => TimeSpan.FromSeconds(10);
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
{
var settings = await Helpers.GetMultipleValues([
var settings = await SettingsProvider.GetMultipleValuesAsync([
BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor, BuiltIn.Keys.HowlggDivisionAmount
]);
var division = settings[BuiltIn.Keys.HowlggDivisionAmount].ToType<float>();