mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-04-30 03:22:04 -04:00
Forgive input errors for kasino games when rate limiting
This commit is contained in:
@@ -94,6 +94,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,6 +103,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,6 +238,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you don't have an active blackjack game. Start one with !bj <amount>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,6 +248,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your game data is corrupted. Please start a new game.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
activeWager.IsComplete = true;
|
||||
await _dbContext.SaveChangesAsync(ctx);
|
||||
return;
|
||||
@@ -284,6 +288,7 @@ public class BlackjackCommand : ICommand
|
||||
$"{user.FormatUsername()}, game error: no cards left in deck. Game forfeited.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
await ForfeitGame(botInstance, user, gambler, wager, cleanupDelay, ctx);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -418,6 +423,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you can only split with two cards of the same rank.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -427,6 +433,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you can only split once per game.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -436,6 +443,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you don't have enough balance to split.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -445,6 +453,7 @@ public class BlackjackCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough cards in deck to split.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ public class CoinflipCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments. !coinflip <wager> <heads|tails>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,6 +66,7 @@ public class CoinflipCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments. !coinflip <wager> <heads|tails>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,6 +77,7 @@ public class CoinflipCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your wager must be greater than zero.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,6 +90,7 @@ public class CoinflipCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var rolled = Money.GetRandomDouble(gambler);
|
||||
@@ -111,22 +115,21 @@ public class CoinflipCommand : ICommand
|
||||
$"{user.FormatUsername()}, you [B][COLOR={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]WON![/COLOR][/B] " +
|
||||
$"You won {await effect.FormatKasinoCurrencyAsync()} and your balance is now {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// lost
|
||||
bool isJacky = rolled > 0.5; // would've won without house edge
|
||||
var coinflipAnimationURL = GetCoinFlipAnimationUrl("heads" == choiceStr ? "tails" : "heads", isJacky);
|
||||
|
||||
await botInstance.SendChatMessageAsync($"[IMG]{coinflipAnimationURL}[/IMG]", true, autoDeleteAfter: cleanupDelay);
|
||||
await Task.Delay(1500, ctx);
|
||||
// lost
|
||||
bool isJacky = rolled > 0.5; // would've won without house edge
|
||||
var coinflipAnimationURL = GetCoinFlipAnimationUrl("heads" == choiceStr ? "tails" : "heads", isJacky);
|
||||
|
||||
newBalance = await Money.NewWagerAsync(gambler.Id, wager, -wager, WagerGame.CoinFlip, ct: ctx);
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you [B][COLOR={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]LOST![/COLOR][/B] " +
|
||||
$"Your balance is now {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
}
|
||||
await botInstance.SendChatMessageAsync($"[IMG]{coinflipAnimationURL}[/IMG]", true, autoDeleteAfter: cleanupDelay);
|
||||
await Task.Delay(1500, ctx);
|
||||
|
||||
newBalance = await Money.NewWagerAsync(gambler.Id, wager, -wager, WagerGame.CoinFlip, ct: ctx);
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you [B][COLOR={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]LOST![/COLOR][/B] " +
|
||||
$"Your balance is now {await newBalance.FormatKasinoCurrencyAsync()}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
}
|
||||
|
||||
private static string GetCoinFlipAnimationUrl(string choiceStr, bool isJacky = false)
|
||||
|
||||
@@ -53,6 +53,7 @@ public class DiceCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments. !dice <wager>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var wager = Convert.ToDecimal(amount.Value);
|
||||
@@ -64,6 +65,7 @@ public class DiceCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,6 +74,7 @@ public class DiceCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public class GuessWhatNumberCommand : ICommand
|
||||
if (!arguments.TryGetValue("amount", out var amount))
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, not enough arguments. !guess <wager> <number between 1 and 10>", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,6 +54,7 @@ public class GuessWhatNumberCommand : ICommand
|
||||
if (guess is < 1 or > 10)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, your guess must be between 1 and 10", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||
@@ -71,6 +73,7 @@ public class GuessWhatNumberCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ public class KenoCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments. !keno <wager> <number between 1 and 10>, or !keno <wager> and 10 will be selected automatically",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,6 +91,7 @@ public class KenoCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,6 +100,7 @@ public class KenoCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,6 +108,7 @@ public class KenoCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you can only pick numbers from 1 - 10",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,12 +85,14 @@ public class LambchopCommand : ICommand
|
||||
if (!arguments.TryGetValue("amount", out var amount))
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, not enough arguments. !lambchop <wager> <number between 1 and {FIELD_LENGTH}>", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var targetTile = arguments["targetTile"].Success ? Convert.ToInt32(arguments["targetTile"].Value) : FIELD_LENGTH;
|
||||
if (targetTile is < 1 or > FIELD_LENGTH)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, Please choose a target tile between 1 and {FIELD_LENGTH}", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var wager = Convert.ToDecimal(amount.Value);
|
||||
@@ -102,6 +104,7 @@ public class LambchopCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,6 +113,7 @@ public class LambchopCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public class LimboCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, not enough arguments. !limbo <wager>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var wager = Convert.ToDecimal(amount.Value);
|
||||
@@ -70,6 +71,7 @@ public class LimboCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,6 +80,7 @@ public class LimboCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,6 +95,7 @@ public class LimboCommand : ICommand
|
||||
{
|
||||
//cancel the game if user does not choose a correct number
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you must choose a number greater than 1", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
decimal newBalance;
|
||||
|
||||
@@ -96,11 +96,10 @@ public class MinesCommand : ICommand
|
||||
await KasinoMines.Cashout(KasinoMines.ActiveGames[gambler.Id]);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you don't have a game running to cash out.", true, autoDeleteAfter: cleanupDelay);
|
||||
return;
|
||||
}
|
||||
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you don't have a game running to cash out.", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
//check if user has an existing game already
|
||||
@@ -119,6 +118,7 @@ public class MinesCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments(bet+). !mines <bet> <board size> <number of mines> <picks> to play simple mines. !mines <bet> <board size> <number of mines> <betString> for advanced mines. Tool: {ToolUrl}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
decimal wager = Convert.ToDecimal(bet.Value);
|
||||
@@ -126,6 +126,7 @@ public class MinesCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance is too low. Balance: {gambler.Balance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,6 +134,7 @@ public class MinesCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to bet something to play mines.", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
if (!arguments.TryGetValue("size", out var size) || !arguments.TryGetValue("mines", out var mines))
|
||||
@@ -140,6 +142,7 @@ public class MinesCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments(mines and or size+). !mines <bet> <board size> <number of mines> <picks> to play simple mines. !mines <bet> <board size> <number of mines> <betString> for advanced mines. Tool: {ToolUrl}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -152,7 +155,7 @@ public class MinesCommand : ICommand
|
||||
else if (arguments.TryGetValue("betString", out var betString)) //if they are using precise picks manually or from the tool to select specific squares to reveal
|
||||
{
|
||||
var matches = Regex.Matches(message.Message, BetPattern);
|
||||
if (matches.Count == 0 || matches == null) //if invalid bet string
|
||||
if (matches.Count == 0) //if invalid bet string
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, invalid bet string. Example: !mines 100 10 10 1,3 1,5 2,6 - or use the tool: {ToolUrl}", true, autoDeleteAfter: cleanupDelay);
|
||||
@@ -168,18 +171,21 @@ public class MinesCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, not enough arguments(picks or betstring). !mines <bet> <board size> <number of mines> <picks> to play simple mines. !mines <bet> <board size> <number of mines> <betString> for advanced mines. Tool: {ToolUrl}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
int boardSize = Convert.ToInt32(size.Value);
|
||||
if (boardSize < 2 || boardSize > 8)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, board size must be between 2 and 9.",true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
int minesCount = Convert.ToInt32(mines.Value);
|
||||
if (minesCount < 1 || minesCount > (boardSize * boardSize) - 1)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, number of mines must be between 1 and {boardSize * boardSize - 1}(size^2 - 1).",true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
//at this point all valid values so good to continue making the game
|
||||
@@ -196,6 +202,7 @@ public class MinesCommand : ICommand
|
||||
if (game.BetsPlaced.Contains(coord) || coord.r < 0 || coord.r > game.Size || coord.c < 0 || coord.c > game.Size)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, you can't place duplicate or invalid bets. Use the tool: {ToolUrl}", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -232,6 +239,7 @@ public class MinesCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, invalid bet string. Example: !mines 100 10 10 1,3 1,5 2,6 - or use the tool: {ToolUrl}", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
foreach (Match match in matches)
|
||||
@@ -255,7 +263,7 @@ public class MinesCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you already have a game running. !mines <picks> to reveal more spaces, !mines cashout to cash out, !mines <bet string> to place precise picks. Tool: {ToolUrl}",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ public class Planes : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, not enough arguments. !planes <wager>",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var wager = Convert.ToDecimal(amount.Value);
|
||||
@@ -79,6 +80,7 @@ public class Planes : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,6 +89,7 @@ public class Planes : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ public class PlinkoCommand : ICommand
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you can only play with 1 - 10 balls at a time", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
if (gambler.Balance < wager * numberOfBalls)
|
||||
@@ -150,6 +151,7 @@ public class PlinkoCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -158,6 +160,7 @@ public class PlinkoCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ public class RouletteCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, invalid syntax. Use: !roulette <amount> <bet>",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,6 +145,7 @@ public class RouletteCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -152,6 +154,7 @@ public class RouletteCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,6 +165,7 @@ public class RouletteCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, invalid bet. Valid bets: 0-36, red/black, odd/even, low/high, 1st12/2nd12/3rd12, col1/col2/col3",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ public class SlotsCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you need to bet something to play. !slots [bet]",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -75,6 +76,7 @@ public class SlotsCommand : ICommand
|
||||
if (spins < 1 || spins > 10)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()} you can only do between 1 and 10 spins.", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ public class SlotsCommand : ICommand
|
||||
var wager = Convert.ToDecimal(amount.Value);
|
||||
if (wager < (decimal)0.01){
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()} you must bet a minimum of $0.01 KKK", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||
@@ -92,6 +95,7 @@ public class SlotsCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ public class WheelCommand : ICommand
|
||||
if (!arguments.TryGetValue("amount", out var amount))
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, not enough arguments. !wheel <wager> <difficulty: low, medium, high>", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||
@@ -93,6 +94,7 @@ public class WheelCommand : ICommand
|
||||
if (difficulty.ToLower() is not ("l" or "low" or "m" or "medium" or "h" or "high"))
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, unrecognized difficulty selection, please choose between: low, medium, high", true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,6 +104,7 @@ public class WheelCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} isn't enough for this wager.",
|
||||
true, autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,6 +113,7 @@ public class WheelCommand : ICommand
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you have to wager more than {await wager.FormatKasinoCurrencyAsync()}", true,
|
||||
autoDeleteAfter: cleanupDelay);
|
||||
RateLimitService.RemoveMostRecentEntry(user, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user