vms should connect asynchronously
This commit is contained in:
parent
16e1aa47db
commit
b8249b80dc
1 changed files with 3 additions and 1 deletions
|
@ -60,12 +60,14 @@ class Program
|
||||||
await Discord.Connect();
|
await Discord.Connect();
|
||||||
// Connect to VMs
|
// Connect to VMs
|
||||||
VMs = Config.VMs.Select(vm => new VM(Config.Username, vm, Database)).ToArray();
|
VMs = Config.VMs.Select(vm => new VM(Config.Username, vm, Database)).ToArray();
|
||||||
|
var _t = new List<Task>();
|
||||||
foreach (var vm in VMs)
|
foreach (var vm in VMs)
|
||||||
{
|
{
|
||||||
vm.MessageIncident += (_, i) => Discord.FlagChatMessageAsync(i);
|
vm.MessageIncident += (_, i) => Discord.FlagChatMessageAsync(i);
|
||||||
vm.UsernameIncident += (_, i) => Discord.FlagUsernameAsync(i);
|
vm.UsernameIncident += (_, i) => Discord.FlagUsernameAsync(i);
|
||||||
await vm.OpenAsync();
|
_t.Add(vm.OpenAsync());
|
||||||
}
|
}
|
||||||
|
await Task.WhenAll(_t);
|
||||||
await t;
|
await t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue