diff --git a/KfChatDotNetKickBot/Commands/HowlggCommands.cs b/KfChatDotNetKickBot/Commands/HowlggCommands.cs index 53b373e..4a451fe 100644 --- a/KfChatDotNetKickBot/Commands/HowlggCommands.cs +++ b/KfChatDotNetKickBot/Commands/HowlggCommands.cs @@ -44,15 +44,18 @@ public class HowlggRecentBetCommand : ICommand public UserRight RequiredRight => UserRight.Guest; public async Task RunCommand(KickBot botInstance, MessageModel message, GroupCollection arguments, CancellationToken ctx) { - var division = (await Helpers.GetValue(BuiltIn.Keys.HowlggDivisionAmount)).ToType(); + var settings = await Helpers.GetMultipleValues([ + BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor, BuiltIn.Keys.HowlggDivisionAmount + ]); + var division = settings[BuiltIn.Keys.HowlggDivisionAmount].ToType(); await using var db = new ApplicationDbContext(); // EF SQLite doesn't support filtering on dates :( var bets = (await db.HowlggBets.ToListAsync(ctx)).OrderByDescending(j => j.Date).Take(3).ToList(); var output = "Most recent 3 bets on Howl.gg:"; foreach (var bet in bets) { - var color = "#3dd179"; - if (bet.Profit < 0) color = "#f1323e"; + var color = settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value; + if (bet.Profit < 0) color = settings[BuiltIn.Keys.KiwiFarmsRedColor].Value; output += $"[br]Bet: {bet.Bet / division:C}; Profit: [color={color}]{bet.Profit / division:C}[/color]; Game: {bet.Game.Humanize()}; {(DateTimeOffset.UtcNow - bet.Date).Humanize(precision: 1)} ago"; } botInstance.SendChatMessage(output, true); diff --git a/KfChatDotNetKickBot/KickBot.cs b/KfChatDotNetKickBot/KickBot.cs index bb80f82..0119d53 100644 --- a/KfChatDotNetKickBot/KickBot.cs +++ b/KfChatDotNetKickBot/KickBot.cs @@ -330,7 +330,10 @@ public class KickBot private void ShuffleOnLatestBetUpdated(object sender, ShuffleLatestBetModel bet) { var settings = Helpers - .GetMultipleValues([BuiltIn.Keys.ShuffleBmjUsername, BuiltIn.Keys.TwitchBossmanJackUsername]).Result; + .GetMultipleValues([ + BuiltIn.Keys.ShuffleBmjUsername, BuiltIn.Keys.TwitchBossmanJackUsername, + BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor + ]).Result; _logger.Trace("Shuffle bet has arrived"); if (bet.Username != settings[BuiltIn.Keys.ShuffleBmjUsername].Value) { @@ -357,8 +360,8 @@ public class KickBot return; } - var payoutColor = "green"; - if (float.Parse(bet.Payout) < float.Parse(bet.Amount)) payoutColor = "red"; + var payoutColor = settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value; + if (float.Parse(bet.Payout) < float.Parse(bet.Amount)) payoutColor = settings[BuiltIn.Keys.KiwiFarmsRedColor].Value; // There will be a check for live status but ignoring that while we deal with an emergency dice situation SendChatMessage($"🚨🚨 {bet.Username} just bet {bet.Amount} {bet.Currency} which paid out [color={payoutColor}]{bet.Payout} {bet.Currency}[/color] ({bet.Multiplier}x) on {bet.GameName} 💰💰", true); } diff --git a/KfChatDotNetKickBot/Settings/BuiltIn.cs b/KfChatDotNetKickBot/Settings/BuiltIn.cs index c1d6a58..6f48916 100644 --- a/KfChatDotNetKickBot/Settings/BuiltIn.cs +++ b/KfChatDotNetKickBot/Settings/BuiltIn.cs @@ -328,6 +328,22 @@ public static class BuiltIn Description = "How much to divide the Howlgg bets/profit by to get the real value", Default = "1650", IsSecret = false + }, + new BuiltInSettingsModel() + { + Key = Keys.KiwiFarmsGreenColor, + Regex = ".+", + Description = "Green color used for showing positive values in chat", + Default = "#3dd179", + IsSecret = false + }, + new BuiltInSettingsModel() + { + Key = Keys.KiwiFarmsRedColor, + Regex = ".+", + Description = "Red color used for showing negative values in chat", + Default = "#f1323e", + IsSecret = false } ]; @@ -360,5 +376,7 @@ public static class BuiltIn public static string KiwiFarmsToken = "KiwiFarms.Token"; public static string KickEnabled = "Kick.Enabled"; public static string HowlggDivisionAmount = "Howlgg.DivisionAmount"; + public static string KiwiFarmsGreenColor = "KiwiFarms.GreenColor"; + public static string KiwiFarmsRedColor = "KiwiFarms.RedColor"; } } \ No newline at end of file