mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-16 11:02:44 -04:00
Removed Claude's dodgy try/finally and added win size to the message
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
using KfChatDotNetBot.Extensions;
|
||||
using KfChatDotNetBot.Models;
|
||||
@@ -38,11 +36,8 @@ public class SlotsCommand : ICommand
|
||||
Window = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel messagen, UserDbModel user,
|
||||
GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
public async Task RunCommand(ChatBot botInstance, MessageModel messagen, UserDbModel user, GroupCollection arguments, CancellationToken ctx)
|
||||
{
|
||||
|
||||
if (!arguments.TryGetValue("amount", out var amount)) //if user just enters !keno
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
@@ -63,14 +58,10 @@ public class SlotsCommand : ICommand
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Raylib.SetConfigFlags(ConfigFlags.HiddenWindow);
|
||||
Raylib.InitWindow(500,900,"KiwiSlot");
|
||||
|
||||
var board = new KiwiSlotBoard(wager);
|
||||
try
|
||||
{
|
||||
|
||||
board.LoadAssets();
|
||||
board.ExecuteGameLoop();
|
||||
//var finalImage = board.GenerateAnimatedWebp(board.SlotFrames);
|
||||
@@ -107,15 +98,9 @@ public class SlotsCommand : ICommand
|
||||
winnings -= wager;
|
||||
newBalance = await Money.NewWagerAsync(gambler.Id, wager, winnings, WagerGame.Slots, ct: ctx);
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]win[/color]! Current balance: {await newBalance.FormatKasinoCurrencyAsync()}" +
|
||||
$"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won[/color] {await winnings.FormatKasinoCurrencyAsync()}! Current balance: {await newBalance.FormatKasinoCurrencyAsync()}" +
|
||||
$"{featureAddOn}", true, autoDeleteAfter: TimeSpan.FromSeconds(30));
|
||||
}
|
||||
finally
|
||||
{
|
||||
board.UnloadAssets(); // beep boop wanted a try catch
|
||||
Raylib.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private class KiwiSlotBoard
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user