From 14125a6048500757cdd4a3e35fdb1bc5fd429006 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 1 Sep 2019 08:41:22 +0100 Subject: [PATCH] also cancel reconnections with !disconnect --- modules/admin.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/admin.py b/modules/admin.py index 5014f766..ca27ee91 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -83,8 +83,15 @@ class Module(ModuleManager.BaseModule): raise utils.EventError("Unknown server alias") server = self.bot.get_server_by_id(id) - server.disconnect() - self.bot.disconnect(server) + if not server == None: + server.disconnect() + self.bot.disconnect(server) + elif id in event["server"].reconnections: + event["server"].reconnections[id].cancel() + del event["server"].reconnections[id] + else: + raise utils.EventError("Server not connected") + event["stdout"].write("Disconnected from %s" % str(server)) @utils.hook("received.command.shutdown")