Change alias definitions to be global, so aliases can be reused across different networks

This commit is contained in:
2019-09-29 22:45:16 +01:00
parent 355a80b19b
commit 32309ecec2
15 changed files with 68 additions and 33 deletions

View File

@@ -22,21 +22,24 @@ class ModCommand:
main.saveConf("network")
success("Successfully set key %s to %s on %s" % (spl[2], spl[3], spl[1]))
return
# Find a better way to do this
#elif length == 6:
# if not spl[1] in main.network.keys():
# failure("Network does not exist: %s" % spl[1])
# return
# if not spl[3].isdigit():
# failure("Must be a number, not %s" % spl[3])
# return
# if not int(spl[3]) in main.network[spl[1]].relays.keys():
# failure("Relay/alias does not exist: %s" % spl[3])
# return
elif length == 6:
if not spl[1] in main.network.keys():
failure("Network does not exist: %s" % spl[1])
return
if not int(spl[3]) in main.network[spl[1]].relays.keys():
failure("Relay/alias does not exist: %s" % spl[3])
return
try:
x = getattr(main.network[spl[1]], spl[2])
x[spl[3]] = spl[4]
except e:
failure("Something went wrong.")
return
# try:
# x = getattr(main.network[spl[1]], spl[2])
# x[spl[3]] = spl[4]
# except Exception as err:
# failure("Error: %s" % err)
# return
else:
incUsage("mod")