From 3fc7294539d6ae82369ca7b4321ed7be6767c767 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 11 Oct 2019 17:06:37 +0100 Subject: [PATCH] exit when all servers are disconnected after ctrl+c --- modules/signals.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/signals.py b/modules/signals.py index 336a83d3..286852d6 100644 --- a/modules/signals.py +++ b/modules/signals.py @@ -35,7 +35,11 @@ class Module(ModuleManager.BaseModule): sys.exit() def _make_hook(self, server): - return lambda e: self.bot.disconnect(server) + return lambda e: self._disconnect_hook(server) + def _disconnect_hook(self, server): + self.bot.disconnect(server) + if not self.bot.servers: + sys.exit() def SIGUSR1(self, signum, frame): self.bot.trigger(self._reload_config)