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,11 +45,18 @@ 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;
await Task.Run(async () =>
{
foreach (var e in eventsOverview) foreach (var e in eventsOverview)
{
if (!string.IsNullOrEmpty(e))
{ {
await eventsChannel.SendMessageAsync(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)
{ {