From 611ff2ae17cbfbc485057a320be248a2d3def00b Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 3 Apr 2023 15:55:46 -0500 Subject: [PATCH] update help command to use TellAsync --- Application/Commands/HelpCommand.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Application/Commands/HelpCommand.cs b/Application/Commands/HelpCommand.cs index c0b6201a..80aefd89 100644 --- a/Application/Commands/HelpCommand.cs +++ b/Application/Commands/HelpCommand.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -33,7 +34,7 @@ namespace IW4MAdmin.Application.Commands }; } - public override Task ExecuteAsync(GameEvent gameEvent) + public override async Task ExecuteAsync(GameEvent gameEvent) { var searchTerm = gameEvent.Data.Trim(); var availableCommands = gameEvent.Owner.Manager.Commands.Distinct().Where(command => @@ -70,24 +71,25 @@ namespace IW4MAdmin.Application.Commands }); var helpResponse = new StringBuilder(); + var messageList = new List(); foreach (var item in commandStrings) { helpResponse.Append(item.response); + if (item.index == 0 || item.index % 4 != 0) { continue; } - gameEvent.Origin.Tell(helpResponse.ToString()); + messageList.Add(helpResponse.ToString()); helpResponse = new StringBuilder(); } - gameEvent.Origin.Tell(helpResponse.ToString()); - gameEvent.Origin.Tell(_translationLookup["COMMANDS_HELP_MOREINFO"]); - } + messageList.Add(helpResponse.ToString()); - return Task.CompletedTask; + await gameEvent.Origin.TellAsync(messageList); + } } } -} \ No newline at end of file +}