Reshuffle key section

This commit is contained in:
Mark Veidemanis 2017-12-03 19:11:06 +00:00
parent 63396d54e3
commit e2682615ae
1 changed files with 16 additions and 22 deletions

View File

@ -633,7 +633,17 @@ class Helper(object):
helper.saveKeywordConfig() helper.saveKeywordConfig()
success("Successfully added exception %s for keyword %s" % (spl[3], spl[2])) success("Successfully added exception %s for keyword %s" % (spl[3], spl[2]))
return 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": elif spl[1] == "unexcept":
if not spl[2] in keyconf["KeywordsExcept"].keys(): if not spl[2] in keyconf["KeywordsExcept"].keys():
failure("No such exception: %s" % spl[2]) failure("No such exception: %s" % spl[2])
@ -650,7 +660,7 @@ class Helper(object):
else: else:
incUsage("key") incUsage("key")
return return
if length == 3: elif length == 3:
if spl[1] == "unexcept": if spl[1] == "unexcept":
if not spl[2] in keyconf["KeywordsExcept"].keys(): if not spl[2] in keyconf["KeywordsExcept"].keys():
failure("No such exception: %s" % spl[2]) failure("No such exception: %s" % spl[2])
@ -659,7 +669,9 @@ class Helper(object):
helper.saveKeywordConfig() helper.saveKeywordConfig()
success("Successfully removed exception list of %s" % spl[2]) success("Successfully removed exception list of %s" % spl[2])
return return
if length == 2: else:
incUsage("key")
elif length == 2:
if spl[1] == "show": if spl[1] == "show":
info(",".join(keyconf["Keywords"])) info(",".join(keyconf["Keywords"]))
return return
@ -672,31 +684,13 @@ class Helper(object):
exceptMap.append("\n") exceptMap.append("\n")
info("\n".join(exceptMap)) info("\n".join(exceptMap))
return return
elif spl[1] == "master":
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":
info(" - ".join(config["Master"])) info(" - ".join(config["Master"]))
return return
else: else:
incUsage("key") incUsage("key")
return return
else:
incUsage("key")
return
elif cmd == "add": elif cmd == "add":
if length == 6: if length == 6: