From e8b59da1112f9b3bb648b37156ea54b7a1fdfc34 Mon Sep 17 00:00:00 2001 From: MSWS Date: Wed, 23 Oct 2024 20:34:11 -0700 Subject: [PATCH] Add more feedback --- src/CS2/Raffle/StartRaffleCommand.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/CS2/Raffle/StartRaffleCommand.cs b/src/CS2/Raffle/StartRaffleCommand.cs index 6b21ada..52e06c6 100644 --- a/src/CS2/Raffle/StartRaffleCommand.cs +++ b/src/CS2/Raffle/StartRaffleCommand.cs @@ -15,14 +15,19 @@ public class StartRaffleCommand(IServiceProvider provider) : ICommand { public string[] RequiredFlags => ["@css/root"]; public string[] Usage => ["", ""]; - public Task Execute(PlayerWrapper? executor, + public async Task Execute(PlayerWrapper? executor, CommandInfoWrapper info) { var amo = 100; if (info.ArgCount == 2) if (!int.TryParse(info.Args[1], out amo)) - return Task.FromResult(CommandResult.PRINT_USAGE); + return CommandResult.PRINT_USAGE; - Server.NextFrame(() => raffle.StartRaffle(amo)); - return Task.FromResult(CommandResult.SUCCESS); + var result = false; + await Server.NextFrameAsync(() => { result = raffle.StartRaffle(amo); }); + + info.ReplySync(result ? + "Raffle started with a prize of $" + amo : + "Raffle already in progress"); + return CommandResult.SUCCESS; } } \ No newline at end of file