update readmessage command to use TellAsync

This commit is contained in:
RaidMax 2023-04-03 15:56:13 -05:00
parent 3364473ce2
commit ad20572879

View File

@ -49,20 +49,13 @@ namespace IW4MAdmin.Application.Commands
return; return;
} }
var index = 1; await gameEvent.Origin.TellAsync(inboxItems.Select((inboxItem, index) =>
foreach (var inboxItem in inboxItems)
{ {
await gameEvent.Origin.Tell(_translationLookup["COMMANDS_READ_MESSAGE_SUCCESS"] var header = _translationLookup["COMMANDS_READ_MESSAGE_SUCCESS"]
.FormatExt($"{index}/{inboxItems.Count}", inboxItem.SourceClient.CurrentAlias.Name)) .FormatExt($"{index + 1}/{inboxItems.Count}", inboxItem.SourceClient.CurrentAlias.Name);
.WaitAsync();
foreach (var messageFragment in inboxItem.Message.FragmentMessageForDisplay()) return new[] { header }.Union(inboxItem.Message.FragmentMessageForDisplay());
{ }).SelectMany(item => item));
await gameEvent.Origin.Tell(messageFragment).WaitAsync();
}
index++;
}
inboxItems.ForEach(item => { item.IsDelivered = true; }); inboxItems.ForEach(item => { item.IsDelivered = true; });