Implement option viewing and setting
This commit is contained in:
parent
12be21fb4e
commit
4f70cf69b3
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"pass": "pass [password]",
|
"pass": "pass <password>",
|
||||||
"logout": "logout",
|
"logout": "logout",
|
||||||
"add": "add [name] [address] [port] [ssl|plain] [nickname]",
|
"add": "add <name> <address> <port> <ssl|plain> <nickname>",
|
||||||
"del": "del [name",
|
"del": "del <name>",
|
||||||
|
"mod": "mod <name> [<key>] [<value>]",
|
||||||
"list": "list",
|
"list": "list",
|
||||||
"rehash": "rehash"
|
"rehash": "rehash"
|
||||||
}
|
}
|
||||||
|
|
54
threshold
54
threshold
|
@ -167,7 +167,10 @@ class Helper(object):
|
||||||
elif cmd == "list":
|
elif cmd == "list":
|
||||||
poolMap = []
|
poolMap = []
|
||||||
for i in pool.keys():
|
for i in pool.keys():
|
||||||
poolMap.append("%s: %s" % (i, pool[i]))
|
poolMap.append("Server: %s" % i)
|
||||||
|
for x in pool[i].keys():
|
||||||
|
poolMap.append("%s: %s" % (x, pool[i][x]))
|
||||||
|
poolMap.append("\n")
|
||||||
info("\n".join(poolMap))
|
info("\n".join(poolMap))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -188,6 +191,17 @@ class Helper(object):
|
||||||
"port": spl[3],
|
"port": spl[3],
|
||||||
"protocol": protocol,
|
"protocol": protocol,
|
||||||
"nickname": spl[5],
|
"nickname": spl[5],
|
||||||
|
"username": None,
|
||||||
|
"realname": None,
|
||||||
|
"userinfo": None,
|
||||||
|
"finger": None,
|
||||||
|
"version": None,
|
||||||
|
"source": None,
|
||||||
|
"authtype": None,
|
||||||
|
"password": None,
|
||||||
|
"authentity": None,
|
||||||
|
"key": None,
|
||||||
|
"certificate": None,
|
||||||
}
|
}
|
||||||
success("Successfully created bot")
|
success("Successfully created bot")
|
||||||
self.savePool()
|
self.savePool()
|
||||||
|
@ -210,6 +224,44 @@ class Helper(object):
|
||||||
incUsage("del")
|
incUsage("del")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif cmd == "mod":
|
||||||
|
if length == 2:
|
||||||
|
if not spl[1] in pool.keys():
|
||||||
|
failure("Name does not exist: %s" % spl[1])
|
||||||
|
return
|
||||||
|
optionMap = ["Viewing options for %s" % spl[1]]
|
||||||
|
for i in pool[spl[1]].keys():
|
||||||
|
optionMap.append("%s: %s" % (i, pool[spl[1]][i]))
|
||||||
|
info("\n".join(optionMap))
|
||||||
|
return
|
||||||
|
|
||||||
|
elif length == 3:
|
||||||
|
if not spl[1] in pool.keys():
|
||||||
|
failure("Name does not exist: %s" % spl[1])
|
||||||
|
return
|
||||||
|
if not spl[2] in pool[spl[1]].keys():
|
||||||
|
failure("No such key: %s" % spl[2])
|
||||||
|
return
|
||||||
|
info("%s: %s" % (spl[2], pool[spl[1]][spl[2]]))
|
||||||
|
return
|
||||||
|
|
||||||
|
elif length == 4:
|
||||||
|
if not spl[1] in pool.keys():
|
||||||
|
failure("Name does not exist: %s" % spl[1])
|
||||||
|
return
|
||||||
|
if not spl[2] in pool[spl[1]].keys():
|
||||||
|
failure("No such key: %s" % spl[2])
|
||||||
|
return
|
||||||
|
if spl[3] == pool[spl[1]][spl[2]]:
|
||||||
|
failure("Value already exists: %s" % spl[3])
|
||||||
|
return
|
||||||
|
pool[spl[1]][spl[2]] = spl[3]
|
||||||
|
success("Successfully set key %s to %s on %s" % (spl[2], spl[3], spl[1]))
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
incUsage("mod")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
incUsage(None)
|
incUsage(None)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue