Merge pull request #155 from Cyberboss/MoreReliable

Use more reliable reconnect method for discord
This commit is contained in:
Jordan Brown
2017-09-08 10:38:38 -04:00
committed by GitHub
+5 -13
View File
@@ -118,21 +118,13 @@ namespace TGServerService
public string Reconnect()
{
try
TGDiscordSetupInfo tmp;
lock (DiscordLock)
{
lock (DiscordLock)
{
SeenPrivateChannels.Clear();
if (client.State == ConnectionState.Connected)
client.Disconnect().Wait();
client.Connect(DiscordConfig.BotToken, TokenType.Bot).Wait();
}
return !Connected() ? "Connection failed!" : null;
}
catch (Exception e)
{
return e.ToString();
tmp = new TGDiscordSetupInfo(DiscordConfig);
DiscordConfig.BotToken = "THIS_IS_NOT_A_BOT_TOKEN";
}
return SetProviderInfo(tmp);
}
public void SendMessage(string msg, ChatMessageType mt)