From ca7258ef286d492407f43535b6ae725b976118fb Mon Sep 17 00:00:00 2001 From: benbierens Date: Thu, 11 Apr 2024 13:14:21 +0200 Subject: [PATCH] async dispatches sending of event overview to discord channel --- Tools/BiblioTech/Rewards/RoleDriver.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tools/BiblioTech/Rewards/RoleDriver.cs b/Tools/BiblioTech/Rewards/RoleDriver.cs index 2afff6e..303f069 100644 --- a/Tools/BiblioTech/Rewards/RoleDriver.cs +++ b/Tools/BiblioTech/Rewards/RoleDriver.cs @@ -45,10 +45,17 @@ namespace BiblioTech.Rewards private async Task ProcessChainEvents(string[] eventsOverview) { 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> LoadAllUsers(SocketGuild guild)