mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-25 05:56:58 +01:00
Merge pull request #155 from Cyberboss/MoreReliable
Use more reliable reconnect method for discord
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user