From e2682615aec11ccbaef9b484870894ae3e73335f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 3 Dec 2017 19:11:06 +0000 Subject: [PATCH] Reshuffle key section --- threshold | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/threshold b/threshold index 4764701..000b039 100755 --- a/threshold +++ b/threshold @@ -633,7 +633,17 @@ class Helper(object): helper.saveKeywordConfig() success("Successfully added exception %s for keyword %s" % (spl[3], spl[2])) return - + elif spl[1] == "master": + if not spl[2] in pool.keys(): + failure("Name does not exist: %s" % spl[2]) + return + if spl[2] in IRCPool.keys(): + if not spl[3] in IRCPool[spl[2]].channels: + info("Bot not on channel: %s" % spl[3]) + config["Master"] = [spl[2], spl[3]] + helper.saveConfig() + success("Master set to %s on %s" % (spl[3], spl[2])) + return elif spl[1] == "unexcept": if not spl[2] in keyconf["KeywordsExcept"].keys(): failure("No such exception: %s" % spl[2]) @@ -650,7 +660,7 @@ class Helper(object): else: incUsage("key") return - if length == 3: + elif length == 3: if spl[1] == "unexcept": if not spl[2] in keyconf["KeywordsExcept"].keys(): failure("No such exception: %s" % spl[2]) @@ -659,7 +669,9 @@ class Helper(object): helper.saveKeywordConfig() success("Successfully removed exception list of %s" % spl[2]) return - if length == 2: + else: + incUsage("key") + elif length == 2: if spl[1] == "show": info(",".join(keyconf["Keywords"])) return @@ -672,31 +684,13 @@ class Helper(object): exceptMap.append("\n") info("\n".join(exceptMap)) return - - if length == 4: - if spl[1] == "master": - if not spl[2] in pool.keys(): - failure("Name does not exist: %s" % spl[2]) - return - if spl[2] in IRCPool.keys(): - if not spl[3] in IRCPool[spl[2]].channels: - info("Bot not on channel: %s" % spl[3]) - config["Master"] = [spl[2], spl[3]] - helper.saveConfig() - success("Master set to %s on %s" % (spl[3], spl[2])) - return - elif length == 2: - if spl[1] == "master": + elif spl[1] == "master": info(" - ".join(config["Master"])) return else: incUsage("key") return - else: - incUsage("key") - return - elif cmd == "add": if length == 6: