vms should connect asynchronously

This commit is contained in:
Elijah R 2024-07-05 16:38:34 -04:00
parent 16e1aa47db
commit b8249b80dc

View file

@ -60,12 +60,14 @@ class Program
await Discord.Connect();
// Connect to VMs
VMs = Config.VMs.Select(vm => new VM(Config.Username, vm, Database)).ToArray();
var _t = new List<Task>();
foreach (var vm in VMs)
{
vm.MessageIncident += (_, i) => Discord.FlagChatMessageAsync(i);
vm.UsernameIncident += (_, i) => Discord.FlagUsernameAsync(i);
await vm.OpenAsync();
_t.Add(vm.OpenAsync());
}
await Task.WhenAll(_t);
await t;
}