mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Using the fancy green/red colors instead of just color=red/green as it is easier on the eyes
This commit is contained in:
@@ -44,15 +44,18 @@ public class HowlggRecentBetCommand : ICommand
|
|||||||
public UserRight RequiredRight => UserRight.Guest;
|
public UserRight RequiredRight => UserRight.Guest;
|
||||||
public async Task RunCommand(KickBot botInstance, MessageModel message, GroupCollection arguments, CancellationToken ctx)
|
public async Task RunCommand(KickBot botInstance, MessageModel message, GroupCollection arguments, CancellationToken ctx)
|
||||||
{
|
{
|
||||||
var division = (await Helpers.GetValue(BuiltIn.Keys.HowlggDivisionAmount)).ToType<float>();
|
var settings = await Helpers.GetMultipleValues([
|
||||||
|
BuiltIn.Keys.KiwiFarmsGreenColor, BuiltIn.Keys.KiwiFarmsRedColor, BuiltIn.Keys.HowlggDivisionAmount
|
||||||
|
]);
|
||||||
|
var division = settings[BuiltIn.Keys.HowlggDivisionAmount].ToType<float>();
|
||||||
await using var db = new ApplicationDbContext();
|
await using var db = new ApplicationDbContext();
|
||||||
// EF SQLite doesn't support filtering on dates :(
|
// EF SQLite doesn't support filtering on dates :(
|
||||||
var bets = (await db.HowlggBets.ToListAsync(ctx)).OrderByDescending(j => j.Date).Take(3).ToList();
|
var bets = (await db.HowlggBets.ToListAsync(ctx)).OrderByDescending(j => j.Date).Take(3).ToList();
|
||||||
var output = "Most recent 3 bets on Howl.gg:";
|
var output = "Most recent 3 bets on Howl.gg:";
|
||||||
foreach (var bet in bets)
|
foreach (var bet in bets)
|
||||||
{
|
{
|
||||||
var color = "#3dd179";
|
var color = settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value;
|
||||||
if (bet.Profit < 0) color = "#f1323e";
|
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";
|
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);
|
botInstance.SendChatMessage(output, true);
|
||||||
|
|||||||
@@ -330,7 +330,10 @@ public class KickBot
|
|||||||
private void ShuffleOnLatestBetUpdated(object sender, ShuffleLatestBetModel bet)
|
private void ShuffleOnLatestBetUpdated(object sender, ShuffleLatestBetModel bet)
|
||||||
{
|
{
|
||||||
var settings = Helpers
|
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");
|
_logger.Trace("Shuffle bet has arrived");
|
||||||
if (bet.Username != settings[BuiltIn.Keys.ShuffleBmjUsername].Value)
|
if (bet.Username != settings[BuiltIn.Keys.ShuffleBmjUsername].Value)
|
||||||
{
|
{
|
||||||
@@ -357,8 +360,8 @@ public class KickBot
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var payoutColor = "green";
|
var payoutColor = settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value;
|
||||||
if (float.Parse(bet.Payout) < float.Parse(bet.Amount)) payoutColor = "red";
|
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
|
// 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);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,22 @@ public static class BuiltIn
|
|||||||
Description = "How much to divide the Howlgg bets/profit by to get the real value",
|
Description = "How much to divide the Howlgg bets/profit by to get the real value",
|
||||||
Default = "1650",
|
Default = "1650",
|
||||||
IsSecret = false
|
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 KiwiFarmsToken = "KiwiFarms.Token";
|
||||||
public static string KickEnabled = "Kick.Enabled";
|
public static string KickEnabled = "Kick.Enabled";
|
||||||
public static string HowlggDivisionAmount = "Howlgg.DivisionAmount";
|
public static string HowlggDivisionAmount = "Howlgg.DivisionAmount";
|
||||||
|
public static string KiwiFarmsGreenColor = "KiwiFarms.GreenColor";
|
||||||
|
public static string KiwiFarmsRedColor = "KiwiFarms.RedColor";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user