From 89894287b3b0b2404d2e126a3229cac6dc2021dd Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 2 Oct 2019 21:25:15 +0100 Subject: [PATCH] Add error handling to exec command and fix minor bug in cleaning up relays --- commands/exec.py | 7 ++++++- core/bot.py | 2 ++ modules/network.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/exec.py b/commands/exec.py index 50080f1..c199aa8 100644 --- a/commands/exec.py +++ b/commands/exec.py @@ -7,7 +7,12 @@ class ExecCommand: def exec(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length): if authed: if length > 1: - info(str(exec(" ".join(spl[1:])))) + try: + rtrn = exec(" ".join(spl[1:])) + except Exception as err: + failure(str(err)) + return + info(str(rtrn)) return else: incUsage("exec") diff --git a/core/bot.py b/core/bot.py index d078ca1..122b9b0 100644 --- a/core/bot.py +++ b/core/bot.py @@ -223,6 +223,8 @@ class IRCBot(IRCClient): self.setNick(self._attemptedNick) def irc_ERR_PASSWDMISMATCH(self, prefix, params): + print(locals()) + print(globals()) log("%s: password mismatch" % self.name) sendAll("%s: password mismatch" % self.name) diff --git a/modules/network.py b/modules/network.py index 6b45880..fbcfaa4 100644 --- a/modules/network.py +++ b/modules/network.py @@ -58,7 +58,7 @@ class Network: def seppuku(self): # Removes all bots in preperation for deletion - self.killAliases(self.relay.keys()) + self.killAliases(self.relays.keys()) def start_bot(self, num): # a single name is given to relays in the backend