mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
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:
@@ -19,7 +19,7 @@ public class GetRestreamCommand : ICommand
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
var url = await Helpers.GetValue(BuiltIn.Keys.RestreamUrl);
|
||||
var url = await SettingsProvider.GetValueAsync(BuiltIn.Keys.RestreamUrl);
|
||||
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, restream URL: {url.Value}", true);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class SetRestreamCommand : ICommand
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
await Helpers.SetValue(BuiltIn.Keys.RestreamUrl, arguments["url"].Value);
|
||||
await SettingsProvider.SetValueAsync(BuiltIn.Keys.RestreamUrl, arguments["url"].Value);
|
||||
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, updated URL", true);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class SetShillRestreamCommand : ICommand
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
await Helpers.SetValue(BuiltIn.Keys.TwitchCommercialRestreamShillMessage, arguments["url"].Value);
|
||||
await SettingsProvider.SetValueAsync(BuiltIn.Keys.TwitchCommercialRestreamShillMessage, arguments["url"].Value);
|
||||
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, updated URL for the commercial break restream shill", true);
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class SelfPromoCommand : ICommand
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
var channels = Helpers.GetValue(BuiltIn.Keys.KickChannels).Result.JsonDeserialize<List<KickChannelModel>>();
|
||||
var channels = SettingsProvider.GetValueAsync(BuiltIn.Keys.KickChannels).Result.JsonDeserialize<List<KickChannelModel>>();
|
||||
var channel = channels.FirstOrDefault(ch => ch.ForumId == user.KfId);
|
||||
if (channel == null)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public class GetRestreamPlainCommand : ICommand
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel message, UserDbModel user, GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
{
|
||||
var url = await Helpers.GetValue(BuiltIn.Keys.RestreamUrl);
|
||||
var url = await SettingsProvider.GetValueAsync(BuiltIn.Keys.RestreamUrl);
|
||||
await botInstance.SendChatMessageAsync($"@{message.Author.Username}, restream URL: [plain]{url.Value}", true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user