From 3c99a237d2ab26341a8d23fd712f0c9533e7ba03 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Sun, 21 Apr 2019 22:38:20 +0500 Subject: [PATCH] use the existing restart command instead of just dying (._.) --- CompatBot/Program.cs | 2 +- CompatBot/Watchdog.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CompatBot/Program.cs b/CompatBot/Program.cs index 25e1c572..5222a570 100644 --- a/CompatBot/Program.cs +++ b/CompatBot/Program.cs @@ -20,7 +20,7 @@ namespace CompatBot { private static readonly SemaphoreSlim InstanceCheck = new SemaphoreSlim(0, 1); private static readonly SemaphoreSlim ShutdownCheck = new SemaphoreSlim(0, 1); - private const ulong InvalidChannelId = 13; + internal const ulong InvalidChannelId = 13; internal static async Task Main(string[] args) { diff --git a/CompatBot/Watchdog.cs b/CompatBot/Watchdog.cs index e9d92152..9e0e0e64 100644 --- a/CompatBot/Watchdog.cs +++ b/CompatBot/Watchdog.cs @@ -3,6 +3,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; +using CompatBot.Commands; using DSharpPlus; namespace CompatBot @@ -24,7 +25,7 @@ namespace CompatBot { var ch = await client.GetChannelAsync(Config.BotSpamId).ConfigureAwait(false); await client.SendMessageAsync(ch, "Potential socket deadlock detected, restarting...").ConfigureAwait(false); - Config.Cts.Cancel(false); + Sudo.Bot.Restart(Program.InvalidChannelId); } catch (Exception e) {