Skip to content

Commit

Permalink
Add more feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Oct 24, 2024
1 parent ffbd5b4 commit e8b59da
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/CS2/Raffle/StartRaffleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ public class StartRaffleCommand(IServiceProvider provider) : ICommand {
public string[] RequiredFlags => ["@css/root"];
public string[] Usage => ["", "<amount>"];

public Task<CommandResult> Execute(PlayerWrapper? executor,
public async Task<CommandResult> 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;
}
}

0 comments on commit e8b59da

Please sign in to comment.