From b52ff73bb974d7e4c4397f78ad60ae88a7367511 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 22 Sep 2017 19:28:47 -0400 Subject: [PATCH] Fix Connect() not waiting for ConnectionState to update --- TGServerService/Discord.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TGServerService/Discord.cs b/TGServerService/Discord.cs index 31bb0a4d87..87758d74e5 100644 --- a/TGServerService/Discord.cs +++ b/TGServerService/Discord.cs @@ -2,7 +2,7 @@ using Discord; using Discord.WebSocket; using System; using System.Collections.Generic; -using System.Linq; +using System.Threading; using System.Threading.Tasks; using TGServiceInterface; @@ -92,6 +92,7 @@ namespace TGServerService SeenPrivateChannels.Clear(); client.LoginAsync(TokenType.Bot, DiscordConfig.BotToken).Wait(); client.StartAsync().Wait(); + Thread.Sleep(1000); //wait for ConnectionState to update } return !Connected() ? "Connection failed!" : null; }