mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-15 10:32:44 -04:00
Added an option to get your exact balance to help deal with rounding issues
This commit is contained in:
@@ -18,7 +18,8 @@ public class GetBalanceCommand : ICommand
|
|||||||
{
|
{
|
||||||
public List<Regex> Patterns => [
|
public List<Regex> Patterns => [
|
||||||
new Regex("^balance", RegexOptions.IgnoreCase),
|
new Regex("^balance", RegexOptions.IgnoreCase),
|
||||||
new Regex("^bal$", RegexOptions.IgnoreCase)
|
new Regex("^bal$", RegexOptions.IgnoreCase),
|
||||||
|
new Regex("^bal exact$", RegexOptions.IgnoreCase)
|
||||||
];
|
];
|
||||||
public string? HelpText => "Get your gamba balance";
|
public string? HelpText => "Get your gamba balance";
|
||||||
public UserRight RequiredRight => UserRight.Loser;
|
public UserRight RequiredRight => UserRight.Loser;
|
||||||
@@ -30,8 +31,17 @@ public class GetBalanceCommand : ICommand
|
|||||||
CancellationToken ctx)
|
CancellationToken ctx)
|
||||||
{
|
{
|
||||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||||
await botInstance.SendChatMessageAsync(
|
if (message.MessageRawHtmlDecoded.EndsWith("exact"))
|
||||||
$"{user.FormatUsername()}, your balance is {await gambler!.Balance.FormatKasinoCurrencyAsync()}", true);
|
{
|
||||||
|
await botInstance.SendChatMessageAsync(
|
||||||
|
$"{user.FormatUsername()}, your balance is {gambler!.Balance}", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await botInstance.SendChatMessageAsync(
|
||||||
|
$"{user.FormatUsername()}, your balance is {await gambler!.Balance.FormatKasinoCurrencyAsync()}", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (botInstance.BotServices.KasinoShop != null)
|
if (botInstance.BotServices.KasinoShop != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user