From 062a4bcc20e8cd257dbc80153b6cc96d2c5f25db Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 22 Oct 2017 16:09:51 +0200 Subject: [PATCH] .die should work properly now --- NadekoBot.Core/Modules/Administration/SelfCommands.cs | 3 ++- NadekoBot.Core/Services/ShardsCoordinator.cs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NadekoBot.Core/Modules/Administration/SelfCommands.cs b/NadekoBot.Core/Modules/Administration/SelfCommands.cs index a672ba2d..e35cf0b1 100644 --- a/NadekoBot.Core/Modules/Administration/SelfCommands.cs +++ b/NadekoBot.Core/Modules/Administration/SelfCommands.cs @@ -317,7 +317,8 @@ namespace NadekoBot.Modules.Administration // ignored } await Task.Delay(2000).ConfigureAwait(false); - Environment.Exit(0); + var sub = _cache.Redis.GetSubscriber(); + sub.Publish(_creds.RedisKey() + "_die", "", StackExchange.Redis.CommandFlags.FireAndForget); } [NadekoCommand, Usage, Description, Aliases] diff --git a/NadekoBot.Core/Services/ShardsCoordinator.cs b/NadekoBot.Core/Services/ShardsCoordinator.cs index 645bff1f..4f4aa948 100644 --- a/NadekoBot.Core/Services/ShardsCoordinator.cs +++ b/NadekoBot.Core/Services/ShardsCoordinator.cs @@ -65,6 +65,10 @@ namespace NadekoBot.Core.Services sub.Subscribe(_key + "_shardcoord_stop", OnStop, CommandFlags.FireAndForget); + + sub.Subscribe(_key + "_die", + (ch, x) => Environment.Exit(0), + CommandFlags.FireAndForget); } private void OnStop(RedisChannel ch, RedisValue data)