mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-23 10:19:39 +00:00
Handle complete discord outage
This commit is contained in:
parent
92c1db42e5
commit
d2df3c5961
@ -128,6 +128,7 @@ namespace CompatBot.Commands
|
||||
|
||||
internal static void Restart(ulong channelId)
|
||||
{
|
||||
Config.Log.Info("Restarting...");
|
||||
using (var self = new Process
|
||||
{
|
||||
#if DEBUG
|
||||
|
@ -219,17 +219,7 @@ namespace CompatBot
|
||||
}
|
||||
logLevel(eventArgs.Exception, eventArgs.Message);
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
await client.ConnectAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Config.Log.Fatal(e, "Terminating");
|
||||
return;
|
||||
}
|
||||
|
||||
await client.ConnectAsync();
|
||||
if (args.Length > 1 && ulong.TryParse(args[1], out var channelId))
|
||||
{
|
||||
Config.Log.Info($"Found channelId: {args[1]}");
|
||||
@ -262,8 +252,11 @@ namespace CompatBot
|
||||
}
|
||||
await backgroundTasks.ConfigureAwait(false);
|
||||
}
|
||||
catch (TaskCanceledException) { }
|
||||
catch(Exception e)
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
Config.Log.Info("Exiting");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Config.Log.Fatal(e, "Experienced catastrophic failure, attempting to restart...");
|
||||
Sudo.Bot.Restart(InvalidChannelId);
|
||||
@ -273,7 +266,6 @@ namespace CompatBot
|
||||
ShutdownCheck.Release();
|
||||
if (singleInstanceCheckThread.IsAlive)
|
||||
singleInstanceCheckThread.Join(100);
|
||||
Config.Log.Info("Exiting");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user