async dispatches sending of event overview to discord channel

This commit is contained in:
benbierens 2024-04-11 13:14:21 +02:00
parent 1dbb749732
commit ca7258ef28
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
1 changed files with 10 additions and 3 deletions

View File

@ -45,10 +45,17 @@ namespace BiblioTech.Rewards
private async Task ProcessChainEvents(string[] eventsOverview) private async Task ProcessChainEvents(string[] eventsOverview)
{ {
if (eventsChannel == null || eventsOverview == null || !eventsOverview.Any()) return; if (eventsChannel == null || eventsOverview == null || !eventsOverview.Any()) return;
foreach (var e in eventsOverview) await Task.Run(async () =>
{ {
await eventsChannel.SendMessageAsync(e); foreach (var e in eventsOverview)
} {
if (!string.IsNullOrEmpty(e))
{
await eventsChannel.SendMessageAsync(e);
await Task.Delay(3000);
}
}
});
} }
private async Task<Dictionary<ulong, IGuildUser>> LoadAllUsers(SocketGuild guild) private async Task<Dictionary<ulong, IGuildUser>> LoadAllUsers(SocketGuild guild)