wrapped async void thing in try catch just in case

This commit is contained in:
Kwoth 2016-07-26 01:32:40 +02:00
parent 531c9821ae
commit a6f3a29be4

View File

@ -90,6 +90,8 @@ namespace NadekoBot.Modules.Gambling.Commands
var token = cancelSource.Token;
var fullgame = CheckForFullGameAsync(token);
Task.Run(async () =>
{
try
{
await raceChannel.SendMessage($"🏁`Race is starting in 20 seconds or when the room is full. Type $jr to join the race.`");
var t = await Task.WhenAny(Task.Delay(20000, token), fullgame);
@ -99,10 +101,12 @@ namespace NadekoBot.Modules.Gambling.Commands
{
await raceChannel.SendMessage("🏁`Race full, starting right now!`");
}
else if (participants.Count > 1) {
else if (participants.Count > 1)
{
await raceChannel.SendMessage("🏁`Game starting with " + participants.Count + " praticipants.`");
}
else {
else
{
await raceChannel.SendMessage("🏁`Race failed to start since there was not enough participants.`");
var p = participants.FirstOrDefault();
if (p != null)
@ -112,6 +116,8 @@ namespace NadekoBot.Modules.Gambling.Commands
}
await Task.Run(StartRace);
End();
}
catch { }
});
}